ManagerApiService.java 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. package com.tzld.piaoquan.api.component;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
  4. import lombok.extern.slf4j.Slf4j;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.beans.factory.annotation.Value;
  7. import org.springframework.stereotype.Component;
  8. import java.util.List;
  9. @Slf4j
  10. @Component
  11. public class ManagerApiService {
  12. @Autowired
  13. private HttpPoolClient httpPoolClient;
  14. @Value("${video.api.host:https://videotest.yishihui.com}")
  15. private String videoApiHost;
  16. public List<String> getCoverImagePaths(Long videoId) {
  17. String url = videoApiHost + "/longvideoapi/video/getCoverImagePaths";
  18. try {
  19. String post = httpPoolClient.post(url, "id=" + videoId, "application/x-www-form-urlencoded;charset=UTF-8");
  20. JSONObject res = JSONObject.parseObject(post);
  21. JSONObject data = res.getJSONObject("data");
  22. return data.getJSONArray("videoCoverImages").toJavaList(String.class);
  23. } catch (Exception e) {
  24. log.error("getVideoDetailRequest error", e);
  25. }
  26. return null;
  27. }
  28. }