Commit c80f5038 authored by 姜登's avatar 姜登

订单号创建修改

parent 9057aa8e
Pipeline #3998 passed with stage
in 55 seconds
...@@ -7,7 +7,13 @@ class OrderController extends Controller { ...@@ -7,7 +7,13 @@ class OrderController extends Controller {
super(ctx); super(ctx);
this.createRule = { this.createRule = {
appKey: 'string', 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 = { this.showRule = {
...@@ -28,8 +34,8 @@ class OrderController extends Controller { ...@@ -28,8 +34,8 @@ class OrderController extends Controller {
const { ctx, service } = this; const { ctx, service } = this;
const uuid = require('node-uuid'); const uuid = require('node-uuid');
ctx.validate(this.createRule); ctx.validate(this.createRule);
const { appKey, userId, notifyUrl, backUrl } = ctx.request.body; let { appKey, userId, notifyUrl, backUrl, orderId } = ctx.request.body;
const orderId = uuid.v1(); orderId = orderId || uuid.v1();
await service.order.create({ await service.order.create({
orderId, orderId,
taskId: '', 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