代下单功能
This commit is contained in:
@@ -16,6 +16,9 @@ function mapAdminUserRow(u: {
|
||||
wxOpenId: string | null;
|
||||
nickname: string | null;
|
||||
status: number;
|
||||
sourceType: string;
|
||||
sourceRefId: bigint | null;
|
||||
sourceLabel: string | null;
|
||||
createdAt: Date;
|
||||
updatedAt: Date;
|
||||
_count: { orders: number };
|
||||
@@ -31,6 +34,9 @@ function mapAdminUserRow(u: {
|
||||
wechatVerified: !!u.wxOpenId,
|
||||
nickname: u.nickname,
|
||||
status: u.status,
|
||||
sourceType: u.sourceType,
|
||||
sourceRefId: u.sourceRefId,
|
||||
sourceLabel: u.sourceLabel,
|
||||
createdAt: u.createdAt,
|
||||
updatedAt: u.updatedAt,
|
||||
orderCount: u._count.orders,
|
||||
@@ -69,6 +75,9 @@ export class AdminUsersService {
|
||||
wxOpenId: true,
|
||||
nickname: true,
|
||||
status: true,
|
||||
sourceType: true,
|
||||
sourceRefId: true,
|
||||
sourceLabel: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
_count: { select: { orders: true } },
|
||||
@@ -107,12 +116,21 @@ export class AdminUsersService {
|
||||
});
|
||||
if (!user) throw new NotFoundException('用户不存在');
|
||||
|
||||
let sourcePromo: { id: bigint; code: string; name: string } | null = null;
|
||||
if (user.sourceType === 'PROMO_CODE' && user.sourceRefId) {
|
||||
sourcePromo = await this.prisma.commonPromoCode.findUnique({
|
||||
where: { id: user.sourceRefId },
|
||||
select: { id: true, code: true, name: true },
|
||||
});
|
||||
}
|
||||
|
||||
return serializeBigInt({
|
||||
...user,
|
||||
wechatVerified: !!user.wxOpenId,
|
||||
mergedFromCount: user._count.mergedFrom,
|
||||
orderCount: user._count.orders,
|
||||
addressCount: user._count.addresses,
|
||||
sourcePromo,
|
||||
_count: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user