Przeglądaj źródła

V1.1.4 自动投放 创意信息为空 不创建组

yumeng 4 lat temu
rodzic
commit
d92a988f86

+ 16 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/KuaiShouCreateServiceImpl.java

@@ -60,7 +60,22 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
             }
             String group_uuid = groupCreateJson.getString("group_uuid");
             try {
+
+                Integer unit_type = groupCreateJson.getInteger("unit_type");
+                if (Check.isNull(unit_type)) {
+                    throw new Exception("请选择创意制作方式");
+                }
+                if (unit_type == 4) { //  自定义创意
+                    if (Check.isNull(groupCreateJson.getJSONArray("creative_list"))) {
+                        throw new Exception("组下面创意信息不能为空");
+                    }
+                } else if (unit_type == 7) { // 程序化创意
+                    if (Check.isNull(groupCreateJson.getJSONObject("programCreative"))) {
+                        throw new Exception("组下程序化创意信息不能为空");
+                    }
+                }
                 JSONObject createJson = new JSONObject();
+                createJson.put("unit_type", groupCreateJson.getInteger("unit_type")); //创意制作方式
                 createJson.put("advertiser_id", oauthToken.getAccountId());
                 createJson.put("campaign_id", campaign_id);
                 createJson.put("unit_name", groupCreateJson.getString("unit_name")); // 组名称
@@ -98,11 +113,7 @@ public class KuaiShouCreateServiceImpl implements IKuaiShouCreateService {
                     sceneId = groupCreateJson.getJSONArray("scene_id").getInteger(0);
                     createJson.put("scene_id", groupCreateJson.getJSONArray("scene_id")); //资源位置
                 }
-                Integer unit_type = groupCreateJson.getInteger("unit_type");
-                if (Check.isNull(unit_type)) {
-                    throw new Exception("请选择创意制作方式");
-                }
-                createJson.put("unit_type", groupCreateJson.getInteger("unit_type")); //创意制作方式
+
                 if (!Check.isNull(groupCreateJson.getString("begin_time"))) {
                     createJson.put("begin_time", groupCreateJson.getString("begin_time")); //投放开始时间
                 }