lrf 2 vuotta sitten
vanhempi
commit
14c1c834ea
1 muutettua tiedostoa jossa 4 lisäystä ja 2 poistoa
  1. 4 2
      app/service/business/payOrder.js

+ 4 - 2
app/service/business/payOrder.js

@@ -43,7 +43,7 @@ class PayOrderService extends CrudService {
       // 不知道该去同步哪个表的支付状态,不处理
       return;
     }
-    const { from_id: _id, status: is_pay } = data;
+    const { from_id: _id, status: is_pay, money, _id: pay_id } = data;
     if (pay_for === 'lessonStudent') {
       // 因为上课产生的支付,去找lessonStudent,修改指定学生的支付状态
       await this.lessonStudentModel.updateOne({ _id }, { is_pay });
@@ -51,8 +51,10 @@ class PayOrderService extends CrudService {
       // 私教课临时上课,需要到临时申请那找到相关数据,再修改lessonStudent
       const tempApply = await this.tempLessonApplyModel.findById(_id);
       if (!tempApply) return;
+      tempApply.pay_id = pay_id;
+      await tempApply.save();
       const { lesson_id, student_id } = tempApply;
-      await this.lessonStudentModel.updateOne({ lesson_id, student_id }, { is_pay });
+      await this.lessonStudentModel.updateOne({ lesson_id, student_id }, { is_pay, pay_id, money });
     } else if (pay_for === 'charge') {
       // 充值
       await this.chargeModel.updateOne({ _id }, { is_pay });