tik集成

This commit is contained in:
wing
2025-10-26 19:18:51 +08:00
parent 2ad68890dd
commit 9a3d3bfc5c
3 changed files with 12 additions and 8 deletions

View File

@@ -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);
}

View File

@@ -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);
/**
* 音频转文字

View File

@@ -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);
}