mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-10 17:26:38 +08:00
压缩历史至 95081aff
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 用户服务模块
|
||||
*
|
||||
* @description
|
||||
* 提供用户个人设置相关的功能,包括:
|
||||
* - 更新支付密钥
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { UserService } from '@/lib/services';
|
||||
*
|
||||
* // 更新支付密钥
|
||||
* await UserService.updatePayKey('123456');
|
||||
* ```
|
||||
*/
|
||||
|
||||
export { UserService } from './user.service';
|
||||
export type { UpdatePayKeyRequest } from './types';
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* 更新支付密钥请求
|
||||
*/
|
||||
export interface UpdatePayKeyRequest {
|
||||
/** 新的支付密钥(6位数字) */
|
||||
pay_key: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { BaseService } from '../core/base.service';
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
* 处理用户个人设置相关的 API 请求
|
||||
*/
|
||||
export class UserService extends BaseService {
|
||||
protected static readonly basePath = '/api/v1/user';
|
||||
|
||||
/**
|
||||
* 更新用户支付密钥
|
||||
* @param payKey - 新的支付密钥
|
||||
* @returns void
|
||||
* @throws {UnauthorizedError} 当用户未登录时
|
||||
* @throws {ValidationError} 当支付密钥格式无效时
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* await UserService.updatePayKey('123456');
|
||||
* ```
|
||||
*
|
||||
* @remarks
|
||||
* - 支付密钥必须为6位数字
|
||||
* - 只能更新当前登录用户的支付密钥
|
||||
*/
|
||||
static async updatePayKey(payKey: string): Promise<void> {
|
||||
return this.put<void>('/pay-key', { pay_key: payKey });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user