Commit c80f5038 authored by 姜登's avatar 姜登

订单号创建修改

parent 9057aa8e
Pipeline #3998 passed with stage
in 55 seconds
......@@ -7,7 +7,13 @@ class OrderController extends Controller {
super(ctx);
this.createRule = {
appKey: 'string',
userId: 'string'
userId: 'string',
orderId: {
type: 'string',
required: false,
format: /^(\w{8})-(\w{4})-(\w{4})-(\w{4})-(\w{12})$/,
message: '订单号格式错误',
}
};
this.showRule = {
......@@ -28,8 +34,8 @@ class OrderController extends Controller {
const { ctx, service } = this;
const uuid = require('node-uuid');
ctx.validate(this.createRule);
const { appKey, userId, notifyUrl, backUrl } = ctx.request.body;
const orderId = uuid.v1();
let { appKey, userId, notifyUrl, backUrl, orderId } = ctx.request.body;
orderId = orderId || uuid.v1();
await service.order.create({
orderId,
taskId: '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment