Forráskód Böngészése

添加名称通配符问题

syh 4 éve
szülő
commit
e55bcf924e

+ 50 - 9
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/enums/KuaishouCreativeMatTypeEnum.java

@@ -9,14 +9,14 @@ public enum KuaishouCreativeMatTypeEnum {
      * type字段 第一位创意创建方式,第二位素材获取方式
      * 快手创意素材获取类型
      */
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_NEW("41","自定义上新"),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HIGH_quality("42","自定义高质量"),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_MISSING("43","自定义上新"),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HISTORY("44","自定义历史"),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_NEW("71","程序化上新"),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HIGH_quality("72","程序化高质量"),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_MISSING("73","程序化上新"),
-    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HISTORY("74","程序化历史"),;
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_NEW("41","自定义上新",-10L,-5L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HIGH_quality("42","自定义高质量",-14*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_MISSING("43","自定义上新",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_CUSTOM_HISTORY("44","自定义历史",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_NEW("71","程序化上新",-10L,-5L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HIGH_quality("72","程序化高质量",-14*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_MISSING("73","程序化上新",-60*60*24L,-1*60*24L),
+    KUAISHOU_CREATIVE_MAT_TYPE_ENUM_PROGRAM_HISTORY("74","程序化历史",-60*60*24L,-1*60*24L),;
 
     /**
      * 类型
@@ -26,10 +26,17 @@ public enum KuaishouCreativeMatTypeEnum {
      * 名称
      */
     private String name;
+    /**
+     * 素材查询的时间区间
+     */
+    private Long videoGetStartTime;
+    private Long videoGetEndTime;
 
-    KuaishouCreativeMatTypeEnum(String type, String name) {
+    KuaishouCreativeMatTypeEnum(String type, String name,Long videoGetStartTime,Long videoGetEndTime) {
         this.type = type;
         this.name = name;
+        this.videoGetStartTime = videoGetStartTime;
+        this.videoGetEndTime = videoGetEndTime;
     }
 
     public static String getNameByType(String type) {
@@ -41,6 +48,24 @@ public enum KuaishouCreativeMatTypeEnum {
         return "";
     }
 
+    public static Long getStartTimeByType(String type) {
+        for (KuaishouCreativeMatTypeEnum createTypeEnum : KuaishouCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getVideoGetStartTime();
+            }
+        }
+        return -10L;
+    }
+
+    public static Long getEndTimeByType(String type) {
+        for (KuaishouCreativeMatTypeEnum createTypeEnum : KuaishouCreativeMatTypeEnum.values()) {
+            if (createTypeEnum.getType().equals(type)) {
+                return createTypeEnum.getVideoGetEndTime();
+            }
+        }
+        return -5L;
+    }
+
 
     public String getType() {
         return this.type;
@@ -57,4 +82,20 @@ public enum KuaishouCreativeMatTypeEnum {
     public void setName(String value) {
         this.name = value;
     }
+
+    public Long getVideoGetStartTime() {
+        return videoGetStartTime;
+    }
+
+    public void setVideoGetStartTime(Long videoGetStartTime) {
+        this.videoGetStartTime = videoGetStartTime;
+    }
+
+    public Long getVideoGetEndTime() {
+        return videoGetEndTime;
+    }
+
+    public void setVideoGetEndTime(Long videoGetEndTime) {
+        this.videoGetEndTime = videoGetEndTime;
+    }
 }

+ 47 - 129
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -60,32 +60,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     @Autowired
     private IAiKuaiShouAppInfoService appInfoService;
 
-    String getReplaceStringByCreateType(AiKuaishouAdvertiserStrategy strategy, Integer createType) {
-        String replaceString ;
-        if(strategy.getUnitType() == 7){
-            if (createType == 2) {
-                replaceString = "程序化高质量";
-            } else if (createType == 3) {
-                replaceString = "程序化上新";
-            } else if(createType == 4){
-                replaceString = "程序化历史";
-            }else {
-                replaceString= "程序化上新";
-            }
-        }else{
-            if (createType == 2) {
-                replaceString = "自定义高质量";
-            } else if (createType == 3) {
-                replaceString = "自定义上新";
-            } else if(createType == 4){
-                replaceString = "自定义历史";
-            }else{
-                replaceString = "自定义上新";
-            }
-        }
-        return replaceString;
-    }
-
     /**
      * 创建自定义创意
      *
@@ -96,7 +70,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     @Override
     public Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt) {
         strategy.setUnitType(4);
-        String replaceString = getReplaceStringByCreateType(strategy, createType);
         Long accountId = strategy.getAccountId();
         CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
         if (null == token) {
@@ -105,36 +78,21 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         //1:获取视频信息
         kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(), DateUtils.date2Str());
-        Integer timeStart;
-        Integer timeEnd;
-        if(createType == 1){
-            timeStart = -10;
-            timeEnd = -5;
-        }else if(createType == 2){
-            //历史高质量
-            timeStart = -14*60*24;
-            timeEnd = -1*60*24;
-        }else if(createType == 3){
-            //历史遗漏
-            timeStart = -60*60*24;
-            timeEnd = -1*60*24;
-        }else{
-            //历史打捞
-            timeStart = -60*60*24;
-            timeEnd = -1*60*24;
-        }
+        Long timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString()+createType.toString());
+        Long timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString()+createType.toString());
         Long now = System.currentTimeMillis();
-        String startTime = DateUtils.formatDateTime(now+timeStart*60*1000L);
+        String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
         String endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
 
         //2:判定账户是否单一应用
         Integer singleAppid = strategy.getSingleAppid();
         if (null != singleAppid && singleAppid == 0) {
-            //非单一应用
+            //多应用
             String appidString = strategy.getAppIdArray();
             JSONArray appIdArray = JSON.parseArray(appidString);
             if (null != appIdArray && !appIdArray.isEmpty()) {
                 for (int i = 0; i < appIdArray.size(); i++) {
+                    String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString()+createType.toString());
                     AiKuaiShouAppInfo appInfo = appInfoService.getByParams(strategy.getAccountId(), appIdArray.getLong(i));
                     if (null == appInfo) {
                         log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
@@ -151,11 +109,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime,replaceString);
                         return videoCnt;
                     }
-                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN");
-
-                    //开始创建组+创意
-                    String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                    String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
+                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN",createType,appInfo);
                     int unitCnt = 0;
                     for (KuaiShouVideoGet videoItem : allVideos) {
                         KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
@@ -170,7 +124,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                             continue;
                         }
                         unitCnt++;
-                        String unitName = unitNamePrefix + "-" + unitCnt;
+                        //开始创建组+创意
+                        String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
+                        String unitName = getName(strategy.getGroupName(),strategy,createType,appInfo,timestamp,unitCnt);
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -191,19 +147,18 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             }
         } else {
             //单一应用
+            String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString()+createType.toString());
             List<KuaiShouVideoGet> newVideos = getVideosByParams(strategy, startTime, endTime, null, createType,videoCnt);
             if (null == newVideos || newVideos.isEmpty()) {
                 log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime,replaceString);
                 return videoCnt;
             }
-            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY");
+            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY",createType,null);
             if (null == newCampaignId) {
                 return videoCnt;
             }
 
             //3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
-            String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-            String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
             int unitCnt = 0;
             for (KuaiShouVideoGet videoItem : newVideos) {
                 KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
@@ -217,7 +172,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                     continue;
                 }
                 unitCnt++;
-                String unitName = unitNamePrefix + "-" + unitCnt;
+                String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
+                String unitName = getName(strategy.getGroupName(),strategy,createType,null,timestamp,unitCnt);
                 Long appId = JSON.parseArray(strategy.getAppIdArray()).getLong(0);
                 JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
                 Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
@@ -238,13 +194,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         return videoCnt;
     }
-    private String getUnitNamePrefix(AiKuaishouAdvertiserStrategy strategy,String replaceString,String timestamp){
-        String unitNamePrefix = strategy.getGroupName();
-        if(!unitNamePrefix.contains("自定义")){
-            unitNamePrefix += "-自定义-";
-        }
-        return unitNamePrefix.replace("自定义", replaceString) + timestamp;
-    }
 
     /**
      * 创建程序化创意
@@ -262,32 +211,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         //1:获取视频信息
         kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(), DateUtils.date2Str());
-        Integer timeStart;
-        Integer timeEnd;
-        if(createType == 1){
-            timeStart = -10;
-            timeEnd = -5;
-        }else if(createType == 2){
-            //历史高质量
-            timeStart = -14*60*24;
-            timeEnd = -1*60*24;
-        }else if(createType == 3){
-            //历史遗漏
-            timeStart = -60*60*24;
-            timeEnd = -1*60*24;
-        }else{
-            //历史打捞
-            timeStart = -60*60*24;
-            timeEnd = -1*60*24;
-        }
+        Long timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString()+createType.toString());
+        Long timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString()+createType.toString());
         Long now = System.currentTimeMillis();
-        String startTime = DateUtils.formatDateTime(now+timeStart*60*1000L);
+        String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
         String endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
 
         //2:判定账户是否单一应用
         Integer singleAppid = strategy.getSingleAppid();
         if (null != singleAppid && singleAppid == 0) {
-            //非单一应用
+            //多应用
             String appidString = strategy.getAppIdArray();
             JSONArray appIdArray = JSON.parseArray(appidString);
             if (null != appIdArray && !appIdArray.isEmpty()) {
@@ -302,7 +235,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         strategy.setClickTrackUrl(appInfo.getTrackUrl());
                         strategy.setImpressionUrl(appInfo.getTrackUrl());
                     }
-                    String replaceString = getReplaceStringByCreateType(strategy, createType);
+                    String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString()+createType.toString());
                     replaceString = appInfo.getAppVersion() + replaceString;
                     //1:查询可用素材
                     List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType,videoCnt);
@@ -315,15 +248,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                         log.info("该账户创意创建已超限=>accountId:{}", accountId);
                         return;
                     }
-                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN");
+                    Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN",createType,appInfo);
 
-                    //创意
+                    //创建组+创
                     List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos,5);
                     for (int j = 1; j < splitVideos.size() + 1; j++) {
                         //创建组
                         String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                        String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
-                        String unitName = unitNamePrefix + "-" + timestamp;
+                        String unitName = getName(strategy.getGroupName(),strategy,createType,appInfo,timestamp,null);
                         JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
                         Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
                         Integer unitCode = (Integer) unitCreateResult.get("code");
@@ -339,14 +271,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 }
             }
         } else {
-            String replaceString = getReplaceStringByCreateType(strategy, createType);
+            String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString()+createType.toString());
             //单一应用
             List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType,videoCnt);
             if (null == allVideos) {
                 return;
             }
 
-            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY");
+            Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY",createType,null);
             if (null == newCampaignId) {
                 return;
             }
@@ -356,8 +288,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             for (int j = 1; j < splitVideos.size() + 1; j++) {
                 //创建组
                 String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
-                String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
-                String unitName = unitNamePrefix + "-" + timestamp;
+                String unitName = getName(strategy.getGroupName(),strategy,createType,null,timestamp,null);
                 String appIdString = strategy.getAppIdArray();
                 Long appId = null;
                 if(!Check.isNull(appIdString)&&!Check.isNull(JSON.parseArray(appIdString))){
@@ -399,7 +330,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if(remindCnt>=1){
             //历史打捞素材
             log.info("组创建不足,剩余需要创建个数{},使用历史打捞素材创建",remindCnt);
-            remindCnt = this.autoCreateCreative(strategy,4,remindCnt);
+            this.autoCreateCreative(strategy,4,remindCnt);
         }
     }
 
@@ -549,14 +480,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
     }
 
-    private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType) {
-        JSONArray campaignList = null;
-        Date campaignDate = new Date();
-        String timestamp = "";
-        if (null != checkType && checkType.equals("ALL_CAMPAIGN")) {
+    private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType,Integer createType,AiKuaiShouAppInfo appInfo) {
+        JSONArray campaignList;
+        if (null != checkType && "ALL_CAMPAIGN".equals(checkType)) {
             campaignList = kuaishouInterfaceService.getCampaignList(token, null, null, 1);
         } else {
-            timestamp = DateUtils.formatDate(campaignDate, "yyyyMMddHHmmss");
             campaignList = kuaishouInterfaceService.getCampaignList(token, new Date(), new Date(), 1);
         }
 
@@ -571,14 +499,9 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         // 不存在“上新”计划,则创建一个计划
         JSONObject campaignParams = new JSONObject();
         campaignParams.put("advertiser_id", token.getAccountId());
-        String campaignName = strategy.getCampaignName();
-        if(!campaignName.contains("自定义")){
-            campaignName+= "-自定义-";
-        }
-        campaignName =campaignName.replace("自定义", replaceString) + timestamp;
+        String campaignName = getName(strategy.getCampaignName(),strategy,createType,appInfo,null,null);
         campaignParams.put("campaign_name", campaignName);
         campaignParams.put("type", strategy.getCampaignType());
-        //TODO 目前设定为不限
         if(null!=strategy.getCampaignDayBudget()&&strategy.getCampaignDayBudget()!=0){
             campaignParams.put("day_budget", strategy.getCampaignDayBudget());
         }
@@ -965,7 +888,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             target.put("paid_audience", JSON.parseArray(paidAudienceString));
         }
         if (Check.isNull(strategy.getBehaviorInterest())) {
-            // TODO 只是单独结构体 后续需要优化
             target.put("behavior_interest", JSON.parseObject(strategy.getBehaviorInterest()));
         }
         return target;
@@ -975,17 +897,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     private void createCreativeByImage(List<MaterialCutFrame> cutFrameList, CtopOauthToken token, JSONObject creativeParams,
                                        Long campaignId, Long unitId, KuaiShouVideoGet videoItem,
                                        int imageNumber) {
-        int creativeCnt = 1;
-
         if ((null != cutFrameList && !cutFrameList.isEmpty())) {
             for (int i = 0; i < cutFrameList.size(); i++) {
                 String imageCode = cutFrameList.get(i).getSignature();
                 String imageUrl = cutFrameList.get(i).getUrl();
                 String imageToken = getImageToken(imageUrl, imageCode, token.getAccountId(), token.getAccessToken());
                 creativeParams.put("image_token", imageToken);
-                createCreative(token, creativeParams, campaignId, unitId, creativeCnt, videoItem);
-                creativeCnt++;
-                if (creativeCnt > imageNumber) {
+                createCreative(token, creativeParams, campaignId, unitId, i+1, videoItem);
+                imageNumber --;
+                if (imageNumber<=0) {
                     break;
                 }
             }
@@ -1077,40 +997,38 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
     /**
-     * @param wildcard  计划名称
+     * @param wildcard  计划名称/组名称
      * @param strategy  账户id
      * @return
      */
-    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy,Integer num,Integer createType,AiKuaiShouAppInfo appInfo) {
-//        if(wildcard.contains("{{定向包}}")){
-//            String targetName = "";
-//        }
-        if(wildcard.contains("{{日期}}")){
-            String date = DateUtils.getNowDate("yyyyMMddHHmmss");
-            wildcard.replace("{{日期}}","-"+date+"-");
-        }
-        if(wildcard.contains("{{下标号}}")){
-            String numString = num.toString();
-            wildcard.replace("{{下标号}}","-"+numString+"-");
-        }
+    private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy,Integer createType,AiKuaiShouAppInfo appInfo,String timestamp,Integer cnt) {
         if(wildcard.contains("{{应用包名}}")){
             String appName = "";
             if(null!=appInfo){
                 appName = appInfo.getAppName();
             }
-            wildcard.replace("{{应用包名}}","-"+appName+"-");
+            wildcard = wildcard.replace("{{应用包名}}","-"+appName+"-");
         }
         if(wildcard.contains("{{创意制作方式}}")){
             String creatype = KuaishouCreativeCreateTypeEnum.getNameByType(strategy.getOpenProgramCreate());
-            wildcard.replace("{{创意制作方式}}","-"+creatype+"-");
+            wildcard = wildcard.replace("{{创意制作方式}}","-"+creatype+"-");
         }
         if(wildcard.contains("{{广告位置}}")){
             String adsence = getAdSenceByParams(strategy.getSceneId());
-            wildcard.replace("{{广告位置}}","-"+adsence+"-");
+            wildcard = wildcard.replace("{{广告位置}}","-"+adsence+"-");
         }
         if(wildcard.contains("{{自定义}}")){
             String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString()+createType.toString());
-            wildcard.replace("{{自定义}}","-"+targetName+"-");
+            if(null!=appInfo){
+                targetName = appInfo.getAppVersion()+"-"+targetName;
+            }
+            wildcard = wildcard.replace("{{自定义}}","-"+targetName+"-");
+        }
+        if(null!=timestamp&&!"".equals(timestamp.trim())){
+            wildcard = wildcard+"-"+timestamp;
+        }
+        if(null!=cnt){
+            wildcard = wildcard+"-"+cnt.toString();
         }
         wildcard = wildcard.replace("--","-");
         if(wildcard.startsWith("-")){