Commit dca4c80d authored by 姜登's avatar 姜登

增加attribute

parent a11644bf
Pipeline #17483 passed with stage
in 5 seconds
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: jd * @Author: jd
* @Date: 2019-02-25 18:59:53 * @Date: 2019-02-25 18:59:53
* @LastEditors: jd * @LastEditors: jd
* @LastEditTime: 2019-11-27 16:47:01 * @LastEditTime: 2019-11-27 17:07:39
*/ */
'use strict'; 'use strict';
...@@ -34,6 +34,7 @@ class CacheService extends Service { ...@@ -34,6 +34,7 @@ class CacheService extends Service {
} }
const order = await ctx.model.TaskStatus.findOne({ const order = await ctx.model.TaskStatus.findOne({
attributes: ['id', 'status'],
where: { taskId: key }, where: { taskId: key },
}); });
if (order && order.status !== 'success') { if (order && order.status !== 'success') {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @Author: jd * @Author: jd
* @Date: 2019-02-25 18:59:53 * @Date: 2019-02-25 18:59:53
* @LastEditors: jd * @LastEditors: jd
* @LastEditTime: 2019-11-27 16:40:19 * @LastEditTime: 2019-11-27 17:47:04
*/ */
'use strict'; 'use strict';
...@@ -14,6 +14,7 @@ class OrderService extends Service { ...@@ -14,6 +14,7 @@ class OrderService extends Service {
async getOneByOrderId(params) { async getOneByOrderId(params) {
const { ctx } = this; const { ctx } = this;
const order = await ctx.model.TaskStatus.findOne({ const order = await ctx.model.TaskStatus.findOne({
attributes: ['id', 'order'],
where: params, where: params,
}); });
return order; return order;
...@@ -35,6 +36,7 @@ class OrderService extends Service { ...@@ -35,6 +36,7 @@ class OrderService extends Service {
async update(params) { async update(params) {
const { ctx } = this; const { ctx } = this;
const order = await ctx.model.TaskStatus.findAll({ const order = await ctx.model.TaskStatus.findAll({
attributes: ['id', 'status'],
where: { orderId: params.orderId }, where: { orderId: params.orderId },
order: [['createDate', 'DESC']], order: [['createDate', 'DESC']],
}); });
...@@ -55,6 +57,7 @@ class OrderService extends Service { ...@@ -55,6 +57,7 @@ class OrderService extends Service {
await order[0].update(params); await order[0].update(params);
} }
await ctx.nodemodel.GjjStatus.findOrCreate({ await ctx.nodemodel.GjjStatus.findOrCreate({
attributes: ['id'],
where: { where: {
orderId: params.orderId, orderId: params.orderId,
}, },
......
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