Parcourir la source

修改调用文章匹配小程序

xueyiming il y a 5 mois
Parent
commit
10068c0e46

+ 9 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -813,7 +813,15 @@ public class CoreServiceImpl implements CoreService {
                                 request.setArticleId(matchContent.getSourceId());
                                 request.setFlowPoolLevelTag(matchContent.getFlowPoolLevelTag());
                                 request.setPublishFlag(2);
-                                matchService.matchMiniprogramVideo(request);
+                                Integer status = matchService.matchMiniprogramVideo(request);
+                                if (status == 2) {
+                                    MatchMiniprogramStatusParam statusParam = new MatchMiniprogramStatusParam();
+                                    statusParam.setStatus(3);
+                                    statusParam.setPublishContentId(matchContent.getPublishContentId());
+                                    String errorMessage = "没有文章内容";
+                                    statusParam.setErrorMsg(errorMessage);
+                                    aigcService.updateMatchMiniprogramStatus(statusParam);
+                                }
                             }
                         } catch (InterruptedException e) {
                             throw new RuntimeException(e);

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

@@ -4,5 +4,5 @@ import com.tzld.piaoquan.longarticle.model.dto.MiniprogramCardRequest;
 
 public interface MatchService {
 
-    String matchMiniprogramVideo(MiniprogramCardRequest request);
+    Integer matchMiniprogramVideo(MiniprogramCardRequest request);
 }

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

@@ -17,7 +17,7 @@ public class MatchServiceImpl implements MatchService {
 
 
     @Override
-    public String matchMiniprogramVideo(MiniprogramCardRequest request) {
+    public Integer matchMiniprogramVideo(MiniprogramCardRequest request) {
         String apiUrl = "http://47.99.132.47:8111/search_videos";
         try {
             log.info("matchMiniprogramVideo request={}", request);
@@ -26,11 +26,20 @@ public class MatchServiceImpl implements MatchService {
             log.info("matchMiniprogramVideo request={} res={}", request, res);
             Integer code = jsonObject.getInteger("code");
             if (code == 0) {
-                return jsonObject.getString("traceId");
+                // 1成功
+                return 1;
+            } else if (code == 1) {
+                if ("params check error".equals(jsonObject.getString("info"))
+                        && "content".equals(jsonObject.getString("message"))
+                        && "fail".equals(jsonObject.getString("status"))) {
+                    //2 没有文章内容
+                    return 2;
+                }
             }
         } catch (Exception e) {
             log.error("matchMiniprogramVideo error", e);
         }
-        return "";
+        //0 异常情况
+        return 0;
     }
 }