admin web 修改订单状态

This commit is contained in:
2026-07-01 22:00:10 +08:00
parent 139e37651b
commit 8a67d72de4
5 changed files with 70 additions and 20 deletions
@@ -4,11 +4,15 @@ import { PrismaService } from '../../common/prisma/prisma.module';
import { serializeBigInt } from '../../common/decorators/current-user.decorator';
import { orderStatusLogWhere } from '../../common/event/event.helpers';
import { mapOrderCompat, mapStatusLogCompat } from '../../common/compat/v31-compat';
import { TradeService } from '../trade/trade.service';
import type { AdminOrdersQueryDto } from './dto/admin-query.dto';
@Injectable()
export class AdminOrdersService {
constructor(private readonly prisma: PrismaService) {}
constructor(
private readonly prisma: PrismaService,
private readonly tradeService: TradeService,
) {}
async list(query: AdminOrdersQueryDto) {
const page = query.page ?? 1;
@@ -76,4 +80,11 @@ export class AdminOrdersService {
benefitCoupons: order.benefitCoupon ? [order.benefitCoupon] : [],
}));
}
async updateStatusDebug(id: bigint, status: string) {
const order = await this.prisma.order.findUnique({ where: { id } });
if (!order) throw new NotFoundException('订单不存在');
await this.tradeService.applyStatusTransition(id, order.status, status, 'HQ_DEBUG');
return this.detail(id);
}
}