12345678910111213141516171819202122232425262728293031323334 |
- package com.tzld.piaoquan.api.component;
- import com.alibaba.fastjson.JSONObject;
- import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Component;
- import java.util.List;
- @Slf4j
- @Component
- public class ManagerApiService {
- @Autowired
- private HttpPoolClient httpPoolClient;
- @Value("${video.api.host:https://videotest.yishihui.com}")
- private String videoApiHost;
- public List<String> getCoverImagePaths(Long videoId) {
- String url = videoApiHost + "/longvideoapi/video/getCoverImagePaths";
- try {
- String post = httpPoolClient.post(url, "id=" + videoId, "application/x-www-form-urlencoded;charset=UTF-8");
- JSONObject res = JSONObject.parseObject(post);
- JSONObject data = res.getJSONObject("data");
- return data.getJSONArray("videoCoverImages").toJavaList(String.class);
- } catch (Exception e) {
- log.error("getVideoDetailRequest error", e);
- }
- return null;
- }
- }
|