Browse Source

修改更新

xueyiming 9 tháng trước cách đây
mục cha
commit
0cb31d3320

+ 8 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/exterior/impl/GhDetailServiceImpl.java

@@ -61,14 +61,17 @@ public class GhDetailServiceImpl implements GhDetailService {
             return CommonResponse.success();
         }
         for (GhDetail ghDetail : ghDetails) {
-            getGhDetail(ghDetail);
+            GhDetail updateGhDetail = getGhDetail(ghDetail);
+            if (updateGhDetail == null) {
+                continue;
+            }
             log.info("getGhDetail = {}", ghDetail);
-            ghDetailMapper.updateByPrimaryKeySelective(ghDetail);
+            ghDetailMapper.updateByPrimaryKeySelective(updateGhDetail);
         }
         return CommonResponse.success();
     }
 
-    public void getGhDetail(GhDetail ghDetail) {
+    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());
         WebClient webClient = WebClient.builder()
                 .baseUrl(baseUrl)
@@ -78,7 +81,9 @@ public class GhDetailServiceImpl implements GhDetailService {
         JSONArray jsonArray = JSONArray.parseArray(block);
         if (jsonArray != null && !jsonArray.isEmpty()) {
             JSONObject jsonObject = jsonArray.getJSONObject(0);
+            log.info("jsonObject = {}", jsonObject);
             ghDetail.setGhName(jsonObject.getString("name"));
         }
+        return null;
     }
 }