|
@@ -11,6 +11,7 @@ import com.tzld.longarticle.recommend.server.service.exterior.GhDetailService;
|
|
|
import com.tzld.longarticle.recommend.server.util.page.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.reactive.function.client.WebClient;
|
|
@@ -61,31 +62,26 @@ public class GhDetailServiceImpl implements GhDetailService {
|
|
|
return CommonResponse.success();
|
|
|
}
|
|
|
for (GhDetail ghDetail : ghDetails) {
|
|
|
- GhDetail updateGhDetail = getGhDetail(ghDetail);
|
|
|
- if (updateGhDetail == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- System.out.println("getGhDetail = " + ghDetail);
|
|
|
+ getGhDetail(ghDetail);
|
|
|
log.info("getGhDetail = {}", ghDetail);
|
|
|
- ghDetailMapper.updateByPrimaryKeySelective(updateGhDetail);
|
|
|
+ ghDetailMapper.updateByPrimaryKeySelective(ghDetail);
|
|
|
}
|
|
|
return CommonResponse.success();
|
|
|
}
|
|
|
|
|
|
- public GhDetail getGhDetail(GhDetail ghDetail) {
|
|
|
- String baseUrl = String.format("http://aigc-api.cybertogether.net/aigc/publish/account/algorithm/wechat/list?gh_id=%s", ghDetail.getId());
|
|
|
+ public void getGhDetail(GhDetail ghDetail) {
|
|
|
+ String baseUrl = "http://aigc-api.cybertogether.net";
|
|
|
WebClient webClient = WebClient.builder()
|
|
|
.baseUrl(baseUrl)
|
|
|
.build();
|
|
|
- Mono<String> mono = webClient.get().retrieve().bodyToMono(String.class);
|
|
|
+ Mono<String> mono = webClient.get()
|
|
|
+ .uri(String.format("/aigc/publish/account/algorithm/wechat/list?gh_id=%s", ghDetail.getGhId()))
|
|
|
+ .retrieve().bodyToMono(String.class);
|
|
|
String block = mono.block();
|
|
|
JSONArray jsonArray = JSONArray.parseArray(block);
|
|
|
if (jsonArray != null && !jsonArray.isEmpty()) {
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(0);
|
|
|
- System.out.println("jsonObject = " + jsonObject);
|
|
|
- log.info("jsonObject = {}", jsonObject);
|
|
|
ghDetail.setGhName(jsonObject.getString("name"));
|
|
|
}
|
|
|
- return null;
|
|
|
}
|
|
|
}
|