lrf 2 years ago
parent
commit
8161f59af3
1 changed files with 7 additions and 4 deletions
  1. 7 4
      app/service/trade/orderDetail.js

+ 7 - 4
app/service/trade/orderDetail.js

@@ -250,10 +250,13 @@ class OrderDetailService extends CrudService {
     if (!entity) throw new BusinessError(ErrorCode.DATA_NOT_EXIST);
     try {
       this.tran.update('OrderDetail', filter._id, update);
-      // 积分部分
-      await this.ctx.service.user.point.addPoints(filter._id, this.tran);
-      // 返现部分
-      await this.ctx.service.user.cashBack.create(filter._id, this.tran);
+      if (_.get(update, 'status') === '3') {
+        // 积分部分
+        await this.ctx.service.user.point.addPoints(filter._id, this.tran);
+        // 返现部分
+        await this.ctx.service.user.cashBack.create(filter._id, this.tran);
+      }
+
       await this.tran.run();
       const e = await this.model.findOne(filter, projection).exec();
       return e;