门店账户多账号

This commit is contained in:
2026-07-12 12:24:34 +08:00
parent 06b1cb22e0
commit 54a15d6da7
39 changed files with 1962 additions and 311 deletions
@@ -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 },