Skip to content

Commit 42e5ae2

Browse files
committed
feat: 关闭分流的公众号就不再同步文章
1 parent d843bd6 commit 42e5ae2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/com/anyshare/task/WeixinScheduleTask.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package com.anyshare.task;
22

3+
import com.anyshare.jpa.mysql.po.AppOpenApiConfigPO;
34
import com.anyshare.service.ConfigService;
45
import com.anyshare.service.WeixinService;
6+
import com.anyshare.service.common.AppOpenApiConfigService;
57
import com.anyshare.web.config.WxMpConfig;
68
import lombok.extern.slf4j.Slf4j;
79
import me.chanjar.weixin.mp.api.WxMpMaterialService;
@@ -31,6 +33,8 @@ public class WeixinScheduleTask {
3133
private WeixinService weixinService;
3234
@Resource
3335
private ConfigService configService;
36+
@Resource
37+
private AppOpenApiConfigService appOpenApiConfigService;
3438

3539
private static final Map<String, Integer> WRONG_COUNT_MAP = new HashMap<>();
3640

@@ -48,6 +52,11 @@ public void materialNewsSynchronismTask() {
4852
StopWatch sw = new StopWatch("materialNewsSynchronismTask");
4953
for (String appTag : WxMpConfig.WX_MP_SERVICE_MAP.keySet()) {
5054
sw.start(String.format("%s materialNewsSynchronismTask", appTag));
55+
AppOpenApiConfigPO appOpenApiConfig = appOpenApiConfigService.findByAppTag(appTag);
56+
if (!appOpenApiConfig.drainageEnable()) {
57+
log.info("{} 已关闭分流跳过", appTag);
58+
continue;
59+
}
5160
boolean noError = true;
5261
try {
5362
WxMpService wxMpService = WxMpConfig.getWxMpServiceByAppTag(appTag);
@@ -71,6 +80,6 @@ public void materialNewsSynchronismTask() {
7180
}
7281
sw.stop();
7382
}
74-
log.info(" 完成, 耗时:{}s", sw.getTotalTimeSeconds());
83+
log.info("完成, 耗时:{}s", sw.getTotalTimeSeconds());
7584
}
7685
}

0 commit comments

Comments
 (0)