소스 검색

Merge remote-tracking branch 'origin/master'

wangyunpeng 4 주 전
부모
커밋
1c8dfa634d

+ 17 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/aigc/AIGCProducePlanDetailService.java

@@ -2,6 +2,7 @@ package com.tzld.longarticle.recommend.server.remote.aigc;
 
 import com.alibaba.fastjson.JSONObject;
 import com.tzld.longarticle.recommend.server.common.HttpPoolFactory;
+import com.tzld.longarticle.recommend.server.model.dto.Content;
 import com.tzld.longarticle.recommend.server.model.vo.aigc.ProducePlanDetailVO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.HttpEntity;
@@ -24,6 +25,22 @@ public class AIGCProducePlanDetailService {
     private final CloseableHttpClient client = HttpPoolFactory.aigcPool();
 
     public ProducePlanDetailVO articleGetProducePlanDetail(String planId) {
+        int retryTimes = 2;
+        while (retryTimes > 0) {
+            ProducePlanDetailVO result = post(planId);
+            if (Objects.nonNull(result)) {
+                return result;
+            }
+            retryTimes--;
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ignored) {
+            }
+        }
+        return null;
+    }
+
+    public ProducePlanDetailVO post(String planId) {
         String apiUrl = "http://aigc-api.cybertogether.net/aigc/produce/plan/detail";
 
         // 构建请求的 JSON Payload