|
@@ -9,6 +9,18 @@ class TryLessonApplyService extends CrudService {
|
|
|
constructor(ctx) {
|
|
|
super(ctx, 'trylessonapply');
|
|
|
this.model = this.ctx.model.Apply.TryLessonApply;
|
|
|
+ this.lessonStudentService = this.ctx.service.business.lessonStudent;
|
|
|
+ }
|
|
|
+ // 处理审核成功的情况
|
|
|
+ async afterUpdate(filter, body, data) {
|
|
|
+ const { status } = data;
|
|
|
+ // 审核不通过, 不处理
|
|
|
+ if (status !== '1') return data;
|
|
|
+ // 通过,则需要在 lessonStudent中添加数据
|
|
|
+ const obj = _.pick(data, [ 'school_id', 'lesson_id', 'student_id' ]);
|
|
|
+ obj.is_try = '1';
|
|
|
+ await this.lessonStudentService.create(obj);
|
|
|
+ return data;
|
|
|
}
|
|
|
}
|
|
|
|