mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-11 23:40:24 +00:00
* feat: 优化离线重连机制,增加前端登录错误提示与二维码刷新功能 - 增加全局掉线检测弹窗 - 增强登录错误解析,支持显示 serverErrorCode 和 message - 优化二维码登录 UI,错误时显示详细原因并提供大按钮重新获取 - 核心层解耦,通过事件抛出 KickedOffLine 通知 - 支持前端点击刷新二维码接口 * feat: 新增看门狗汪汪汪 * cp napcat-shell-loader/launcher-win.bat * refactor: 重构重启流程,移除旧的重启逻辑,新增基于 WebUI 的重启请求处理 * fix: 刷新二维码清楚错误信息
97 lines
2.4 KiB
TypeScript
97 lines
2.4 KiB
TypeScript
import { AxiosRequestConfig } from 'axios';
|
|
import { serverRequest } from '@/utils/request';
|
|
|
|
import { SelfInfo } from '@/types/user';
|
|
|
|
export default class QQManager {
|
|
public static async getOB11Config () {
|
|
const data = await serverRequest.post<ServerResponse<OneBotConfig>>(
|
|
'/OB11Config/GetConfig'
|
|
);
|
|
|
|
return data.data.data;
|
|
}
|
|
|
|
public static async setOB11Config (config: OneBotConfig) {
|
|
await serverRequest.post<ServerResponse<null>>('/OB11Config/SetConfig', {
|
|
config: JSON.stringify(config),
|
|
});
|
|
}
|
|
|
|
public static async checkQQLoginStatus () {
|
|
const data = await serverRequest.post<
|
|
ServerResponse<{
|
|
isLogin: string;
|
|
qrcodeurl: string;
|
|
}>
|
|
>('/QQLogin/CheckLoginStatus');
|
|
|
|
return data.data.data;
|
|
}
|
|
|
|
public static async checkQQLoginStatusWithQrcode () {
|
|
const data = await serverRequest.post<
|
|
ServerResponse<{ qrcodeurl: string; isLogin: string; loginError?: string; }>
|
|
>('/QQLogin/CheckLoginStatus');
|
|
|
|
return data.data.data;
|
|
}
|
|
|
|
public static async refreshQRCode () {
|
|
await serverRequest.post<ServerResponse<null>>('/QQLogin/RefreshQRcode');
|
|
}
|
|
|
|
public static async getQQLoginQrcode () {
|
|
const data = await serverRequest.post<
|
|
ServerResponse<{
|
|
qrcode: string;
|
|
}>
|
|
>('/QQLogin/GetQQLoginQrcode');
|
|
|
|
return data.data.data.qrcode;
|
|
}
|
|
|
|
public static async getQQQuickLoginList () {
|
|
const data = await serverRequest.post<ServerResponse<string[]>>(
|
|
'/QQLogin/GetQuickLoginList'
|
|
);
|
|
|
|
return data.data.data;
|
|
}
|
|
|
|
public static async getQQQuickLoginListNew () {
|
|
const data = await serverRequest.post<ServerResponse<LoginListItem[]>>(
|
|
'/QQLogin/GetQuickLoginListNew'
|
|
);
|
|
return data.data.data;
|
|
}
|
|
|
|
public static async setQuickLogin (uin: string) {
|
|
await serverRequest.post<ServerResponse<null>>('/QQLogin/SetQuickLogin', {
|
|
uin,
|
|
});
|
|
}
|
|
|
|
public static async getQQLoginInfo (config?: AxiosRequestConfig) {
|
|
const data = await serverRequest.post<ServerResponse<SelfInfo>>(
|
|
'/QQLogin/GetQQLoginInfo',
|
|
{},
|
|
config
|
|
);
|
|
return data.data.data;
|
|
}
|
|
|
|
public static async getQuickLoginQQ () {
|
|
const { data } = await serverRequest.post<ServerResponse<string>>(
|
|
'/QQLogin/GetQuickLoginQQ'
|
|
);
|
|
return data.data;
|
|
}
|
|
|
|
public static async setQuickLoginQQ (uin: string) {
|
|
await serverRequest.post<ServerResponse<null>>('/QQLogin/SetQuickLoginQQ', {
|
|
uin,
|
|
});
|
|
}
|
|
}
|