Sfoglia il codice sorgente

文章没有匹配小程序增加接口调用过滤

xueyiming 5 giorni fa
parent
commit
f2a3d3f821

+ 5 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/ContentServiceImpl.java

@@ -19,6 +19,7 @@ import com.tzld.piaoquan.longarticle.model.vo.*;
 import com.tzld.piaoquan.longarticle.service.local.ContentService;
 import com.tzld.piaoquan.longarticle.service.local.KimiService;
 import com.tzld.piaoquan.longarticle.service.remote.AigcService;
+import com.tzld.piaoquan.longarticle.service.remote.MatchService;
 import com.tzld.piaoquan.longarticle.service.remote.SortService;
 import com.tzld.piaoquan.longarticle.service.remote.VideoService;
 import com.tzld.piaoquan.longarticle.utils.DateUtil;
@@ -95,6 +96,9 @@ public class ContentServiceImpl implements ContentService {
     @Autowired
     private ContentPlatformVideoMapper contentPlatformVideoMapper;
 
+    @Autowired
+    private MatchService matchService;
+
     public void addMatchContent(MatchVideo matchVideo, String publishContentId) {
         PublishMatchContent publishMatchContent = new PublishMatchContent();
         publishMatchContent.setTraceId(matchVideo.getTraceId());
@@ -269,6 +273,7 @@ public class ContentServiceImpl implements ContentService {
             statusParam.setErrorMsg("小程序为空");
             aigcService.updateMatchMiniprogramStatus(statusParam);
             log.info("文章获取小程序为空 matchVideo={} planAccount={}", matchVideo, planAccount);
+            matchService.notHasMiniVideos(publishContent.getSourceId());
             return new ArrayList<>();
         }
         List<VideoDetail> videoDetails = publishVideo(contentMiniVideos, matchVideo, publishContent);

+ 2 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/MatchService.java

@@ -8,4 +8,6 @@ public interface MatchService {
     Integer matchMiniprogramVideo(MiniprogramCardRequest request);
 
     boolean addAudit(AuditContentRequest request);
+
+    boolean notHasMiniVideos(String sourceId);
 }

+ 20 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/impl/MatchServiceImpl.java

@@ -46,6 +46,7 @@ public class MatchServiceImpl implements MatchService {
         return MatchRequestStatusEnum.HAS_EXCEPTION.getStatusCode();
     }
 
+    @Override
     public boolean addAudit(AuditContentRequest request) {
         String apiUrl = "http://101.37.174.139:80/articleVideoAudit/addAudit";
         int retry = 0;
@@ -66,4 +67,23 @@ public class MatchServiceImpl implements MatchService {
         }
         return false;
     }
+
+    public boolean notHasMiniVideos(String sourceId) {
+        String apiUrl = "http://101.37.174.139:80/articleVideoAudit/updateContentStatusBySourceId?sourceId=" + sourceId;
+        int retry = 0;
+        while (retry < 3) {
+            try {
+                String res = HTTP_POOL_CLIENT_UTIL_DEFAULT.get(apiUrl);
+                JSONObject jsonObject = JSON.parseObject(res);
+                Integer code = jsonObject.getInteger("code");
+                if (code == 0) {
+                    return true;
+                }
+            } catch (Exception e) {
+                log.error("notHasMiniVideos error", e);
+            }
+            retry++;
+        }
+        return false;
+    }
 }