فهرست منبع

支付订单同步修改充值记录

lrf 2 سال پیش
والد
کامیت
716c2409f6
1فایلهای تغییر یافته به همراه5 افزوده شده و 3 حذف شده
  1. 5 3
      app/service/business/payOrder.js

+ 5 - 3
app/service/business/payOrder.js

@@ -11,6 +11,7 @@ class PayOrderService extends CrudService {
     this.model = this.ctx.model.Business.PayOrder;
     this.payService = this.ctx.service.wxpay;
     this.lessonStudentModel = this.ctx.model.Business.LessonStudent;
+    this.chargeModel = this.ctx.model.Business.Charge;
     this.tempLessonApplyModel = this.ctx.model.Apply.TempLessonApply;
     this.userModel = this.ctx.model.User.User;
     this.studentModel = this.ctx.model.User.Student;
@@ -45,15 +46,16 @@ class PayOrderService extends CrudService {
     const { from_id: _id, status: is_pay } = data;
     if (pay_for === 'lessonStudent') {
       // 因为上课产生的支付,去找lessonStudent,修改指定学生的支付状态
-      console.log(is_pay, _id);
-      const r = await this.lessonStudentModel.updateOne({ _id }, { is_pay });
-      console.log(r);
+      await this.lessonStudentModel.updateOne({ _id }, { is_pay });
     } else if (pay_for === 'tempLessonApply') {
       // 私教课临时上课,需要到临时申请那找到相关数据,再修改lessonStudent
       const tempApply = await this.tempLessonApplyModel.findById(_id);
       if (!tempApply) return;
       const { lesson_id, student_id } = tempApply;
       await this.lessonStudentModel.updateOne({ lesson_id, student_id }, { is_pay });
+    } else if (pay_for === 'charge') {
+      // 充值
+      await this.chargeModel.updateOne({ _id }, { is_pay });
     }
   }