webadmin端

批量删除用户
模板上传图片数量限制改成30
小飞侠接口配置
This commit is contained in:
2026-07-06 18:04:02 +08:00
parent 4e18763968
commit f0b99ea9da
17 changed files with 1172 additions and 49 deletions
@@ -0,0 +1,45 @@
import { Injectable, NotFoundException } from '@nestjs/common';
import { PrismaService } from '../../common/prisma/prisma.module';
import { RedeemService } from '../redeem/redeem.service';
import type {
AdminRedeemDebugCreateTokenDto,
AdminRedeemDebugStoreTokenDto,
} from './dto/admin-mutate.dto';
@Injectable()
export class AdminRedeemDebugService {
constructor(
private readonly prisma: PrismaService,
private readonly redeemService: RedeemService,
) {}
private async resolveStoreAccountId(storeId: string): Promise<bigint> {
const account = await this.prisma.storeAccount.findFirst({
where: { storeId: BigInt(storeId), status: 'ACTIVE' },
orderBy: { id: 'asc' },
select: { id: true, store: { select: { name: true } } },
});
if (!account) {
throw new NotFoundException('该门店无可用账户,请先创建门店账户');
}
return account.id;
}
async createToken(dto: AdminRedeemDebugCreateTokenDto) {
return this.redeemService.createToken(BigInt(dto.userId), {
amount: dto.amount,
couponId: dto.couponId,
storeId: dto.storeId,
});
}
async preview(dto: AdminRedeemDebugStoreTokenDto) {
const storeAccountId = await this.resolveStoreAccountId(dto.storeId);
return this.redeemService.previewRedeem(storeAccountId, dto.token);
}
async confirm(dto: AdminRedeemDebugStoreTokenDto) {
const storeAccountId = await this.resolveStoreAccountId(dto.storeId);
return this.redeemService.confirmRedeem(storeAccountId, { token: dto.token });
}
}