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

@@ -40,6 +40,7 @@ import { LoginCoreService } from '../../core/login_core/login_core.service';
import { ZulipAccountsService } from '../../core/db/zulip_accounts/zulip_accounts.service';
import { ZulipAccountsMemoryService } from '../../core/db/zulip_accounts/zulip_accounts_memory.service';
import { AccountProfileService } from '../auth/account_profile.service';
import { TaskService } from '../tasks/task.service';
// ========== 接口定义 ==========
@@ -262,6 +263,7 @@ export class ChatService {
@Inject('ZulipAccountsService')
private readonly zulipAccountsService: ZulipAccountsService | ZulipAccountsMemoryService,
private readonly accountProfileService: AccountProfileService,
private readonly taskService: TaskService,
) {
this.logger.log('ChatService初始化完成');
}
@@ -445,6 +447,11 @@ export class ChatService {
.catch(e => this.logger.warn('Zulip同步失败', { error: (e as Error).message }));
}
if (normalizedScope === 'global') {
await this.taskService.recordActivity(BigInt(session.userId), 'public_message_sent')
.catch((error: unknown) => this.logger.warn('记录公共聊天任务失败', { error: error instanceof Error ? error.message : String(error) }));
}
this.logger.log('聊天消息发送完成', {
operation: 'sendChatMessage',
messageId,