Explorar o código

自动投放图片创建

yangzian %!s(int64=4) %!d(string=hai) anos
pai
achega
ca47bf6e5c

+ 12 - 12
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/mapper/xml/ByteDanceVideoInfoMapper.xml

@@ -157,20 +157,20 @@
         'image' as materialType
         from ctop_bytedance_image_info image
         where account_id = #{accountId}
-        <if test="imageMode = '1'">
+        <if test="imageMode == '1'.toString()">
             and image.type = '1'
         </if>
-        <if test="imageMode = '2'">
+        <if test="imageMode == '2'.toString()">
             and (image.type = '2' or image.type = '4')
         </if>
-        <if test="imageMode = '3'">
+        <if test="imageMode == '3'.toString()">
             and (image.type = '3' or image.type = '4')
         </if>
-        and image.create_time &gt;= #{startTime}
-        and image.create_time &lt;= #{endTime}
+        and image.image_create_time &gt;= #{startTime}
+        and image.image_create_time &lt;= #{endTime}
         having creativeCnt &lt;= #{creativeCnt}
         and creativeNum = 0
-        order by create_time desc
+        order by image.image_create_time desc
             limit #{videoCnt}
     </select>
 
@@ -197,13 +197,13 @@
         group by report.material_id
         order by sum(report.cost) desc ) a
         left join (select distinct a.* from ctop_bytedance_image_info a where 1 = 1  and a.account_id = #{accountId}
-        <if test="imageMode = '1'">
+        <if test="imageMode == '1'.toString()">
             and a.type = '1'
         </if>
-        <if test="imageMode = '2'">
+        <if test="imageMode == '2'.toString()">
             and (a.type = '2' or a.type = '4')
         </if>
-        <if test="imageMode = '3'">
+        <if test="imageMode == '3'.toString()">
             and (a.type = '3' or a.type = '4')
         </if>)as image
         on a.material_id = image.material_id
@@ -239,13 +239,13 @@
         group by report.material_id
         order by sum(report.cost) desc) a
         left join (select distinct a.* from ctop_bytedance_image_info a where 1 = 1 and a.account_id =#{accountId}
-        <if test="imageMode = '1'">
+        <if test="imageMode == '1'.toString()">
             and a.type = '1'
         </if>
-        <if test="imageMode = '2'">
+        <if test="imageMode == '2'.toString()">
             and (a.type = '2' or a.type = '4')
         </if>
-        <if test="imageMode = '3'">
+        <if test="imageMode == '3'.toString()">
             and (a.type = '3' or a.type = '4')
         </if>) as image
         on a.material_id = image.material_id

+ 6 - 4
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -355,7 +355,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         if ("video".equalsIgnoreCase(videoInfo.getMaterialType())){
             //视频类型
             //1-竖版视频 2-横版视频
-            String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL" : "CREATIVE_IMAGE_MODE_VIDEO";
+//            String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL" : "CREATIVE_IMAGE_MODE_VIDEO";
+            String imageMode = strategy.getCreativeImageMode();
             imageObject.put("image_mode",imageMode);
             imageObject.put("video_id",videoInfo.getVid());
             //获取视频封面id
@@ -365,7 +366,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
             }
         }else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
             //1-大图横图; 2-大图竖图
-            String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_LARGE" : "CREATIVE_IMAGE_MODE_LARGE_VERTICAL";
+//            String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_LARGE" : "CREATIVE_IMAGE_MODE_LARGE_VERTICAL";
+            String imageMode = strategy.getCreativeImageMode();
             imageObject.put("image_mode",imageMode);
             imageObject.put("image_ids",new String[]{videoInfo.getId()});
         }
@@ -374,6 +376,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         params.put("image_list",imageArray);
         JSONArray titleArray = new JSONArray();
         List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
+        //使用指定文案
         if(!Check.isNull(slogenInfos)){
             for (BytedanceVideoSlogenInfo slogenInfo:slogenInfos) {
                 if(titleArray.size() >= 10){    //接口中是要求一个视频最多10个标题
@@ -391,6 +394,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 titleArray.add(titleObject);
             }
         }
+        // 指定文案不够的时候 使用通用文案
         for(int i = 0; i < 3; i++){
             if(titleArray.size() >= 10){
                 break;
@@ -408,9 +412,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
                 }
                 titleArray.add(titleObject);
             }
-
         }
-
         if(!Check.isNull(titleArray)){
             params.put("title_list",titleArray);
         }