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

This commit is contained in:
2026-08-19 15:54:51 +08:00
parent 7dd5fdfb12
commit 233ed0af3b
103 changed files with 5764 additions and 185 deletions
@@ -20,6 +20,12 @@ export class AdminOrdersController {
return this.ordersService.list(query);
}
/** 必须写在 :id 之前,否则 big-screen 会被当成订单 ID */
@Get('big-screen')
bigScreen(@Query('limit') limit?: string) {
return this.ordersService.listBigScreen(limit);
}
@Post('batch-delete')
@UseGuards(HqPermissionGuard)
@RequireHqPermissions('orders_delete')
@@ -1,3 +1,4 @@
import { maskContactPhone } from '@dukang/domain';
import { BadRequestException, Injectable, NotFoundException } from '@nestjs/common';
import { Prisma } from '@prisma/client';
import { PrismaService } from '../../common/prisma/prisma.module';
@@ -24,6 +25,34 @@ export class AdminOrdersService {
private readonly adminRedeemService: AdminRedeemService,
) {}
/** v3.5.1 #1:发布会大屏,返回全部订单(按时间倒序,上限 2000) */
async listBigScreen(limit?: string) {
const take = Math.min(Math.max(Number(limit) || 2000, 1), 2000);
const orders = await this.prisma.order.findMany({
where: {
isTest: false,
payAmount: { gte: 100 },
},
orderBy: { createdAt: 'desc' },
take,
include: { user: { select: { phone: true } } },
});
return {
items: orders.map((o) => {
const spec = o.productSpec ? ` ${o.productSpec}` : '';
const phone = o.user?.phone || o.receiverPhone;
return {
id: o.id.toString(),
orderNo: o.orderNo,
payAmount: Number(o.payAmount),
items: `${o.productName}${spec} × ${o.quantity}`,
createdAt: o.createdAt.toISOString(),
userPhoneMasked: phone ? maskContactPhone(phone) : null,
};
}),
};
}
async list(query: AdminOrdersQueryDto) {
const page = query.page ?? 1;
const pageSize = query.pageSize ?? 20;
@@ -96,12 +96,22 @@ export class AdminStoresService {
// 每家店是否有待审核套餐变更,供总部列表「审核套餐 / 对比」快捷入口使用
const pendingByStore = new Map<string, string>();
// 每家店是否有待审核信息变更,供总部列表「审核信息 / 对比」快捷入口使用
const pendingInfoByStore = new Map<string, string>();
if (items.length) {
const pendingReqs = await this.prisma.storePackageChangeRequest.findMany({
where: { storeId: { in: items.map((s) => s.id) }, status: 'PENDING' },
select: { id: true, storeId: true },
});
const storeIds = items.map((s) => s.id);
const [pendingReqs, pendingInfoReqs] = await Promise.all([
this.prisma.storePackageChangeRequest.findMany({
where: { storeId: { in: storeIds }, status: 'PENDING' },
select: { id: true, storeId: true },
}),
this.prisma.storeInfoChangeRequest.findMany({
where: { storeId: { in: storeIds }, status: 'PENDING' },
select: { id: true, storeId: true },
}),
]);
for (const r of pendingReqs) pendingByStore.set(r.storeId.toString(), r.id.toString());
for (const r of pendingInfoReqs) pendingInfoByStore.set(r.storeId.toString(), r.id.toString());
}
return serializeBigInt({
@@ -113,6 +123,7 @@ export class AdminStoresService {
visibilityPhones: visibilityPhones.map((p) => p.phone),
// 透传:mapStoreCompat 为 { ...store } 展开,新字段不会被丢弃
pendingPackageAuditId: pendingByStore.get(s.id.toString()) ?? null,
pendingInfoChangeId: pendingInfoByStore.get(s.id.toString()) ?? null,
partner: s.partnerAccount,
account: s.bindings[0]?.storeAccount ?? null,
bindings: undefined,