Browse Source

直播投流

zhaoxian 2 năm trước cách đây
mục cha
commit
ff6fb4233d

+ 8 - 4
ruixuan-launch/src/main/java/com/ruixuan/launch/service/impl/KuaishouLaunchCampaignAutoStrategyServiceImpl.java

@@ -108,10 +108,12 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
             //2、创建广告组
             try {
                 Long unitId = createGroup(strategyJson, token);
-            } catch (InterruptedException e) {
-                log.error("---创建广告组异常---");
+            } catch (Exception e) {
                 e.printStackTrace();
+                return ResultResponse.error("广告组创建异常" + e.getMessage());
             }
+        } else {
+            return ResultResponse.error("广告计划创建失败");
         }
         return ResultResponse.success();
     }
@@ -130,9 +132,12 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
     }
 
     /*创建广告组*/
-    private Long createGroup(JSONObject strategyJson, String token) throws InterruptedException {
+    private Long createGroup(JSONObject strategyJson, String token) throws Exception {
         JSONArray ocpxActionArr = strategyJson.getJSONArray("ocpxActionArr");
         JSONArray targetTemplate = strategyJson.getJSONArray("targetTemplate");
+        if (Check.isNull(ocpxActionArr) || Check.isNull(targetTemplate)) {
+            throw new Exception("请选择配置条件");
+        }
         for (int i = 0; i < ocpxActionArr.size(); i++) {
             JSONObject ocpx = ocpxActionArr.getJSONObject(i);
             Integer type = ocpx.getInteger("type");
@@ -175,7 +180,6 @@ public class KuaishouLaunchCampaignAutoStrategyServiceImpl implements IKuaishouL
                         strategyJson.put("unitId", unitId);
                         kuaishouLaunchCreativeService.insertKuaishouLaunchCreative(strategyJson, token);
                         Thread.sleep(500);
-
                     }
                 }
             }