mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-11 17:56:37 +08:00
压缩历史至 95081aff
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { BaseService } from '../core/base.service';
|
||||
import type { PublicConfigResponse } from './types';
|
||||
import type { UserPayConfig } from '../admin/types';
|
||||
|
||||
/**
|
||||
* 配置服务
|
||||
* 处理系统公共配置相关的 API 请求
|
||||
*/
|
||||
export class ConfigService extends BaseService {
|
||||
protected static readonly basePath = '/api/v1/config';
|
||||
|
||||
/**
|
||||
* 获取公共配置
|
||||
* @returns 公共配置信息
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const config = await ConfigService.getPublicConfig();
|
||||
* console.log('争议时间窗口:', config.dispute_time_window_hours, '小时');
|
||||
* ```
|
||||
*/
|
||||
static async getPublicConfig(): Promise<PublicConfigResponse> {
|
||||
return this.get<PublicConfigResponse>('/public');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户平台等级配置(公开接口)
|
||||
* 返回所有平台等级的配置信息,用于向用户展示不同等级的权益
|
||||
*
|
||||
* @returns 用户支付配置列表
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* const payConfigs = await ConfigService.getUserPayConfigs();
|
||||
* payConfigs.forEach(config => {
|
||||
* console.log(`等级 ${config.level}: 手续费率 ${config.fee_rate}, 每日限额 ${config.daily_limit}`);
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
static async getUserPayConfigs(): Promise<UserPayConfig[]> {
|
||||
return this.get<UserPayConfig[]>('/user-pay');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 配置服务模块
|
||||
*
|
||||
* @description
|
||||
* 提供系统公共配置相关的功能,包括:
|
||||
* - 获取公共配置(争议时间窗口等)
|
||||
* - 获取用户平台等级配置(公开接口)
|
||||
*
|
||||
* @example
|
||||
* ```typescript
|
||||
* import { ConfigService } from '@/lib/services';
|
||||
*
|
||||
* // 获取公共配置
|
||||
* const config = await ConfigService.getPublicConfig();
|
||||
* console.log('争议时间窗口:', config.dispute_time_window_hours, '小时');
|
||||
*
|
||||
* // 获取用户平台等级配置
|
||||
* const payConfigs = await ConfigService.getUserPayConfigs();
|
||||
* console.log('平台等级列表:', payConfigs);
|
||||
* ```
|
||||
*/
|
||||
|
||||
export { ConfigService } from './config.service';
|
||||
export type * from './types';
|
||||
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 公共配置响应
|
||||
*/
|
||||
export interface PublicConfigResponse {
|
||||
/** 争议时间窗口(小时) */
|
||||
dispute_time_window_hours: number;
|
||||
/** 红包功能是否启用 */
|
||||
red_envelope_enabled: boolean;
|
||||
/** 单个红包的最大积分上限 */
|
||||
red_envelope_max_amount: string;
|
||||
/** 每日发红包的个数限制 */
|
||||
red_envelope_daily_limit: number;
|
||||
/** 红包手续费率(0-1之间的小数) */
|
||||
red_envelope_fee_rate: string;
|
||||
/** 每个红包的最大可领取人数上限 */
|
||||
red_envelope_max_recipients: number;
|
||||
/** 到账最短时间 **/
|
||||
settlement_delay_days_min: number;
|
||||
/** 到账最长时间 **/
|
||||
settlement_delay_days_max: number;
|
||||
}
|
||||
Reference in New Issue
Block a user