Просмотр исходного кода

小程序投流 创建发布计划增加 per-video 多链接生成入口:XcxPlanSaveVideoParam 加 count 字段(空/null/<=0 视为 1,>200 抛 PARAM_ERROR);xcxPlanSave 视频循环内层嵌套 count 次,每次独立调 getPageNoCache 生成新 pageUrl/rootSourceId,与 xcxPlanMultiLink 同口径。沿用 save 原有的「不回滚」语义。

刘立冬 8 часов назад
Родитель
Сommit
c3f14e5469

+ 3 - 0
api-module/src/main/java/com/tzld/piaoquan/api/model/param/contentplatform/XcxPlanSaveVideoParam.java

@@ -21,4 +21,7 @@ public class XcxPlanSaveVideoParam {
     @ApiModelProperty(value = "匹配实验id")
     private String experimentId;
 
+    @ApiModelProperty(value = "该 video 生成份数 1-200,空/null/<=0 视为 1")
+    private Integer count;
+
 }

+ 27 - 20
api-module/src/main/java/com/tzld/piaoquan/api/service/contentplatform/impl/ContentPlatformPlanServiceImpl.java

@@ -2260,26 +2260,33 @@ public class ContentPlatformPlanServiceImpl implements ContentPlatformPlanServic
         Long now = System.currentTimeMillis();
         List<ContentPlatformXcxPlan> list = new ArrayList<>();
         for (XcxPlanSaveVideoParam videoParam : param.getVideoList()) {
-            ContentPlatformXcxPlan xcxPlan = new ContentPlatformXcxPlan();
-            xcxPlan.setAudiencePackage(param.getAudiencePackage());
-            xcxPlan.setRemark(param.getRemark());
-
-            Staff staff = new Staff();
-            staff.setCarrierId("wxf7261ed54f2e450e");
-            staff.setRemark(param.getRemark());
-            String pageUrl = messageAttachmentService.getPageNoCache("pages/category", "touliu", "tencent", staff,
-                    videoParam.getVideoId(), "小程序", null, null, videoParam.getExperimentId());
-            String rootSourceId = MessageUtil.getRootSourceId(pageUrl);
-            xcxPlan.setPageUrl(pageUrl);
-            xcxPlan.setRootSourceId(rootSourceId);
-            xcxPlan.setStatus(PlanStatusEnum.NORMAL.getVal());
-            xcxPlan.setCreateAccountId(loginUser.getId());
-            xcxPlan.setCreateTimestamp(now);
-            xcxPlan.setUpdateTimestamp(now);
-            planMapperExt.insertXcxPlanReturnId(xcxPlan);
-            list.add(xcxPlan);
-            // 保存视频内容
-            saveXcxPlanVideo(videoParam, xcxPlan.getId(), loginUser.getId());
+            int count = (videoParam.getCount() == null || videoParam.getCount() <= 0)
+                    ? 1 : videoParam.getCount();
+            if (count > 200) {
+                throw new CommonException(ExceptionEnum.PARAM_ERROR);
+            }
+            for (int i = 0; i < count; i++) {
+                ContentPlatformXcxPlan xcxPlan = new ContentPlatformXcxPlan();
+                xcxPlan.setAudiencePackage(param.getAudiencePackage());
+                xcxPlan.setRemark(param.getRemark());
+
+                Staff staff = new Staff();
+                staff.setCarrierId("wxf7261ed54f2e450e");
+                staff.setRemark(param.getRemark());
+                String pageUrl = messageAttachmentService.getPageNoCache("pages/category", "touliu", "tencent", staff,
+                        videoParam.getVideoId(), "小程序", null, null, videoParam.getExperimentId());
+                String rootSourceId = MessageUtil.getRootSourceId(pageUrl);
+                xcxPlan.setPageUrl(pageUrl);
+                xcxPlan.setRootSourceId(rootSourceId);
+                xcxPlan.setStatus(PlanStatusEnum.NORMAL.getVal());
+                xcxPlan.setCreateAccountId(loginUser.getId());
+                xcxPlan.setCreateTimestamp(now);
+                xcxPlan.setUpdateTimestamp(now);
+                planMapperExt.insertXcxPlanReturnId(xcxPlan);
+                list.add(xcxPlan);
+                // 保存视频内容
+                saveXcxPlanVideo(videoParam, xcxPlan.getId(), loginUser.getId());
+            }
         }
         return buildXcxPlanItemVOList(list);
     }