对接授权接口

This commit is contained in:
Lrd
2026-06-18 09:06:39 +08:00
parent 0bad14936b
commit 879c878633
5 changed files with 813 additions and 102 deletions
+90
View File
@@ -392,3 +392,93 @@ export async function getthree(projectId: string, stepId: string ,params: any):
export async function getfour(projectId: string, stepId: string ,params: any): Promise<any> {
return api.post(`/hot-opening-replications/tasks/${projectId}/steps/${stepId}/generate-video`, params);
}
// 获取授权链接
export interface RequestOAuthParams {
open_type: number;
}
export async function requestOAuth(params: RequestOAuthParams): Promise<any> {
return api.post(`/user-oauth/request_oauth`, params);
}
// 巨量授权回调
export interface JuliangCallbackParams {
auth_code: string;
state: string;
}
export async function juliang_callback(params: JuliangCallbackParams): Promise<any> {
const query = new URLSearchParams();
query.set('auth_code', params.auth_code);
query.set('state', params.state);
return api.get(`/user-oauth/juliang_callback?${query.toString()}`);
}
// 授权列表
export interface OAuthListParams {
account_userid?: string;
open_type?: number;
account_id?: string;
page?: number;
page_size?: number;
}
export async function getOAuthList(params: OAuthListParams): Promise<any> {
const query = new URLSearchParams();
if (params.account_userid) query.set('account_userid', params.account_userid);
if (params.open_type !== undefined) query.set('open_type', String(params.open_type));
if (params.account_id) query.set('account_id', params.account_id);
if (params.page !== undefined) query.set('page', String(params.page));
if (params.page_size !== undefined) query.set('page_size', String(params.page_size));
return api.get(`/user-oauth/oauth_list?${query.toString()}`);
}
// 前测模板列表
// /api/pre-test-template/list
export interface PreTestListParams {
page?: number;
pageSize?: number;
}
export async function getPreTestList(params?: PreTestListParams): Promise<any> {
if (USE_MOCK) return mock.mockGetPreTestList(params);
const page = params?.page || 1;
const pageSize = Math.min(params?.pageSize || 10, 100);
return api.get(`/pre-test-template/list?page=${page}&page_size=${pageSize}`);
}
// 获取前测字段列表
// /api/pre-test-template/fields
export async function getPreTestFields(): Promise<any> {
if (USE_MOCK) return mock.mockGetPreTestFields();
return api.get(`/pre-test-template/fields`);
}
// 创建前测模板
// /api/pre-test-template/create
export async function createPreTest(params: any): Promise<any> {
if (USE_MOCK) return mock.mockCreatePreTest(params);
return api.post(`/pre-test-template/create`, params);
}
// 前测模板详情
// /api/pre-test-template/select/{template_id}
export async function getPreTestDetail(templateId: string): Promise<any> {
return api.get(`/pre-test-template/select/${templateId}`);
}
// 更新前测模板
// /api/pre-test-template/update/{template_id}
export async function updatePreTest(templateId: string, params: any): Promise<any> {
return api.post(`/pre-test-template/update/${templateId}`, params);
}
// 删除前测模板
// /api/pre-test-template/delete/{template_id}
export async function deletePreTest(templateId: string): Promise<any> {
return api.get(`/pre-test-template/delete/${templateId}`);
}
// 获取默认前测模板
// /api/pre-test-template/default
export async function getDefaultPreTest(): Promise<any> {
return api.get(`/pre-test-template/default`);
}