feat(ops): v4.0.2 活动图模板、合伙人选择持久化与用户管理主图

HQ 上传底图与码栏;合伙人单选写入 partner_account.activity_poster_id,用户管理下次登录仍显示同一张图。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-30 21:36:43 +08:00
parent 0ff61c2cd1
commit 3166467518
39 changed files with 1872 additions and 35 deletions
@@ -136,15 +136,51 @@ export class PartnerAssocService {
const userCount = await this.prisma.user.count({
where: { assocPartnerAccountId: primary.id },
});
const selectedPoster = primary.activityPosterId
? await this.prisma.activityPoster.findUnique({
where: { id: primary.activityPosterId },
select: { id: true, status: true },
})
: null;
const activityPosterId =
selectedPoster?.status === 'ACTIVE' ? selectedPoster.id.toString() : null;
return {
partnerId: primary.id.toString(),
qrcodeUrl: ensured.qrcodeUrl,
userCount,
companyName: primary.companyName,
name: primary.name,
activityPosterId,
};
}
async getSelectedActivityPosterId(partnerAccountId: bigint): Promise<string | null> {
const primary = await this.partnerCityService.resolvePrimaryAccount(partnerAccountId);
if (!primary.activityPosterId) return null;
const poster = await this.prisma.activityPoster.findUnique({
where: { id: primary.activityPosterId },
select: { id: true, status: true },
});
return poster?.status === 'ACTIVE' ? poster.id.toString() : null;
}
async setSelectedActivityPoster(partnerAccountId: bigint, posterId: bigint | null) {
const primary = await this.partnerCityService.resolvePrimaryAccount(partnerAccountId);
if (posterId) {
const poster = await this.prisma.activityPoster.findFirst({
where: { id: posterId, status: 'ACTIVE' },
select: { id: true },
});
if (!poster) throw new BadRequestException('活动图不存在或已下架');
}
await this.prisma.partnerAccount.update({
where: { id: primary.id },
data: { activityPosterId: posterId },
});
return { posterId: posterId?.toString() ?? null };
}
async getStats(partnerAccountId: bigint) {
const primary = await this.partnerCityService.resolvePrimaryAccount(partnerAccountId);
const { todayStart, monthStart } = dayBounds();