فهرست منبع

Merge branch 'master' into wyp/1211-recommendVideoSource

# Conflicts:
#	long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/recall/RecallService.java
wangyunpeng 7 ماه پیش
والد
کامیت
ca5e1bcc61

+ 5 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/WxAccessTokenRemoteService.java

@@ -42,6 +42,11 @@ public class WxAccessTokenRemoteService {
     private Map<String, Map<String, String>> gzhConfig;
 
     public String getAccessToken(String gzhId) {
+        try {
+            return cache.getUnchecked(gzhId);
+        } catch (Exception e) {
+            log.error("get user error gzhId {} ", gzhId, e);
+        }
         return cache.getUnchecked(gzhId);
     }
 

+ 28 - 24
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleAuditService.java

@@ -177,16 +177,6 @@ public class ArticleAuditService {
                 deleteFailAlarm(publishContentId, "无推送记录", 0);
                 continue;
             }
-            if (!publishGzhPushDTO.getPushType().equals(PushTypeEnum.AUTO_GROUP_PUBLISH.getVal())) {
-                PushTypeEnum pushTypeEnum = PushTypeEnum.from(publishGzhPushDTO.getPushType());
-                deleteFailAlarm(publishContentId, "推送类型为" + pushTypeEnum.getDescription(), 0);
-                continue;
-            }
-            String groupPushMsgId = pushIdMap.get(pushId);
-            if (!StringUtils.hasText(groupPushMsgId)) {
-                deleteFailAlarm(publishContentId, "无推送MsgId", 0);
-                continue;
-            }
             String publishAccountId = pushAccountMap.get(pushId);
             String ghId = publishAccountMap.get(publishAccountId);
             List<PublishGzhPushContentRelDTO> relList = groupPushRelMap.get(pushId).stream()
@@ -198,6 +188,16 @@ public class ArticleAuditService {
                     break;
                 }
             }
+            if (!publishGzhPushDTO.getPushType().equals(PushTypeEnum.AUTO_GROUP_PUBLISH.getVal())) {
+                PushTypeEnum pushTypeEnum = PushTypeEnum.from(publishGzhPushDTO.getPushType());
+                deleteFailAlarm(publishContentId, "推送类型为" + pushTypeEnum.getDescription(), index);
+                continue;
+            }
+            String groupPushMsgId = pushIdMap.get(pushId);
+            if (!StringUtils.hasText(groupPushMsgId)) {
+                deleteFailAlarm(publishContentId, "无推送MsgId", index);
+                continue;
+            }
             LongArticleAuditDelete delete = new LongArticleAuditDelete();
             delete.setGhId(ghId);
             delete.setMsgId(groupPushMsgId);
