ソースを参照

多应用修改素材名称取值逻辑

yumeng 4 年 前
コミット
b10f0d769b

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

@@ -804,7 +804,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
             if (Check.isNull(strategy.getMaterialKeyword())) {
                 customVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), "all", null);
                 //2:查询特定素材
-                generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), appInfo.getAppVersion(), null);
+                String appVersion = appInfo.getAppVersion();
+                if (!Check.isNull(appVersion)) {
+                    String[] split = appVersion.split("-");
+                    if (split.length > 1) {
+                        String version = split[1];
+                        generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), version, null);
+                    }
+                }
+
             } else { //  tt语音特殊素材查询
                 generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), strategy.getMaterialKeyword(), null);
 
@@ -825,6 +833,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
     }
 
+
     private List<KuaiShouVideoGet> getRelateZeroVideoList(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo, Integer relativeCnt, Long videoCnt) {
         Integer channelType = null;
         if (null != strategy.getChannelType() && strategy.getChannelType() != 2) {
@@ -833,7 +842,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         String appVersion = null;
         if (Check.isNull(strategy.getMaterialKeyword())) {
             if (null != appInfo && null != appInfo.getAppVersion()) {
-                appVersion = appInfo.getAppVersion();
+                String[] split = appInfo.getAppVersion().split("-");
+                if (split.length > 1) {
+                    appVersion = split[1];
+                } else {
+                    return null;
+                }
             }
         } else { //  tt语音特殊素材查询
             appVersion = strategy.getMaterialKeyword();
@@ -849,8 +863,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         }
         String appVersion = null;
         if (Check.isNull(strategy.getMaterialKeyword())) {
-            if (null != appInfo && null != appInfo.getAppVersion()) {
-                appVersion = appInfo.getAppVersion();
+            if (!Check.isNull(appInfo.getAppVersion())) {
+                String[] split = appInfo.getAppVersion().split("-");
+                if (split.length > 1) {
+                    appVersion = split[1];
+                } else {
+                    return null;
+                }
             }
         } else { //  tt语音 特殊素材查询
             appVersion = strategy.getMaterialKeyword();
@@ -1517,6 +1536,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
         if (wildcard.contains("{{应用名称}}") || wildcard.contains("{{应用标记}}")) {
             KuaiShouAppList getAppInfo = appListService.getAppInfo(strategy.getAccountId(), appId);
             if (!Check.isNull(getAppInfo)) {
+                if (!wildcard.contains("{{自定义}}")) {
+                    if (wildcard.contains("{{应用标记}}")) {
+                        wildcard = wildcard.replace("{{应用标记}}", "{{应用标记}}-{{自定义}}");
+                    }
+                }
                 wildcard = wildcard.replace("{{应用名称}}", getAppInfo.getAppName());
                 wildcard = wildcard.replace("{{应用标记}}", getAppInfo.getAppVersion());
             } else {