Pārlūkot izejas kodu

修改获取视频id方法

xueyiming 3 mēneši atpakaļ
vecāks
revīzija
bae86fade0

+ 6 - 4
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/video/impl/MatchVideoServiceImpl.java

@@ -183,13 +183,15 @@ public class MatchVideoServiceImpl implements MatchVideoService {
         }
         String ghId = matchVideo.getGhId();
         String response = matchVideo.getResponse();
-        List<Long> videoIds = JSONArray.parseArray(response, Long.class);
-        if (CollectionUtils.isNotEmpty(videoIds)) {
+        JSONArray jsonArray = JSONArray.parseArray(response);
+
+        if (CollectionUtils.isNotEmpty(jsonArray)) {
             List<GetOffVideoArticle> addList = new ArrayList<>();
-            for (Long videoId : videoIds) {
+            for (int i = 0; i < jsonArray.size(); i++) {
+                JSONObject jsonObject = jsonArray.getJSONObject(i);
                 GetOffVideoArticle getOffVideoArticle = new GetOffVideoArticle();
                 getOffVideoArticle.setTraceId(getOffVideosParam.getTraceId());
-                getOffVideoArticle.setVideoId(videoId);
+                getOffVideoArticle.setVideoId(jsonObject.getLong("videoId"));
                 getOffVideoArticle.setVideoStatus(1);
                 getOffVideoArticle.setPublishTime(System.currentTimeMillis() / 1000);
                 addList.add(getOffVideoArticle);