style(api): 统一代码风格并修复语法问题
- 统一import语句的空格格式 - 修复分号缺失问题 - 调整函数参数换行格式以符合规范 - 删除多余空行保持代码整洁 - 修复字符串拼接的换行格式问题
This commit is contained in:
@@ -6,9 +6,9 @@ import { SERVER_API_URL } from '@/config/setting';
|
||||
* 二维码生成响应数据
|
||||
*/
|
||||
export interface QrCodeResponse {
|
||||
token: string; // 二维码唯一标识token
|
||||
qrCode: string; // 二维码内容
|
||||
expiresIn: number; // 过期时间(秒)
|
||||
token: string; // 二维码唯一标识token
|
||||
qrCode: string; // 二维码内容
|
||||
expiresIn: number; // 过期时间(秒)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -16,19 +16,19 @@ export interface QrCodeResponse {
|
||||
*/
|
||||
export interface QrCodeStatusResponse {
|
||||
status: 'pending' | 'scanned' | 'confirmed' | 'expired';
|
||||
accessToken?: string; // 登录成功时返回的JWT token
|
||||
userInfo?: any; // 用户信息
|
||||
expiresIn?: number; // 剩余过期时间(秒)
|
||||
tenantId?: string; // 租户ID
|
||||
accessToken?: string; // 登录成功时返回的JWT token
|
||||
userInfo?: any; // 用户信息
|
||||
expiresIn?: number; // 剩余过期时间(秒)
|
||||
tenantId?: string; // 租户ID
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认登录请求参数
|
||||
*/
|
||||
export interface QrLoginConfirmRequest {
|
||||
token: string; // 二维码token
|
||||
userId?: number; // 用户ID
|
||||
platform?: string; // 登录平台
|
||||
token: string; // 二维码token
|
||||
userId?: number; // 用户ID
|
||||
platform?: string; // 登录平台
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +50,9 @@ export async function generateQrCode(): Promise<QrCodeResponse> {
|
||||
/**
|
||||
* 检查二维码状态
|
||||
*/
|
||||
export async function checkQrCodeStatus(token: string): Promise<QrCodeStatusResponse> {
|
||||
export async function checkQrCodeStatus(
|
||||
token: string
|
||||
): Promise<QrCodeStatusResponse> {
|
||||
const res = await request.get<ApiResult<QrCodeStatusResponse>>(
|
||||
SERVER_API_URL + `/qr-login/status/${token}`
|
||||
);
|
||||
@@ -65,12 +67,14 @@ export async function checkQrCodeStatus(token: string): Promise<QrCodeStatusResp
|
||||
/**
|
||||
* 扫码确认登录(移动端调用)
|
||||
*/
|
||||
export async function confirmQrLogin(requestData: QrLoginConfirmRequest): Promise<QrCodeStatusResponse> {
|
||||
export async function confirmQrLogin(
|
||||
requestData: QrLoginConfirmRequest
|
||||
): Promise<QrCodeStatusResponse> {
|
||||
const res = await request.post<ApiResult<QrCodeStatusResponse>>(
|
||||
SERVER_API_URL + '/qr-login/confirm',
|
||||
requestData
|
||||
);
|
||||
console.log(res,'>>>89898989')
|
||||
console.log(res, '>>>89898989');
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
@@ -96,7 +100,9 @@ export async function scanQrCode(token: string): Promise<boolean> {
|
||||
/**
|
||||
* 微信小程序扫码登录确认
|
||||
*/
|
||||
export async function wechatMiniProgramConfirm(requestData: QrLoginConfirmRequest): Promise<QrCodeStatusResponse> {
|
||||
export async function wechatMiniProgramConfirm(
|
||||
requestData: QrLoginConfirmRequest
|
||||
): Promise<QrCodeStatusResponse> {
|
||||
const res = await request.post<ApiResult<QrCodeStatusResponse>>(
|
||||
SERVER_API_URL + '/qr-login/wechat-confirm',
|
||||
requestData
|
||||
@@ -106,5 +112,7 @@ export async function wechatMiniProgramConfirm(requestData: QrLoginConfirmReques
|
||||
return res.data.data;
|
||||
}
|
||||
|
||||
return Promise.reject(new Error(res.data.message || '微信小程序登录确认失败'));
|
||||
return Promise.reject(
|
||||
new Error(res.data.message || '微信小程序登录确认失败')
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user