VlogApiService.java 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package com.tzld.piaoquan.api.component;
  2. import com.alibaba.fastjson.JSON;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.tzld.piaoquan.growth.common.component.HttpPoolClient;
  5. import lombok.extern.slf4j.Slf4j;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.stereotype.Component;
  8. @Slf4j
  9. @Component
  10. public class VlogApiService {
  11. @Autowired
  12. private HttpPoolClient httpPoolClient;
  13. private final static String SHARE_IMG_URL = "https://vlogapi.piaoquantv.com/longvideoapi/video/share/web/qrImg";
  14. private final static String SHARE_LINK_URL = "https://vlogapi.piaoquantv.com/longvideoapi/video/share/web/link";
  15. public String getSharePic(String path, String appType) {
  16. JSONObject requestParam = new JSONObject();
  17. requestParam.put("page", path);
  18. requestParam.put("appType", appType);
  19. try {
  20. String resultStr = httpPoolClient.post(SHARE_IMG_URL, requestParam.toJSONString());
  21. JSONObject result = JSON.parseObject(resultStr);
  22. return result.getString("data");
  23. } catch (Exception e) {
  24. log.error("获取分享图片失败", e);
  25. }
  26. return null;
  27. }
  28. public String getShareUrlLink(String path, String appType) {
  29. JSONObject requestParam = new JSONObject();
  30. requestParam.put("page", path);
  31. requestParam.put("appType", appType);
  32. try {
  33. String resultStr = httpPoolClient.post(SHARE_LINK_URL, requestParam.toJSONString());
  34. JSONObject result = JSON.parseObject(resultStr);
  35. return result.getString("data");
  36. } catch (Exception e) {
  37. log.error("获取分享链接失败", e);
  38. }
  39. return null;
  40. }
  41. }