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