浏览代码

渠道号。。。修改bug

zhaoxian 3 年之前
父节点
当前提交
05688823ae

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

@@ -201,6 +201,8 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
         }
         try {
             boolean save = channelCreateStrategyService.save(strategy);
+            //下载链接
+            String url = strategy.getUrl();
             /**==========================范围是 项目==========================*/
             if (usageRange == 2) {
                 String usageLevel = strategy.getUsageLevel();
@@ -305,11 +307,23 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                         List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(accountId);
                         strategy.setImageToken(tokenJson.getString("imageToken"));
                         strategy.setAccountId(accountId);
-                        for (int i = numberMin; i <= numberMax; i++) {
+                        if (url.contains(CHANNEL_STR)) {
+                            for (int i = numberMin; i <= numberMax; i++) {
+                                try {
+                                    KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, i);
+                                    createApp(replaceData, token, oldAppList);
+                                    createChannel(replaceData, i, 1);
+                                } catch (Exception e) {
+                                    e.printStackTrace();
+                                }
+                            }
+                        } else {
                             try {
-                                KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, i);
-                                createApp(replaceData, token, oldAppList);
-                                createChannel(replaceData, i, 1);
+                                createApp(strategy, token, oldAppList);
+                                for (int i = numberMin; i <= numberMax; i++) {
+                                    KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, i);
+                                    createChannel(replaceData, i, 1);
+                                }
                             } catch (Exception e) {
                                 e.printStackTrace();
                             }
@@ -325,15 +339,27 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
                 //使用范围是账户时,查询旧app来做匹配
                 List<KuaiShouAppList> oldAppList = kuaiShouAppListService.getAppListByAccountId(strategy.getAccountId());
                 strategy.setImageToken(tokenJson.getString("imageToken"));
-                ilist.forEach(i -> executorService.submit(() -> {
-                    try {
-                        KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, i);
-                        createApp(replaceData, token, oldAppList);
-                        createChannel(replaceData, i, 1);
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }));
+                if (url.contains(CHANNEL_STR)) {
+                    ilist.forEach(i -> executorService.submit(() -> {
+                        try {
+                            KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, i);
+                            createApp(replaceData, token, oldAppList);
+                            createChannel(replaceData, i, 1);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }));
+                } else {
+                    createApp(strategy, token, oldAppList);
+                    ilist.forEach(i -> executorService.submit(() -> {
+                        try {
+                            KuaishouChannelCreateStrategy replaceData = replaceWildcard(strategy, i);
+                            createChannel(replaceData, i, 1);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }));
+                }
             }
         } catch (Exception e) {
             e.printStackTrace();