mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 16:46:37 +08:00
裁剪
swagger 移除 merchant swagger 改造首页内容为通用后台管理系统定位 - 修改首页标题从 'LINUX DO Credit' 改为 'Modern Platform' - 更新副标题为 '为二次开发而生' - 更新首页描述为通用平台的特点 - 更新首页特性标签为 '开箱即用、高度可扩展、工业级基建' - 修改展示卡片为技术栈和二次开发相关 - 更新开发者示例代码为通用的注册和 API Key 获取示例 - 更新页脚品牌名为 'Modern Platform' - 调整页脚导航链接为通用平台相关内容 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> 去除遗留 裁剪 移除 /api/v1/user/pay-key 相关代码 - 删除后端 UpdatePayKey 处理器函数和 UpdatePayKeyRequest 结构体 - 删除 User 模型中的 PayKey 字段 - 删除 User.VerifyPayKey 方法 - 删除 EncryptPayKeyFailed 错误常量 - 删除 /api/v1/user/pay-key PUT 路由 - 删除 OAuth 返回中的 IsPayKey 字段 - 删除前端 UserService.updatePayKey 方法 - 删除前端所有支付密钥 UI 和逻辑 - 更新相关的导出和注释 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> 去除遗留 api 修正 系统配置 前端裁剪 后端裁剪 init
This commit is contained in:
@@ -3,9 +3,6 @@ import type {
|
||||
SystemConfig,
|
||||
CreateSystemConfigRequest,
|
||||
UpdateSystemConfigRequest,
|
||||
UserPayConfig,
|
||||
CreateUserPayConfigRequest,
|
||||
UpdateUserPayConfigRequest,
|
||||
TaskMeta,
|
||||
TaskTypeResponse,
|
||||
DispatchTaskRequest,
|
||||
@@ -63,8 +60,9 @@ export class AdminService extends BaseService {
|
||||
* console.log('系统配置数量:', configs.length);
|
||||
* ```
|
||||
*/
|
||||
static async listSystemConfigs(): Promise<SystemConfig[]> {
|
||||
return this.get<SystemConfig[]>('/system-configs');
|
||||
static async listSystemConfigs(type?: 'system' | 'business'): Promise<SystemConfig[]> {
|
||||
const query = type ? `?type=${type}` : '';
|
||||
return this.get<SystemConfig[]>(`/system-configs${query}`);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,121 +125,7 @@ export class AdminService extends BaseService {
|
||||
return this.delete<void>(`/system-configs/${ key }`);
|
||||
}
|
||||
|
||||
// ==================== 用户积分配置管理 ====================
|
||||
|
||||
/**
|
||||
* 创建用户积分配置
|
||||
* @param request - 创建用户积分配置的请求参数
|
||||
* @returns 创建的用户积分配置
|
||||
* @throws {UnauthorizedError} 当未登录时
|
||||
* @throws {ForbiddenError} 当无管理员权限时
|
||||
* @throws {ValidationError} 当参数验证失败或等级已存在时
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const config = await AdminService.createUserPayConfig({
|
||||
* level: PayLevel.Premium,
|
||||
* min_score: 1000,
|
||||
* max_score: null,
|
||||
* daily_limit: 100000,
|
||||
* fee_rate: 0.01
|
||||
* });
|
||||
* console.log('配置ID:', config.id);
|
||||
* ```
|
||||
*
|
||||
* @remarks
|
||||
* - min_score 必须 >= 0
|
||||
* - max_score 必须大于 min_score(如果提供)
|
||||
* - fee_rate 必须在 0-1 之间,最多2位小数
|
||||
*/
|
||||
static async createUserPayConfig(
|
||||
request: CreateUserPayConfigRequest,
|
||||
): Promise<UserPayConfig> {
|
||||
return this.post<UserPayConfig>('/user-pay-configs', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户积分配置列表
|
||||
* @returns 用户积分配置列表(按最低分数升序排序)
|
||||
* @throws {UnauthorizedError} 当未登录时
|
||||
* @throws {ForbiddenError} 当无管理员权限时
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const configs = await AdminService.listUserPayConfigs();
|
||||
* console.log('积分配置数量:', configs.length);
|
||||
* ```
|
||||
*/
|
||||
static async listUserPayConfigs(): Promise<UserPayConfig[]> {
|
||||
return this.get<UserPayConfig[]>('/user-pay-configs');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个用户积分配置
|
||||
* @param id - 配置ID
|
||||
* @returns 用户积分配置信息
|
||||
* @throws {UnauthorizedError} 当未登录时
|
||||
* @throws {ForbiddenError} 当无管理员权限时
|
||||
* @throws {NotFoundError} 当配置不存在时
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const config = await AdminService.getUserPayConfig(123);
|
||||
* console.log('手续费率:', config.fee_rate);
|
||||
* ```
|
||||
*/
|
||||
static async getUserPayConfig(id: string): Promise<UserPayConfig> {
|
||||
return this.get<UserPayConfig>(`/user-pay-configs/${ id }`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户积分配置
|
||||
* @param id - 配置ID
|
||||
* @param request - 更新用户积分配置的请求参数
|
||||
* @returns void
|
||||
* @throws {UnauthorizedError} 当未登录时
|
||||
* @throws {ForbiddenError} 当无管理员权限时
|
||||
* @throws {NotFoundError} 当配置不存在时
|
||||
* @throws {ValidationError} 当参数验证失败时
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* await AdminService.updateUserPayConfig(123, {
|
||||
* min_score: 500,
|
||||
* max_score: 999,
|
||||
* daily_limit: 50000,
|
||||
* fee_rate: 0.02
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @remarks
|
||||
* - min_score 必须 >= 0
|
||||
* - max_score 必须大于 min_score(如果提供)
|
||||
* - fee_rate 必须在 0-1 之间,最多2位小数
|
||||
*/
|
||||
static async updateUserPayConfig(
|
||||
id: string,
|
||||
request: UpdateUserPayConfigRequest,
|
||||
): Promise<void> {
|
||||
return this.put<void>(`/user-pay-configs/${ id }`, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户积分配置
|
||||
* @param id - 配置ID
|
||||
* @returns void
|
||||
* @throws {UnauthorizedError} 当未登录时
|
||||
* @throws {ForbiddenError} 当无管理员权限时
|
||||
* @throws {NotFoundError} 当配置不存在时
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* await AdminService.deleteUserPayConfig(123);
|
||||
* ```
|
||||
*/
|
||||
static async deleteUserPayConfig(id: string): Promise<void> {
|
||||
return this.delete<void>(`/user-pay-configs/${ id }`);
|
||||
}
|
||||
|
||||
// ==================== 任务管理 ====================
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
* 管理员服务模块
|
||||
*
|
||||
* @description
|
||||
* 提供系统配置和用户积分配置管理功能,包括:
|
||||
* 提供系统配置、用户与任务管理功能,包括:
|
||||
* - 系统配置管理(创建、查询、更新、删除)
|
||||
* - 用户积分配置管理(创建、查询、更新、删除)
|
||||
* - 异步任务配置及下发
|
||||
* - 用户账号状态管理
|
||||
*
|
||||
* @remarks
|
||||
* 所有接口都需要管理员权限
|
||||
@@ -15,15 +16,6 @@
|
||||
*
|
||||
* // 获取系统配置列表
|
||||
* const configs = await AdminService.listSystemConfigs();
|
||||
*
|
||||
* // 创建用户积分配置
|
||||
* await AdminService.createUserPayConfig({
|
||||
* level: 1,
|
||||
* min_score: 0,
|
||||
* max_score: 999,
|
||||
* daily_limit: 10000,
|
||||
* fee_rate: 0.01
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
|
||||
@@ -32,9 +24,6 @@ export type {
|
||||
SystemConfig,
|
||||
CreateSystemConfigRequest,
|
||||
UpdateSystemConfigRequest,
|
||||
UserPayConfig,
|
||||
CreateUserPayConfigRequest,
|
||||
UpdateUserPayConfigRequest,
|
||||
TaskMeta,
|
||||
DispatchTaskRequest,
|
||||
AdminUser,
|
||||
@@ -42,4 +31,3 @@ export type {
|
||||
ListUsersResponse,
|
||||
UpdateUserStatusRequest,
|
||||
} from './types';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { PayLevel } from '@/lib/services/auth/types';
|
||||
|
||||
|
||||
/**
|
||||
* 系统配置信息
|
||||
@@ -8,6 +8,8 @@ export interface SystemConfig {
|
||||
key: string;
|
||||
/** 配置值 */
|
||||
value: string;
|
||||
/** 配置类型:'system' | 'business' */
|
||||
type: 'system' | 'business';
|
||||
/** 配置描述 */
|
||||
description: string;
|
||||
/** 创建时间 */
|
||||
@@ -24,6 +26,8 @@ export interface CreateSystemConfigRequest {
|
||||
key: string;
|
||||
/** 配置值(最大255字符) */
|
||||
value: string;
|
||||
/** 配置类型:'system' | 'business' */
|
||||
type: 'system' | 'business';
|
||||
/** 配置描述(最大255字符,可选) */
|
||||
description?: string;
|
||||
}
|
||||
@@ -38,69 +42,7 @@ export interface UpdateSystemConfigRequest {
|
||||
description?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户积分配置信息
|
||||
*/
|
||||
export interface UserPayConfig {
|
||||
/** 配置ID */
|
||||
id: string;
|
||||
/** 积分等级 */
|
||||
level: PayLevel;
|
||||
/** 最低分数 */
|
||||
min_score: number;
|
||||
/** 最高分数(可选) */
|
||||
max_score: number | null;
|
||||
/** 每日限额(可选) */
|
||||
daily_limit: number | null;
|
||||
/** 手续费率(0-1之间的小数,最多2位小数) */
|
||||
fee_rate: number | string;
|
||||
/** 积分费率(0-1之间的小数,最多2位小数) */
|
||||
score_rate: number | string;
|
||||
/** 分发费率(0-1之间的小数,最多2位小数) */
|
||||
distribute_rate: number | string;
|
||||
/** 创建时间 */
|
||||
created_at: string;
|
||||
/** 更新时间 */
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建用户积分配置请求参数
|
||||
*/
|
||||
export interface CreateUserPayConfigRequest {
|
||||
/** 积分等级 */
|
||||
level: PayLevel;
|
||||
/** 最低分数(必须 >= 0) */
|
||||
min_score: number;
|
||||
/** 最高分数(可选,必须大于 min_score) */
|
||||
max_score?: number | null;
|
||||
/** 每日限额(可选) */
|
||||
daily_limit?: number | null;
|
||||
/** 手续费率(0-1之间的小数,最多2位小数) */
|
||||
fee_rate: number | string;
|
||||
/** 积分费率(0-1之间的小数,最多2位小数) */
|
||||
score_rate: number | string;
|
||||
/** 分发费率(0-1之间的小数,最多2位小数) */
|
||||
distribute_rate: number | string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户积分配置请求参数
|
||||
*/
|
||||
export interface UpdateUserPayConfigRequest {
|
||||
/** 最低分数(必须 >= 0) */
|
||||
min_score: number;
|
||||
/** 最高分数(可选,必须大于 min_score) */
|
||||
max_score?: number | null;
|
||||
/** 每日限额(可选) */
|
||||
daily_limit?: number | null;
|
||||
/** 手续费率(0-1之间的小数,最多2位小数) */
|
||||
fee_rate: number | string;
|
||||
/** 积分费率(0-1之间的小数,最多2位小数) */
|
||||
score_rate: number | string;
|
||||
/** 分发费率(0-1之间的小数,最多2位小数) */
|
||||
distribute_rate: number | string;
|
||||
}
|
||||
|
||||
// ==================== 任务管理 ====================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user