ソースを参照

项目自动化调试,actionBar 多选处理

zhaoxian 4 年 前
コミット
2bfabbf3d1

+ 11 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouProjectCreateCreativeServiceImpl.java

@@ -547,7 +547,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
         }
 
         if (!Check.isNull(strategy.getActionBarText())) {
-            programJson.put("action_bar", strategy.getActionBarText());
+            programJson.put("action_bar", getActionBar(strategy.getActionBarText()));
         }
         if (!Check.isNull(strategy.getClickTrackUrl())) {
             programJson.put("click_url", strategy.getClickTrackUrl());
@@ -1101,6 +1101,15 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
         return num;
     }
 
+    public static String getActionBar(String actionBarText) {
+        if (Check.isNull(actionBarText)) {
+            return null;
+        }
+        String[] split = actionBarText.split(",");
+        int i = getrandom(0, split.length - 1);
+        return split[i];
+    }
+
     private Long getBidByString(String cpaBid) {
         if (Check.isNull(cpaBid)) {
             return null;
@@ -1162,7 +1171,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
         creativeParams.put("unit_id", unitId);
         creativeParams.put("photo_id", videoItem.getPhotoId());
         creativeParams.put("creative_material_type", videoItem.getMaterialType());
-        creativeParams.put("action_bar_text", strategy.getActionBarText());
+        creativeParams.put("action_bar_text", getActionBar(strategy.getActionBarText()));
         JSONArray descArr = JSONArray.parseArray(strategy.getDescription());
         int index = new Random().nextInt(descArr.size());
         String description = descArr.getString(index);