v3.5.3版本更新2
CI / verify (pull_request) Has been cancelled

This commit is contained in:
2026-08-20 20:09:05 +08:00
parent fc2e5b65de
commit 26334ed072
26 changed files with 1238 additions and 117 deletions
@@ -0,0 +1,69 @@
import {
BadRequestException,
Body,
Controller,
Get,
Param,
Post,
Put,
UseGuards,
} from '@nestjs/common';
import type { UpdateWecomPushTemplateRequest } from '@dukang/shared-types';
import { HqAuthGuard } from '../../common/guards/hq-auth.guard';
import {
HqPermissionGuard,
RequireHqPermissions,
} from '../../common/guards/hq-permission.guard';
import { HqOperation } from '../../common/hq-operation/hq-operation.decorator';
import { HqOperationAction } from '../../common/hq-operation/hq-operation.constants';
import { WecomMessagePushService } from '../../integrations/wecom/wecom-message-push.service';
@Controller('admin/wecom-push-templates')
@UseGuards(HqAuthGuard, HqPermissionGuard)
@RequireHqPermissions('wecom_bots')
export class AdminWecomPushTemplatesController {
constructor(private readonly wecomPush: WecomMessagePushService) {}
@Get()
list() {
return this.wecomPush.listTemplates();
}
@Get(':eventKey')
detail(@Param('eventKey') eventKey: string) {
return this.wecomPush.getTemplate(eventKey);
}
@Put(':eventKey')
@HqOperation({
action: HqOperationAction.WECOM_MESSAGE_PUSH_UPDATE,
refType: 'WECOM_PUSH_TEMPLATE',
refIdField: 'eventKey',
includeBody: true,
})
update(@Param('eventKey') eventKey: string, @Body() body: UpdateWecomPushTemplateRequest) {
return this.wecomPush.updateTemplate(eventKey, body);
}
@Post(':eventKey/reset')
@HqOperation({
action: HqOperationAction.WECOM_MESSAGE_PUSH_UPDATE,
refType: 'WECOM_PUSH_TEMPLATE',
refIdField: 'eventKey',
})
reset(@Param('eventKey') eventKey: string) {
return this.wecomPush.resetTemplate(eventKey);
}
@Post(':eventKey/test')
@HqOperation({
action: HqOperationAction.WECOM_MESSAGE_PUSH_TEST,
refType: 'WECOM_PUSH_TEMPLATE',
refIdField: 'eventKey',
})
async test(@Param('eventKey') eventKey: string) {
const result = await this.wecomPush.testTemplate(eventKey);
if (!result.ok) throw new BadRequestException(result.message);
return result;
}
}