@@ -218,23 +218,27 @@ public class ArticleAuditService {
     public ReturnT<String> articleVideoDelete(String param) {
         List<LongArticleAuditDelete> dealList = longArticleAuditDeleteRepository.getByStatus(ArticleDeleteStatusEnum.WAITING.getCode());
         for (LongArticleAuditDelete delete : dealList) {
-            if (Objects.equals(delete.getPushType(), PushTypeEnum.AUTO_GROUP_PUBLISH.getVal())) {
-                // 获取token
-                String token = wxAccessTokenRemoteService.getAccessToken(delete.getGhId());
-                // 删除文章
-                RequestResult<String> result = wxArticleDeleteService.deleteArticle(token, delete.getMsgId(), delete.getIndex());
-                if (result.isSuccess()) {
-                    delete.setStatus(ArticleDeleteStatusEnum.SUCCESS.getCode());
+            try {
+                if (Objects.equals(delete.getPushType(), PushTypeEnum.AUTO_GROUP_PUBLISH.getVal())) {
+                    // 获取token
+                    String token = wxAccessTokenRemoteService.getAccessToken(delete.getGhId());
+                    // 删除文章
+                    RequestResult<String> result = wxArticleDeleteService.deleteArticle(token, delete.getMsgId(), delete.getIndex());
+                    if (result.isSuccess()) {
+                        delete.setStatus(ArticleDeleteStatusEnum.SUCCESS.getCode());
+                    } else {
+                        delete.setStatus(ArticleDeleteStatusEnum.FAIL.getCode());
+                        delete.setFailReason(result.getFailReason());
+                    }
                 } else {
-                    delete.setStatus(ArticleDeleteStatusEnum.FAIL.getCode());
-                    delete.setFailReason(result.getFailReason());
+                    deleteFailAlarm(delete.getPublishContentId(), "非自动群发", delete.getIndex());
+                    delete.setStatus(ArticleDeleteStatusEnum.SUCCESS.getCode());
                 }
-            } else {
-                deleteFailAlarm(delete.getPublishContentId(), "非自动群发", delete.getIndex());
-                delete.setStatus(ArticleDeleteStatusEnum.SUCCESS.getCode());
+                delete.setFinishTimestamp(System.currentTimeMillis());
+                longArticleAuditDeleteRepository.save(delete);
+            } catch (Exception e) {
+                log.error("articleVideoDelete ghId:{} error", delete.getGhId(), e);
             }
-            delete.setFinishTimestamp(System.currentTimeMillis());
-            longArticleAuditDeleteRepository.save(delete);
         }
         return ReturnT.SUCCESS;
     }

+ 9 - 9
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/recall/RecallService.java

@@ -403,15 +403,15 @@ public class RecallService implements ApplicationContextAware {
                         article.setInnerAccount(true);
                         avgViewCount = Optional.ofNullable(indexMap.get(hisArticle.getItemIndex().toString()).getReadAvg())
                                 .orElse(0.0).intValue();
-                    } else {
-                        if (ArticleTypeEnum.QUNFA.getVal().equals(type)) {
-                            FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
-                                    "历史表现阅读均值获取失败\n"
-                                            + "ghId: " + hisArticle.getGhId() + "\n"
-                                            + "账号名称: " + hisArticle.getAccountName() + "\n"
-                                            + "日期: " + hisPublishDate + "\n"
-                                            + "位置: " + hisArticle.getItemIndex());
-                        }
+//                    } else {
+//                        if (ArticleTypeEnum.QUNFA.getVal().equals(type)) {
+//                            FeishuMessageSender.sendWebHookMessage(FeishuRobotIdEnum.RECOMMEND.getRobotId(),
+//                                    "历史表现阅读均值获取失败\n"
+//                                            + "ghId: " + hisArticle.getGhId() + "\n"
+//                                            + "账号名称: " + hisArticle.getAccountName() + "\n"
+//                                            + "日期: " + hisPublishDate + "\n"
+//                                            + "位置: " + hisArticle.getItemIndex());
+//                        }
                     }
                 }
                 article.setAvgViewCount(avgViewCount);

+ 2 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/score/strategy/CrawlerDaysDecreaseStrategy.java

@@ -47,9 +47,9 @@ public class CrawlerDaysDecreaseStrategy implements ScoreStrategy {
     }
 
     private Double getContentScore(Content content, long now) {
-        double maxReleaseScore = -0.15;
+        double maxReleaseScore = -0.3;
         double minScoreDays = 7;
-        double maxScoreDays = 60.0;
+        double maxScoreDays = 120.0;
         long timestamp = Optional.ofNullable(content.getRootPublishTimestamp()).orElse(content.getCrawlerTimestamp());
         int days = (int) ((now - timestamp) / 86400000);
         if (days < minScoreDays) {

+ 1 - 1
long-article-recommend-service/src/main/resources/mapper/crawler/CrawlerBaseMapper.xml

@@ -88,7 +88,7 @@
 
     <select id="getByTitleMd5InAndTypeEqualsAndStatusEquals"
             resultType="com.tzld.longarticle.recommend.server.model.entity.crawler.Article">
-        select wx_sn, ghId, appMsgId, title, ItemIndex, publish_timestamp, show_view_count
+        select wx_sn, ghId, accountName, appMsgId, title, ItemIndex, publish_timestamp, show_view_count
         from official_articles_v2
         where title_md5 in
         <foreach collection="titleMd5s" item="item" separator="," open="(" close=")">