♻️ 重构用户登录逻辑及切换

#126
This commit is contained in:
目棃
2024-09-21 19:32:14 +08:00
parent 39a1a1dd77
commit cc7dd7c8ca
27 changed files with 739 additions and 897 deletions

View File

@@ -1,11 +1,33 @@
/**
* @file types App Account.d.ts
* @file types/App/Account.d.ts
* @description App 账号相关类型定义文件
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.2.0
* @since Beta v0.6.0
*/
/**
* @description 应用账户类型声明
* @since Beta v0.6.0
* @namespace TGApp.App.Account
* @memberof TGApp.App
*/
declare namespace TGApp.App.Account {
/**
* @description 用户数据
* @since Beta v0.6.0
* @interface User
* @property {string} uid - 米社UID
* @property {BriefInfo} brief - 简略信息
* @property {Cookie} cookie - 用户cookie
* @property {string} updated - 更新时间
* @returns User
*/
interface User {
uid: string;
brief: BriefInfo;
cookie: Cookie;
updated: string;
}
/**
* @description 用户简略信息
* @since Alpha v0.2.0
@@ -16,10 +38,32 @@ declare namespace TGApp.App.Account {
* @property {string} desc 用户简介
* @return BriefInfo
*/
export interface BriefInfo {
interface BriefInfo {
nickname: string;
uid: string;
avatar: string;
desc: string;
}
/**
* @description 用户cookie
* @since Beta v0.6.0
* @interface Cookie
* @property {string} account_id 账号 ID
* @property {string} cookie_token Cookie Token
* @property {string} ltoken LToken
* @property {string} ltuid LTUID
* @property {string} mid MID
* @property {string} stoken SToken_v2
* @return Cookie
*/
interface Cookie {
account_id: string;
cookie_token: string;
ltoken: string;
ltuid: string;
mid: string;
stoken: string;
stuid: string;
}
}

View File

@@ -1,12 +1,12 @@
/**
* @file types/BBS/Account.d.ts
* @description BBS 账户相关类型定义文件
* @since Beta v0.3.4
* @since Beta v0.6.0
*/
/**
* @description 米游社账户信息
* @since Beta v0.3.4
* @since Beta v0.6.0
* @namespace TGApp.BBS.Account
* @memberof TGApp.BBS
*/
@@ -145,4 +145,29 @@ declare namespace TGApp.BBS.Account {
tap_name: string;
reactivate_ticket: string;
}
/**
* @description 游戏账号类型
* @interface GameAccount
* @since Beta v0.6.0
* @property {string} game_biz 游戏 biz例如 hk4e_cn
* @property {string} game_uid 游戏 uid
* @property {boolean} is_chosen 是否为当前选中账号
* @property {boolean} is_official 是否为官服账号
* @property {string} level 游戏等级
* @property {string} nickname 游戏昵称
* @property {string} region 游戏区域
* @property {string} region_name 游戏区域名称
* @return Game
*/
interface GameAccount {
game_biz: string;
game_uid: string;
is_chosen: boolean;
is_official: boolean;
level: string;
nickname: string;
region: string;
region_name: string;
}
}

View File

@@ -1,12 +1,12 @@
/**
* @file types/BBS/Response.d.ts
* @description BBS 返回数据类型定义文件
* @since Beta v0.4.3
* @since Beta v0.6.0
*/
/**
* @description BBS 返回数据类型定义
* @since Beta v0.4.3
* @since Beta v0.6.0
* @namespace TGApp.BBS.Response
* @memberof TGApp.BBS
*/
@@ -209,4 +209,18 @@ declare namespace TGApp.BBS.Response {
msg: string;
};
}
/**
* @description 获取游戏账户数据
* @interface getGameAccounts
* @since Beta v0.6.0
* @extends BaseWithData
* @property {TGApp.BBS.Account.GameAccount[]} data.list - 返回数据
* @returns getGameAccounts
*/
interface getGameAccounts extends BaseWithData {
data: {
list: TGApp.BBS.Account.GameAccount[];
};
}
}

View File

@@ -1,15 +1,32 @@
/**
* @file types Sqlite Account.d.ts
* @file types/Sqlite/Account.d.ts
* @description Sqlite Account 类型定义文件
* @author BTMuli<bt-muli@outlook.com>
* @since Alpha v0.1.5
* @since Beta v0.6.0
*/
declare namespace TGApp.Sqlite.Account {
/**
* @description UserAccount 表数据类型
* @since Beta v0.6.0
* @interface User
* @property {string} uid - 米社UID
* @property {string} brief - 用户信息
* @property {string} cookie - 用户cookie
* @property {string} updated - 更新时间
* @returns User
*/
interface User {
uid: string;
brief: string;
cookie: string;
updated: string;
}
/**
* @description 游戏账号类型
* @since Alpha v0.1.5
* @since Beta v0.6.0
* @interface Game
* @property {string} uid 米社UID
* @property {string} gameBiz 游戏 biz例如 hk4e_cn
* @property {string} gameUid 游戏 uid
* @property {number} isChosen 是否为当前选中账号
@@ -18,9 +35,11 @@ declare namespace TGApp.Sqlite.Account {
* @property {string} nickname 游戏昵称
* @property {string} region 游戏区域
* @property {string} regionName 游戏区域名称
* @property {string} updated 更新时间
* @return Game
*/
export interface Game {
interface Game {
uid: string;
gameBiz: string;
gameUid: string;
isChosen: 0 | 1;
@@ -29,5 +48,6 @@ declare namespace TGApp.Sqlite.Account {
nickname: string;
region: string;
regionName: string;
updated: string;
}
}

View File

@@ -1,75 +0,0 @@
/**
* @file types/User/Account.d.ts
* @description 用户账号相关类型定义文件
* @since Beta v0.4.3
*/
/**
* @description 用户账号相关类型定义命名空间
* @since Beta v0.4.3
* @namespace TGApp.User.Account
* @memberof TGApp.User
*/
declare namespace TGApp.User.Account {
/**
* @description 游戏账号返回类型
* @interface GameResponse
* @since Alpha v0.1.5
* @extends TGApp.BBS.Response.BaseWithData
* @property {Game[]} data.list 游戏账号列表
* @return GameResponse
*/
interface GameResponse extends TGApp.BBS.Response.BaseWithData {
data: {
list: Game[];
};
}
/**
* @description 游戏账号类型
* @interface Game
* @since Alpha v0.1.5
* @property {string} game_biz 游戏 biz例如 hk4e_cn
* @property {string} game_uid 游戏 uid
* @property {boolean} is_chosen 是否为当前选中账号
* @property {boolean} is_official 是否为官服账号
* @property {string} level 游戏等级
* @property {string} nickname 游戏昵称
* @property {string} region 游戏区域
* @property {string} region_name 游戏区域名称
* @return Game
*/
interface Game {
game_biz: string;
game_uid: string;
is_chosen: boolean;
is_official: boolean;
level: string;
nickname: string;
region: string;
region_name: string;
}
/**
* @description 用户 Cookie 类型
* @since Beta v0.4.3
* @interface Cookie
* @memberof TGApp.User.Account
* @property {string} account_id 账号 ID
* @property {string} cookie_token Cookie Token
* @property {string} ltoken LToken
* @property {string} ltuid LTUID
* @property {string} mid MID
* @property {string} stoken SToken_v2
* @return Cookie
*/
interface Cookie {
account_id: string;
cookie_token: string;
ltoken: string;
ltuid: string;
mid: string;
stoken: string;
stuid: string;
}
}