feat: harden CMPP delivery and platform workflows

This commit is contained in:
hectorzhao
2026-07-20 18:07:29 +08:00
parent 80fb5a8f53
commit f02c33cbb7
61 changed files with 1834 additions and 281 deletions
@@ -1,5 +1,6 @@
import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { CurrentSessionUserId } from '../auth/current-session-user.decorator';
import { SendChainService } from '../send-chain/send-chain.service';
import {
BatchReviewSmsTasksDto,
@@ -39,15 +40,16 @@ export class AdminRiskReviewController {
}
@Post('tasks/:id/approve')
async approveTask(@Param('id') taskId: string, @Body() body: ReviewSmsTaskDto) {
const task = await this.riskReview.approveTask(taskId, body);
async approveTask(@Param('id') taskId: string, @Body() body: ReviewSmsTaskDto, @CurrentSessionUserId() reviewerId?: string) {
const review = { ...body, reviewerId };
const task = await this.riskReview.approveTask(taskId, review);
await this.sendChain.handleReviewDecision(taskId, 'approved', body.reason ?? '运营审核通过');
return task;
}
@Post('tasks/batch/reject')
async rejectTasks(@Body() body: BatchReviewSmsTasksDto) {
const tasks = await this.riskReview.rejectTasks(body);
async rejectTasks(@Body() body: BatchReviewSmsTasksDto, @CurrentSessionUserId() reviewerId?: string) {
const tasks = await this.riskReview.rejectTasks({ ...body, reviewerId });
const reason = body.reason?.trim() ?? '';
for (const task of tasks) {
await this.sendChain.handleReviewDecision(task.id, 'rejected', reason);
@@ -56,8 +58,8 @@ export class AdminRiskReviewController {
}
@Post('tasks/:id/reject')
async rejectTask(@Param('id') taskId: string, @Body() body: ReviewSmsTaskDto) {
const task = await this.riskReview.rejectTask(taskId, body);
async rejectTask(@Param('id') taskId: string, @Body() body: ReviewSmsTaskDto, @CurrentSessionUserId() reviewerId?: string) {
const task = await this.riskReview.rejectTask(taskId, { ...body, reviewerId });
await this.sendChain.handleReviewDecision(taskId, 'rejected', body.reason ?? task.rejectReason ?? '运营审核驳回');
return task;
}