feat: integrate WeChat Open Platform QR code login

- Add WeChat service for OAuth2 authentication flow
- Add WeChat routes (/api/wechat/login, /api/wechat/callback)
- Add WeChat types for login state and responses
- Update EntryQRCode component to support WeChat login
- Add WeChat config options (appId, appSecret, redirectUri)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
empty
2026-02-03 14:38:54 +08:00
parent 5d7bf74101
commit 3246479643
7 changed files with 574 additions and 16 deletions

View File

@@ -4,3 +4,4 @@ export * from './vote.types';
export * from './draw.types';
export * from './admin.types';
export * from './scan-login.types';
export * from './wechat.types';

View File

@@ -0,0 +1,54 @@
// WeChat Open Platform login types
export interface WechatLoginState {
state: string;
pcSocketId: string;
createdAt: number;
expiresAt: number;
}
export interface WechatLoginResponse {
success: boolean;
data?: {
authUrl: string;
state: string;
expiresAt: number;
};
error?: string;
}
export interface WechatCallbackResult {
success: boolean;
openid?: string;
pcSocketId?: string;
error?: string;
}
export interface WechatAccessTokenResponse {
access_token?: string;
expires_in?: number;
refresh_token?: string;
openid?: string;
scope?: string;
errcode?: number;
errmsg?: string;
}
export interface WechatUserInfo {
openid: string;
nickname?: string;
sex?: number;
province?: string;
city?: string;
country?: string;
headimgurl?: string;
privilege?: string[];
unionid?: string;
}
export interface WechatLoginSuccessPayload {
openid: string;
sessionToken: string;
userId: string;
userInfo?: WechatUserInfo;
}