This commit is contained in:
kuang.yife 2024-04-18 18:41:35 +08:00
parent 1518e5d1c9
commit 5fad8ac24e
2 changed files with 11 additions and 14 deletions

View File

@ -40,7 +40,7 @@ public class PlayletUserItemAppServiceImpl implements PlayletUserItemAppService
@Override @Override
public String addUserItem(PlayletUserItem playletUserItem) { public String addUserItem(PlayletUserItem playletUserItem) {
PlayletUserItem model = iPlayletUserItemService.lambdaQuery() PlayletUserItem model = iPlayletUserItemService.lambdaQuery()
.eq(PlayletUserItem::getPlayletItem, playletUserItem.getItemId()) .eq(PlayletUserItem::getItemId, playletUserItem.getItemId())
.eq(PlayletUserItem::getUserId, playletUserItem.getUserId()) .eq(PlayletUserItem::getUserId, playletUserItem.getUserId())
.one(); .one();
if(model == null){ if(model == null){
@ -48,17 +48,8 @@ public class PlayletUserItemAppServiceImpl implements PlayletUserItemAppService
iPlayletUserItemService.save(playletUserItem); iPlayletUserItemService.save(playletUserItem);
model = playletUserItem; model = playletUserItem;
} }
JSONObject body = new JSONObject(); // JSONObject body = new JSONObject();
body.put("clientId","1000123"); return this.getPlayletUrl();
body.put("channelId","34661");
body.put("bookId","41000103084");
body.put("chapterIdx","1");
body.put("name","ai种草达人");
body.put("mediaSource","dy");
// 调用推广api返回链接
String result = HttpUtil.post("https://video.wqxsw.com/api/channelapi/referralsave", body);
log.info("请求返回内容为 : {}", result);
return "等待返回实际推广链接";
} }
@Override @Override
@ -76,7 +67,7 @@ public class PlayletUserItemAppServiceImpl implements PlayletUserItemAppService
return PageInfo.of(list); return PageInfo.of(list);
} }
public static void main(String[] args) { private String getPlayletUrl(){
String token = "zlwaiSrEM9KEbilu5f"; String token = "zlwaiSrEM9KEbilu5f";
String timestamp = String.valueOf((int)(System.currentTimeMillis()/1000)); String timestamp = String.valueOf((int)(System.currentTimeMillis()/1000));
String clientId = "10005693"; String clientId = "10005693";
@ -99,5 +90,11 @@ public class PlayletUserItemAppServiceImpl implements PlayletUserItemAppService
HttpResponse result = HttpUtil.createPost(url).addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(body)).execute(); HttpResponse result = HttpUtil.createPost(url).addHeaders(headerMap).body(com.alibaba.fastjson.JSONObject.toJSONString(body)).execute();
// String result = HttpUtil.post("https://video.wqxsw.com/api/v1/channelapi/getminiqrcode", body); // String result = HttpUtil.post("https://video.wqxsw.com/api/v1/channelapi/getminiqrcode", body);
log.info("请求入参:{}, 地址:{}, 返回:{}", body, url, result.body()); log.info("请求入参:{}, 地址:{}, 返回:{}", body, url, result.body());
com.alibaba.fastjson.JSONObject json = com.alibaba.fastjson.JSONObject.parseObject(result.body());
if("1".equals(json.getString("code"))){
return json.getJSONObject("data").getString("monitor");
}else {
return null;
}
} }
} }

View File

@ -19,7 +19,7 @@ server:
port: 18080 port: 18080
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /playlet/
tomcat: tomcat:
# tomcat的URI编码 # tomcat的URI编码
uri-encoding: UTF-8 uri-encoding: UTF-8