支付通路
This commit is contained in:
1 parent
c7f43e30a9
commit
85b0e70907
26 files changed
+1324
-74
No files matched your search
@@ -7,6 +7,8 @@ import { OrdersService } from './orders.service';
|
||||
const createSchema = z.object({
|
||||
courseCode: z.string().min(1),
|
||||
quantity: z.coerce.number().int().min(1).max(10).optional(),
|
||||
/** 下单设备,小程序上报;缺省不影响下单,只是后台看不到渠道 */
|
||||
terminal: z.string().max(16).optional(),
|
||||
});
|
||||
|
||||
@Controller('v1/orders')
|
||||
@@ -17,7 +19,12 @@ export class OrdersController {
|
||||
create(@CurrentUser() user: AuthPrincipal, @Body() body: unknown) {
|
||||
const parsed = createSchema.safeParse(body);
|
||||
if (!parsed.success) throw AppError.badRequest('参数错误:缺少 courseCode');
|
||||
return this.orders.create(user.id, parsed.data.courseCode, parsed.data.quantity ?? 1);
|
||||
return this.orders.create(
|
||||
user.id,
|
||||
parsed.data.courseCode,
|
||||
parsed.data.quantity ?? 1,
|
||||
parsed.data.terminal ?? null,
|
||||
);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@@ -30,4 +37,3 @@ export class OrdersController {
|
||||
return this.orders.status(user.id, outTradeNo);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user