tik集成
This commit is contained in:
@@ -52,7 +52,7 @@ public class TikHupController {
|
||||
summary = "获取用户主页作品数据",
|
||||
description = "通过TikHup API获取指定用户的TikTok作品数据,包括视频列表、用户信息等"
|
||||
)
|
||||
public Object postTikHup(@RequestParam String type,@RequestParam String methodType,@RequestParam String urlParams) {
|
||||
public Object postTikHup(@RequestParam String type,@RequestParam String methodType,@RequestParam String urlParams,@RequestParam String paramType) {
|
||||
return tikHupService.postTikHup(type, methodType,urlParams);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public interface TikHupService {
|
||||
Object fetch_user_post_videos(String type,String sec_user_id,int max_cursor, int count);
|
||||
|
||||
|
||||
Object postTikHup(String type,String methodType,String urlParams);
|
||||
Object postTikHup(String type,String methodType,String urlParams,String paramType);
|
||||
|
||||
/**
|
||||
* 音频转文字
|
||||
|
||||
@@ -59,14 +59,20 @@ public class TikHupServiceImpl implements TikHupService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postTikHup(String type,String methodType,String urlParams){
|
||||
public Object postTikHup(String type,String methodType,String urlParams,String paramType){
|
||||
TikTokenVO tikTokenVO = tikTokenMapper.getInterfaceUrl(type);
|
||||
String Authorization = tikTokenVO.getPlatformToken();
|
||||
String url = tikTokenVO.getPlatformUrl();
|
||||
try{
|
||||
Unirest.setTimeouts(0, 0);
|
||||
HttpResponse<String> response;
|
||||
if("post".equals(methodType)){
|
||||
if("post".equals(methodType) && "json".equals(paramType)){
|
||||
response = Unirest.post(url)
|
||||
.header("Authorization", "Bearer "+Authorization)
|
||||
.header("Content-Type", "application/json")
|
||||
.body(urlParams)
|
||||
.asString();
|
||||
} else if("post".equals(methodType)){
|
||||
response = Unirest.post(url + "?" + urlParams)
|
||||
.header("Authorization", "Bearer "+Authorization)
|
||||
.asString();
|
||||
@@ -75,10 +81,8 @@ public class TikHupServiceImpl implements TikHupService{
|
||||
.header("Authorization", "Bearer "+Authorization)
|
||||
.asString();
|
||||
}
|
||||
if(response.getStatus() == 200){
|
||||
Long userId = SecurityFrameworkUtils.getLoginUser().getId();
|
||||
return JSON.parseObject(response.getBody());
|
||||
}
|
||||
Long userId = SecurityFrameworkUtils.getLoginUser().getId();
|
||||
return response;
|
||||
}catch (Exception e){
|
||||
log.error("{}接口调用异常",url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user