This commit is contained in:
ryan
2026-06-08 08:19:22 +08:00
parent 4b72419a96
commit 9d0f9f0576
42 changed files with 1412 additions and 809 deletions
@@ -1,8 +1,10 @@
import {BaseService} from '../core/base.service';
import type {
AdminUser,
AuthSource,
AuthSourceRequest,
CreateSystemConfigRequest,
CreateUserRequest,
DispatchTaskRequest,
ListTaskExecutionsRequest,
ListTaskExecutionsResponse,
@@ -307,4 +309,13 @@ export class AdminService extends BaseService {
): Promise<void> {
return this.put<void>(`/users/${ id }/status`, request);
}
/**
* 创建用户
* @param request - 创建用户请求参数
* @returns 创建成功的用户信息
*/
static async createUser(request: CreateUserRequest): Promise<AdminUser> {
return this.post<AdminUser>('/users', request);
}
}
+1
View File
@@ -23,6 +23,7 @@ export { AdminService } from './admin.service';
export type {
SystemConfig,
CreateSystemConfigRequest,
CreateUserRequest,
UpdateSystemConfigRequest,
AuthSource,
AuthSourceRequest,
+16 -14
View File
@@ -160,20 +160,6 @@ export interface AdminUser {
nickname: string;
/** 头像 URL */
avatar_url: string;
/** 信任等级 */
trust_level: number;
/** 支付积分 */
pay_score: number;
/** 累计收入 */
total_receive: string;
/** 累计支出 */
total_payment: string;
/** 累计社区积分 */
total_community: string;
/** 社区余额 */
community_balance: string;
/** 可用余额 */
available_balance: string;
/** 是否激活 */
is_active: boolean;
/** 是否管理员 */
@@ -218,6 +204,22 @@ export interface UpdateUserStatusRequest {
is_active: boolean;
}
/**
* 创建用户请求参数
*/
export interface CreateUserRequest {
/** 用户名 */
username: string;
/** 密码 */
password: string;
/** 昵称 */
nickname?: string;
/** 是否激活 */
is_active?: boolean;
/** 是否管理员 */
is_admin?: boolean;
}
/**
* 认证源信息
*/
@@ -1,6 +1,7 @@
import {BaseService} from '../core/base.service';
import type {
AuthSource,
ChangePasswordRequest,
ExternalAccountBinding,
LoginRequest,
OAuthAuthorizeResponse,
@@ -110,6 +111,10 @@ export class AuthService extends BaseService {
return this.post<User>('/user/register', request);
}
static async changePassword(request: ChangePasswordRequest): Promise<void> {
return this.post<void>('/user/change-password', request);
}
static async getExternalAccountBindings(): Promise<ExternalAccountBinding[]> {
return this.get<ExternalAccountBinding[]>('/oauth/external-accounts');
}
+1 -1
View File
@@ -26,7 +26,6 @@
*/
export { AuthService } from './auth.service';
export { TrustLevel, PayLevel } from './types';
export type {
User,
OAuthLoginUrlResponse,
@@ -37,4 +36,5 @@ export type {
OAuthCallbackResult,
AuthSource,
ExternalAccountBinding,
ChangePasswordRequest,
} from './types';
+7 -52
View File
@@ -1,33 +1,3 @@
/**
* 信任等级
*/
export enum TrustLevel {
/** 新用户 */
New = 0,
/** 基础用户 */
Basic = 1,
/** 成员 */
Member = 2,
/** 常规用户 */
Regular = 3,
/** 领导者 */
Leader = 4,
}
/**
* 支付等级
*/
export enum PayLevel {
/** 普通 */
Ordinary = 0,
/** 黄金 */
Gold = 1,
/** 白金 */
WhiteGold = 2,
/** 黑金 */
BlackGold = 3,
}
/**
* 用户基本信息
*/
@@ -38,32 +8,12 @@ export interface User {
username: string;
/** 昵称 */
nickname: string;
/** 信任等级 */
trust_level: TrustLevel;
/** 头像 URL */
avatar_url: string;
/** 总接收金额 */
total_receive: string;
/** 总支付金额 */
total_payment: string;
/** 总社区金额 */
total_community: string;
/** 社区余额 */
community_balance: string;
/** 可用余额 */
available_balance: string;
/** 在途资金(延迟到账中) */
pending_balance: string;
/** 支付分数 */
pay_score: number;
/** 是否为管理员 */
is_admin: boolean;
/** 当日剩余配额 */
remain_quota: string;
/** 支付等级 */
pay_level: PayLevel;
/** 每日限额 */
daily_limit: number | null;
/** 是否需要修改密码 */
need_change_password?: boolean;
}
/**
@@ -122,3 +72,8 @@ export interface ExternalAccountBinding {
email: string;
created_at: string;
}
export interface ChangePasswordRequest {
old_password: string;
new_password: string;
}
+3 -2
View File
@@ -81,8 +81,8 @@ export type {
// ==================== 业务服务导出 ====================
// 认证服务
export { AuthService, TrustLevel } from './auth';
export type { User, OAuthLoginUrlResponse, OAuthCallbackRequest, AuthSource, ExternalAccountBinding } from './auth';
export { AuthService } from './auth';
export type { User, OAuthLoginUrlResponse, OAuthCallbackRequest, AuthSource, ExternalAccountBinding, ChangePasswordRequest } from './auth';
// 配置服务
export { ConfigService } from './config';
@@ -93,6 +93,7 @@ export { AdminService } from './admin';
export type {
SystemConfig,
CreateSystemConfigRequest,
CreateUserRequest,
UpdateSystemConfigRequest,
TaskMeta,
TaskExecution,