zhaoxian 3 лет назад
Родитель
Сommit
4c6746a0bb

+ 12 - 12
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/channel/service/impl/KuaishouChannelServiceImpl.java

@@ -248,7 +248,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                                     Long accountId = accountList.get(length);
                                     if (!Check.isNull(accountId)) {
                                         //获取token
-                                        CtopOauthToken token = tokenService.getTokenByAccountId(strategy.getAccountId());
+                                        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
                                         //获取应用图片token
                                         JSONObject tokenJson = appInfoService.uploadAppIconImage(strategy.getAppIconUrl(), token.getAccountId(), token.getAccessToken());
                                         if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
@@ -272,7 +272,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                                         Long accountId = accountList.get(length);
                                         if (!Check.isNull(accountId)) {
                                             //获取token
-                                            CtopOauthToken token = tokenService.getTokenByAccountId(strategy.getAccountId());
+                                            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
                                             //获取应用图片token
                                             JSONObject tokenJson = appInfoService.uploadAppIconImage(strategy.getAppIconUrl(), token.getAccountId(), token.getAccessToken());
                                             if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
@@ -307,7 +307,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                                                 Long accountId = accountSubList.get(k);
                                                 if (!Check.isNull(accountId)) {
                                                     //获取token
-                                                    CtopOauthToken token = tokenService.getTokenByAccountId(strategy.getAccountId());
+                                                    CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
                                                     //获取应用图片token
                                                     JSONObject tokenJson = appInfoService.uploadAppIconImage(strategy.getAppIconUrl(), token.getAccountId(), token.getAccessToken());
                                                     if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
@@ -374,8 +374,8 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                     log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
                 }
                 //使用范围是账户时,查询旧app来做匹配
-                kuaishouInterfaceService.getAppList(strategy.getAccountId(), token.getAccessToken());
-                List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(strategy.getAccountId());
+                kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
+                List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(token.getAccountId());
                 strategy.setImageToken(tokenJson.getString("imageToken"));
                 if (url.contains(CHANNEL_STR)) {
                     ilist.forEach(i -> executorService.submit(() -> {
@@ -504,7 +504,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
         channelAppInfo.setImageToken(String.valueOf(app.getImageToken()));
         JSONObject requestJson = new JSONObject();
         requestJson.put("app_id", app.getAppId());
-        requestJson.put("advertiser_id", strategy.getAccountId());
+        requestJson.put("advertiser_id", token.getAccountId());
         requestJson.put("app_version", strategy.getAppVersion());
         requestJson.put("app_privacy_url", strategy.getAppPrivacyUrl());
         String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.APP_UPDATE;
@@ -544,7 +544,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
         if (!Check.isNull(token)) {
             String accessToken = token.getAccessToken();
             JSONObject requestJson = new JSONObject();
-            requestJson.put("advertiser_id", strategy.getAccountId());
+            requestJson.put("advertiser_id", token.getAccountId());
             requestJson.put("app_version", strategy.getAppVersion());
             requestJson.put("app_name", strategy.getAppName());
             requestJson.put("image_token", strategy.getImageToken());
@@ -882,7 +882,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                             /**-----------------项目维度:循环次数 大于 项目下账户总数-----------------*/
                             for (Long accountId : accountList) {
                                 //获取token
-                                CtopOauthToken token = tokenService.getTokenByAccountId(strategy.getAccountId());
+                                CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
                                 //获取应用图片token
                                 JSONObject tokenJson = appInfoService.uploadAppIconImage(strategy.getAppIconUrl(), token.getAccountId(), token.getAccessToken());
                                 if (!Check.isNull(tokenJson) && tokenJson.getInteger("code") != 0) {
@@ -897,6 +897,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                             List<List<Long>> accountSubLists = Lists.partition(accountList, cycleTimes);
                             List<Long> list = accountSubLists.get(0);
                             for (int i = 0; i < list.size(); i++) {
+                                strategy.setAccountId(list.get(i));
                                 //获取token
                                 CtopOauthToken token = tokenService.getTokenByAccountId(strategy.getAccountId());
                                 //获取应用图片token
@@ -905,7 +906,6 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                                     log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
                                 }
                                 strategy.setImageToken(tokenJson.getString("imageToken"));
-                                strategy.setAccountId(list.get(i));
                                 createApp(strategy, token, null);
                                 createChannel(strategy, 0, i + 1);
                             }
@@ -921,7 +921,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                                 log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
                             }
                             //使用范围是账户时,查询旧app来做匹配
-                            kuaishouInterfaceService.getAppList(strategy.getAccountId(), token.getAccessToken());
+                            kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
                             List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(accountId);
                             strategy.setImageToken(tokenJson.getString("imageToken"));
                             strategy.setAccountId(accountId);
@@ -943,8 +943,8 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                         log.error("通过账户ID(" + token.getAccountId() + ")获取图片Token失败,返回信息:" + tokenJson.getString("message"));
                     }
                     //使用范围是账户时,查询旧app来做匹配
-                    kuaishouInterfaceService.getAppList(strategy.getAccountId(), token.getAccessToken());
-                    List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(strategy.getAccountId());
+                    kuaishouInterfaceService.getAppList(token.getAccountId(), token.getAccessToken());
+                    List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(token.getAccountId());
                     strategy.setImageToken(tokenJson.getString("imageToken"));
                     try {
                         createApp(strategy, token, oldAppList);