feat: add task reward economy APIs

This commit is contained in:
ANG-Server
2026-07-22 00:45:59 +08:00
parent 9119737f11
commit fe52ab1696
14 changed files with 824 additions and 2 deletions

View File

@@ -0,0 +1,36 @@
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
@Entity('player_task_progress')
@Index('uq_player_task_progress_task_cycle', ['user_id', 'task_id', 'cycle_key'], { unique: true })
@Index('idx_player_task_progress_user_cycle', ['user_id', 'cycle_key'])
export class PlayerTaskProgress {
@PrimaryGeneratedColumn({ type: 'bigint', comment: '主键ID' })
id: bigint;
@Column({ type: 'bigint', nullable: false, comment: '关联users.id' })
user_id: bigint;
@Column({ type: 'varchar', length: 80, nullable: false, comment: '静态任务ID' })
task_id: string;
@Column({ type: 'varchar', length: 32, nullable: false, comment: '任务周期键' })
cycle_key: string;
@Column({ type: 'int', nullable: false, default: 0, comment: '当前进度' })
progress: number;
@Column({ type: 'json', nullable: false, comment: '去重活动目标等状态' })
activity_state: Record<string, unknown>;
@Column({ type: 'timestamp', nullable: true, comment: '完成时间' })
completed_at: Date | null;
@Column({ type: 'timestamp', nullable: true, comment: '领奖时间' })
claimed_at: Date | null;
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', comment: '创建时间' })
created_at: Date;
@Column({ type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP', comment: '更新时间' })
updated_at: Date;
}