|
@@ -1,18 +1,22 @@
|
|
|
package com.tzld.longarticle.recommend.server;
|
|
|
|
|
|
-import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
+import com.tzld.longarticle.recommend.server.mapper.aigc.PublishContentMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishAccount;
|
|
|
import com.tzld.longarticle.recommend.server.remote.WxAccessTokenRemoteService;
|
|
|
import com.tzld.longarticle.recommend.server.remote.WxArticleDeleteService;
|
|
|
import com.tzld.longarticle.recommend.server.repository.aigc.PublishAccountRepository;
|
|
|
+import com.tzld.longarticle.recommend.server.service.recommend.ArticleAuditService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.List;
|
|
|
|
|
|
@SpringBootTest(classes = Application.class)
|
|
|
+@Slf4j
|
|
|
public class WxApiTest {
|
|
|
|
|
|
@Resource
|
|
@@ -23,13 +27,21 @@ public class WxApiTest {
|
|
|
private WxAccessTokenRemoteService wxAccessTokenRemoteService;
|
|
|
@Resource
|
|
|
private WxArticleDeleteService wxArticleDeleteService;
|
|
|
+ @Resource
|
|
|
+ private PublishContentMapper publishContentMapper;
|
|
|
+ @Resource
|
|
|
+ private ArticleAuditService articleAuditService;
|
|
|
|
|
|
@Test
|
|
|
public void clearQuotaTest() {
|
|
|
List<String> ghIds = longArticleBaseMapper.getDisAuditDeleteGhid();
|
|
|
List<PublishAccount> publishAccountList = publishAccountRepository.getAllByGhIdIn(ghIds);
|
|
|
for (PublishAccount publishAccount : publishAccountList) {
|
|
|
- String token = wxAccessTokenRemoteService.getAccessToken(publishAccount.getGhId());
|
|
|
+ String token = wxAccessTokenRemoteService.loadAccessToken(publishAccount.getGhId());
|
|
|
+ if(StringUtils.isEmpty(token)) {
|
|
|
+ log.error("token is null ghId:{}", publishAccount.getGhId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
wxArticleDeleteService.clearQuota(token, publishAccount.getAppId());
|
|
|
}
|
|
|
}
|