新增接口给大模型调用,推送资讯到全量库
This commit is contained in:
parent
e76ad82a95
commit
df83e8418c
|
|
@ -34,6 +34,7 @@ public class CommonController {
|
||||||
private final String endPoint;
|
private final String endPoint;
|
||||||
private final String region;
|
private final String region;
|
||||||
private final String bucketName;
|
private final String bucketName;
|
||||||
|
private final String apiKey;
|
||||||
private final ObjectMapper objectMapper;
|
private final ObjectMapper objectMapper;
|
||||||
private final NewsInfoService newsInfoService;
|
private final NewsInfoService newsInfoService;
|
||||||
|
|
||||||
|
|
@ -44,6 +45,7 @@ public class CommonController {
|
||||||
@Value("${oss.endPoint}") String endPoint,
|
@Value("${oss.endPoint}") String endPoint,
|
||||||
@Value("${oss.region}") String region,
|
@Value("${oss.region}") String region,
|
||||||
@Value("${oss.bucketName}") String bucketName,
|
@Value("${oss.bucketName}") String bucketName,
|
||||||
|
@Value("${api.key}") String apiKey,
|
||||||
ObjectMapper objectMapper,
|
ObjectMapper objectMapper,
|
||||||
NewsInfoService newsInfoService) {
|
NewsInfoService newsInfoService) {
|
||||||
this.stsEndPoint = stsEndPoint;
|
this.stsEndPoint = stsEndPoint;
|
||||||
|
|
@ -53,6 +55,7 @@ public class CommonController {
|
||||||
this.endPoint = endPoint;
|
this.endPoint = endPoint;
|
||||||
this.region = region;
|
this.region = region;
|
||||||
this.bucketName = bucketName;
|
this.bucketName = bucketName;
|
||||||
|
this.apiKey = apiKey;
|
||||||
this.objectMapper = objectMapper;
|
this.objectMapper = objectMapper;
|
||||||
this.newsInfoService = newsInfoService;
|
this.newsInfoService = newsInfoService;
|
||||||
}
|
}
|
||||||
|
|
@ -121,9 +124,18 @@ public class CommonController {
|
||||||
return ossVO;
|
return ossVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/sync/{id}")
|
@GetMapping("/sync/{id}/{code}")
|
||||||
public ResultObject<Void> sync(@PathVariable("id") String id) {
|
public ResultObject<Void> sync(@PathVariable("id") String id, @PathVariable("code") String code) {
|
||||||
try {
|
try {
|
||||||
|
if (!StringUtils.hasText(id)) {
|
||||||
|
return ResultObject.failed("参数有误!");
|
||||||
|
}
|
||||||
|
if (!StringUtils.hasText(code)) {
|
||||||
|
return ResultObject.failed("参数有误!");
|
||||||
|
}
|
||||||
|
if (!code.equals(apiKey)) {
|
||||||
|
return ResultObject.failed("参数有误!");
|
||||||
|
}
|
||||||
log.info("path: /sync/sync, method: GET, request news id: {}", id);
|
log.info("path: /sync/sync, method: GET, request news id: {}", id);
|
||||||
return newsInfoService.publish(id, 1L);
|
return newsInfoService.publish(id, 1L);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -41,3 +41,5 @@ elasticsearch:
|
||||||
password: ZxE,3VM@Thk0
|
password: ZxE,3VM@Thk0
|
||||||
mybatis:
|
mybatis:
|
||||||
type-handlers-package:com.jinrui.reference.core.typehandler
|
type-handlers-package:com.jinrui.reference.core.typehandler
|
||||||
|
api:
|
||||||
|
key: WBysu6N1z26AbA12l
|
||||||
Loading…
Reference in New Issue