Explorar o código

刷新推广链任务更新

zhaotx hai 1 ano
pai
achega
71a9edbf79

+ 7 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/mapper/xml/PromoteLinkRefreshMapper.xml

@@ -10,8 +10,11 @@
 
 
     <select id="refreshList" resultType="com.alibaba.fastjson.JSONObject">
-        select tb1.task_id, tb1.advertiser_id, tb1.promoter_id, tb1.link_uuid, tb4.expire_time, tb2.media_type, tb3.app_plat_type,
-        tb3.movie_id as video_id, tb5.id as video_detail_id, tb1.promoter_uri, tb2.app_id, tb6.id as applet_id
+        select tb1.task_id, tb1.advertiser_id, tb1.promoter_id, tb1.link_uuid, tb4.expire_time,
+        tb2.media_type, tb3.app_plat_type,
+        tb3.movie_id as video_id, tb5.id as video_detail_id,
+        tb1.promoter_uri, tb2.app_id, tb6.id as applet_id,
+        tb5.platform_config, tb5.sort, tb7.album_id
         from
         (select *
         from deepthink.bytedance_advertiser_task_link
@@ -26,6 +29,8 @@
         on tb3.movie_id = tb5.video_id and tb3.entry_chapter_count = tb5.sort
         left join thirtpart.ly_applet tb6
         on tb2.app_id = tb6.app_id
+        left join thirtpart.ly_third_videos tb7
+        on tb3.movie_id = tb7.video_id
         where tb4.expire_time &lt;= ${expireTime}
     </select>
 </mapper>

+ 21 - 1
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedancePromoteRefreshServiceImpl.java

@@ -8,6 +8,7 @@ import cn.com.ctop.job.bytedance.utils.FeishuRobotUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import io.netty.util.internal.StringUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
@@ -19,6 +20,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+@Slf4j
 @Service
 public class BytedancePromoteRefreshServiceImpl implements IBytedancePromoteRefreshService {
     @Resource
@@ -134,6 +136,20 @@ public class BytedancePromoteRefreshServiceImpl implements IBytedancePromoteRefr
                 }
                 String token = String.valueOf(tokenobj);
 
+                String serialNo = linkInfo.getString("sort");
+                String albumId = linkInfo.getString("album_id");
+                String episodeId = "";
+                try {
+                    String platform_config = linkInfo.getString("platform_config");
+                    if (!Check.isNull(platform_config)){
+                        JSONObject platformConfigJson = JSON.parseObject(platform_config);
+                        if (!platformConfigJson.containsKey("douyinyun")){
+                        }
+                        episodeId = platformConfigJson.getJSONObject("douyinyun").getString("episode_id");
+                    }
+                }catch (Exception e){
+                    log.error("解析平台配置失败: " + e.getMessage(), e);
+                }
                 //douyin
                 String path = promoterUri.split("\\?")[0];
                 String url = "https://open.douyin.com/api/apps/v1/url_link/generate/";
@@ -141,8 +157,12 @@ public class BytedancePromoteRefreshServiceImpl implements IBytedancePromoteRefr
                 query.put("link_id", String.valueOf(linkId));
                 query.put("video_id", String.valueOf(videoId));
                 query.put("video_detail_id", String.valueOf(videoDetailId));
-                query.put("type", String.valueOf(mediaType));
+                query.put("type", "1");
                 query.put("source", "link");
+                query.put("serialNo", serialNo);
+                query.put("app_id", appId);
+                query.put("tt_album_id", albumId);
+                query.put("tt_episode_id", episodeId);
                 Map<String, Object> params = new HashMap<>();
                 params.put("app_id", appId);
                 params.put("app_name", "douyin");