@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user