门店账户多账号
This commit is contained in:
@@ -131,11 +131,13 @@ export class AdminStoreLogsService {
|
||||
if (query.phone) accountWhere.phone = { contains: query.phone };
|
||||
const accounts = await this.prisma.storeAccount.findMany({
|
||||
where: accountWhere,
|
||||
select: { storeId: true },
|
||||
select: {
|
||||
bindings: { select: { storeId: true } },
|
||||
},
|
||||
take: 100,
|
||||
});
|
||||
if (accounts.length === 0) return [];
|
||||
const ids = [...new Set(accounts.map((a) => a.storeId))];
|
||||
const ids = [...new Set(accounts.flatMap((a) => a.bindings.map((b) => b.storeId)))];
|
||||
if (storeWhere.name) {
|
||||
const stores = await this.prisma.store.findMany({
|
||||
where: { id: { in: ids }, ...storeWhere },
|
||||
|
||||
Reference in New Issue
Block a user