|
@@ -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.lessonStudentService = this.ctx.service.business.lessonStudent;
|
|
this.chargeModel = this.ctx.model.Business.Charge;
|
|
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;
|
|
@@ -43,18 +44,20 @@ class PayOrderService extends CrudService {
|
|
// 不知道该去同步哪个表的支付状态,不处理
|
|
// 不知道该去同步哪个表的支付状态,不处理
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- const { from_id: _id, status: is_pay, money, _id: pay_id } = data;
|
|
|
|
|
|
+ const { from_id: _id, status: is_pay, money, _id: pay_id, config } = data;
|
|
if (pay_for === 'lessonStudent') {
|
|
if (pay_for === 'lessonStudent') {
|
|
// 因为上课产生的支付,去找lessonStudent,修改指定学生的支付状态
|
|
// 因为上课产生的支付,去找lessonStudent,修改指定学生的支付状态
|
|
await this.lessonStudentModel.updateOne({ _id }, { is_pay });
|
|
await this.lessonStudentModel.updateOne({ _id }, { is_pay });
|
|
} else if (pay_for === 'tempLessonApply') {
|
|
} else if (pay_for === 'tempLessonApply') {
|
|
- // 私教课临时上课,需要到临时申请那找到相关数据,再修改lessonStudent
|
|
|
|
|
|
+ // 私教课临时上课,需要到临时申请那找到相关数据
|
|
const tempApply = await this.tempLessonApplyModel.findById(_id);
|
|
const tempApply = await this.tempLessonApplyModel.findById(_id);
|
|
if (!tempApply) return;
|
|
if (!tempApply) return;
|
|
tempApply.pay_id = pay_id;
|
|
tempApply.pay_id = pay_id;
|
|
await tempApply.save();
|
|
await tempApply.save();
|
|
- const { lesson_id, student_id } = tempApply;
|
|
|
|
- await this.lessonStudentModel.updateOne({ lesson_id, student_id }, { is_pay, pay_id, money });
|
|
|
|
|
|
+ // 修改完申请,再创建 lessonStudent
|
|
|
|
+ const { lesson_id, student_id, school_id } = tempApply;
|
|
|
|
+ const obj = { lesson_id, student_id, school_id, is_pay, pay_id, config };
|
|
|
|
+ await this.lessonStudentService.create(obj);
|
|
} else if (pay_for === 'charge') {
|
|
} else if (pay_for === 'charge') {
|
|
// 充值
|
|
// 充值
|
|
await this.chargeModel.updateOne({ _id }, { is_pay });
|
|
await this.chargeModel.updateOne({ _id }, { is_pay });
|