BirdNETM | 8bcf85f | 2025-06-09 16:07:21 +0800 | [diff] [blame^] | 1 | // data.d.ts - 活动系统类型定义文件 |
| 2 | |
| 3 | // 活动类型枚举 |
| 4 | export type ActivityType = 'UPLOAD' | 'DOWNLOAD'; |
| 5 | |
| 6 | // 活动状态 |
| 7 | export type ActivityStatus = 0 | 1; // 0=已结束,1=进行中 |
| 8 | |
| 9 | // 活动信息 - 适配后端返回的字段 |
| 10 | export interface SysActivity { |
| 11 | createBy?: string | null; |
| 12 | createTime?: string | null; |
| 13 | updateBy?: string | null; |
| 14 | updateTime?: string | null; |
| 15 | remark?: string | null; |
| 16 | activityId: number; |
| 17 | activityName: string; |
| 18 | rewardBonus: number; |
| 19 | conditionValue: string; // 上传:如"10GB",下载:torrent_id |
| 20 | startTime: string; // ISO 8601 格式:2025-06-01T00:00:00.000+08:00 |
| 21 | endTime: string; // ISO 8601 格式:2025-06-30T23:59:59.000+08:00 |
| 22 | status: ActivityStatus; |
| 23 | activityType: ActivityType; |
| 24 | } |
| 25 | |
| 26 | // 活动记录 |
| 27 | export interface SysActivityRecord { |
| 28 | recordId: number; |
| 29 | activityId: number; |
| 30 | userId: number; |
| 31 | rewardBonus: number; |
| 32 | completeTime: string; |
| 33 | } |
| 34 | |
| 35 | // 排行榜条目 |
| 36 | export interface LeaderboardEntry { |
| 37 | userId: number; |
| 38 | userName: string; |
| 39 | score: number; |
| 40 | } |
| 41 | |
| 42 | // 后端实际返回的活动列表响应格式 |
| 43 | export interface GetActivityListResponse { |
| 44 | total: number; |
| 45 | rows: SysActivity[]; |
| 46 | code: number; |
| 47 | msg: string; |
| 48 | } |
| 49 | |
| 50 | // 获取排行榜响应 - 假设也遵循相同格式 |
| 51 | export interface GetLeaderboardResponse { |
| 52 | total: number; |
| 53 | rows: LeaderboardEntry[]; |
| 54 | code: number; |
| 55 | msg: string; |
| 56 | } |
| 57 | |
| 58 | // 参与活动响应 |
| 59 | export interface ParticipateActivityResponse { |
| 60 | code: number; |
| 61 | msg: string; |
| 62 | data?: any; |
| 63 | } |
| 64 | |
| 65 | // 活动列表查询参数 |
| 66 | export interface ActivityListParams { |
| 67 | pageNum?: number; |
| 68 | pageSize?: number; |
| 69 | activityName?: string; |
| 70 | activityType?: ActivityType; |
| 71 | status?: ActivityStatus; |
| 72 | } |
| 73 | |
| 74 | // 排行榜查询参数 |
| 75 | export interface LeaderboardParams { |
| 76 | pageNum?: number; |
| 77 | pageSize?: number; |
| 78 | } |
| 79 | |
| 80 | // 前端组件使用的标准化数据格式(保持原有格式以减少组件改动) |
| 81 | export interface StandardizedActivityListResponse { |
| 82 | code: number; |
| 83 | msg: string; |
| 84 | data: { |
| 85 | list: SysActivity[]; |
| 86 | total: number; |
| 87 | pageSize: number; |
| 88 | current: number; |
| 89 | }; |
| 90 | } |
| 91 | |
| 92 | export interface StandardizedLeaderboardResponse { |
| 93 | code: number; |
| 94 | msg: string; |
| 95 | data: { |
| 96 | list: LeaderboardEntry[]; |
| 97 | total: number; |
| 98 | pageSize: number; |
| 99 | current: number; |
| 100 | }; |
| 101 | } |