Browse Source

Merge branch 'dev-xym-add-param' of Server/long-article-manage into master

xueyiming 6 months ago
parent
commit
6f22744c28

+ 6 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/common/constants/RedisConstant.java

@@ -0,0 +1,6 @@
+package com.tzld.piaoquan.longarticle.common.constants;
+
+public interface RedisConstant {
+
+    String REDIS_COOKIE_KEY = "redis_cookie_key";
+}

+ 12 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/job/PlanAccountJob.java

@@ -6,8 +6,11 @@ import com.xxl.job.core.biz.model.ReturnT;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Component;
 
+import static com.tzld.piaoquan.longarticle.common.constants.RedisConstant.REDIS_COOKIE_KEY;
+
 @Slf4j
 @Component
 public class PlanAccountJob {
@@ -15,6 +18,9 @@ public class PlanAccountJob {
     @Autowired
     private CoreServiceImpl coreService;
 
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
 
     @XxlJob("initPlanAccountJob")
     public ReturnT<String> initPlanAccount(String param) {
@@ -60,4 +66,10 @@ public class PlanAccountJob {
         return ReturnT.SUCCESS;
     }
 
+    @XxlJob("updateCookieJob")
+    public ReturnT<String> updateCookie(String param) {
+        redisTemplate.opsForValue().set(REDIS_COOKIE_KEY, param);
+        return ReturnT.SUCCESS;
+    }
+
 }

+ 2 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/bo/MatchContent.java

@@ -22,4 +22,6 @@ public class MatchContent {
     private String flowPoolLevelTag;
 
     private Integer sourceType;
+
+    private String channelContentId;
 }

+ 1 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/dto/MiniprogramCardRequest.java

@@ -17,4 +17,5 @@ public class MiniprogramCardRequest {
     private String articleId;
     private String flowPoolLevelTag;
     private Integer publishFlag;
+    private String channelContentId;
 }

+ 1 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/vo/ContentItemVO.java

@@ -21,5 +21,6 @@ public class ContentItemVO {
     private String flowPoolLevelTag;
 
     private Integer sourceType;
+    private String channelContentId;
 
 }

+ 1 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -284,6 +284,7 @@ public class CoreServiceImpl implements CoreService {
                     matchContent.setTitle(contentItemVO.getTitle());
                     matchContent.setFlowPoolLevelTag(contentItemVO.getFlowPoolLevelTag());
                     matchContent.setSourceType(contentItemVO.getSourceType());
+                    matchContent.setChannelContentId(contentItemVO.getChannelContentId());
                     try {
                         matchQueue.put(matchContent);
                     } catch (InterruptedException e) {

+ 13 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/impl/VideoServiceImpl.java

@@ -15,6 +15,7 @@ import com.tzld.piaoquan.longarticle.utils.LarkRobotUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 
@@ -23,6 +24,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
+import static com.tzld.piaoquan.longarticle.common.constants.RedisConstant.REDIS_COOKIE_KEY;
+
 @Slf4j
 @Service
 public class VideoServiceImpl implements VideoService {
@@ -34,6 +37,11 @@ public class VideoServiceImpl implements VideoService {
     @Autowired
     private OffVideoMapper offVideoMapper;
 
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
+
+
+
     public VideoDetail publish(String ossPath, String uid, String title) {
         String videoId = publishToPQ(ossPath, uid, title);
         if (videoId == null) {
@@ -44,6 +52,10 @@ public class VideoServiceImpl implements VideoService {
 
     private String publishToPQ(String ossPath, String uid, String title) {
         try {
+            String cookie = (String) redisTemplate.opsForValue().get(REDIS_COOKIE_KEY);
+            if(StringUtils.isEmpty(cookie)){
+                cookie = "JSESSIONID=4DEA2B5173BB9A9E82DB772C0ACDBC9F; JSESSIONID=D02C334150025222A0B824A98B539B78";
+            }
             Map<String, Object> payload = new HashMap<>();
             payload.put("deviceToken", "9ef064f2f7869b3fd67d6141f8a899175dddc91240971172f1f2a662ef891408");
             payload.put("fileExtensions", "MP4");
@@ -66,7 +78,7 @@ public class VideoServiceImpl implements VideoService {
 
             HttpResponse response = HttpRequest.post(PUBLISH_URL)
                     .header("User-Agent", "PQSpeed/486 CFNetwork/1410.1 Darwin/22.6.0")
-                    .header("cookie", "JSESSIONID=4DEA2B5173BB9A9E82DB772C0ACDBC9F; JSESSIONID=D02C334150025222A0B824A98B539B78")
+                    .header("cookie", cookie)
                     .header("referer", "http://appspeed.piaoquantv.com")
                     .header("accept-language", "zh-CN,zh-Hans;q=0.9")
                     .header("Content-Type", "application/x-www-form-urlencoded")