feat(ops): v4.0.7 HQ 活动图快链与勾选导出

HQ 指定一张活动图为勾选主合伙人合成 PNG/zip;城市合伙人页增加快链与单下/导出。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-01 15:12:10 +08:00
parent eeee55e215
commit cdc4b82931
21 changed files with 1041 additions and 28 deletions
@@ -1,10 +1,12 @@
import { Body, Controller, Delete, Get, Param, Post, Put, Query, UseGuards } from '@nestjs/common';
import { Body, Controller, Delete, Get, Param, Post, Put, Query, Res, UseGuards, BadRequestException } from '@nestjs/common';
import type { Response } from 'express';
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 { ActivityPosterService } from './activity-poster.service';
import {
ActivityPosterPackDto,
ActivityPosterQueryDto,
UpdateActivityPosterStatusDto,
UpsertActivityPosterDto,
@@ -21,6 +23,36 @@ export class AdminActivityPostersController {
return this.service.adminList(query);
}
@Get(':id/image')
async image(
@Param('id') id: string,
@Query('partnerId') partnerId: string,
@Res() res: Response,
) {
if (!partnerId || !/^\d+$/.test(partnerId.trim())) {
throw new BadRequestException('请指定合伙人');
}
const { buffer, fileName } = await this.service.composeForHqPartner(BigInt(partnerId.trim()), BigInt(id));
res.setHeader('Content-Type', 'image/png');
res.setHeader(
'Content-Disposition',
`attachment; filename="activity-poster.png"; filename*=UTF-8''${encodeURIComponent(fileName)}`,
);
res.send(buffer);
}
@Post(':id/partner-pack')
@HqOperation({
action: HqOperationAction.ACTIVITY_POSTER_PACK,
refType: 'ACTIVITY_POSTER',
refIdParam: 'id',
includeBody: true,
includeResponse: false,
})
async pack(@Param('id') id: string, @Body() dto: ActivityPosterPackDto, @Res() res: Response) {
await this.service.packForPartners(BigInt(id), dto.partnerIds, res);
}
@Get(':id')
detail(@Param('id') id: string) {
return this.service.adminDetail(BigInt(id));