|
@@ -14,6 +14,12 @@ class LessonStudentService extends CrudService {
|
|
|
this.lessonModel = this.ctx.model.Business.Lesson;
|
|
|
}
|
|
|
|
|
|
+ async checkCanUse({ school_id, student_id, lesson_id }) {
|
|
|
+ const num = await this.model.count({ school_id, student_id, lesson_id, $or: [{ is_try: '0', is_pay: { $ne: '-3' } }, { is_try: '1' }] });
|
|
|
+ if (num > 0) throw new BusinessError(ErrorCode.DATA_EXISTED, '已存在有效的报名信息');
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
async beforeCreate(body) {
|
|
|
const { lesson_id, school_id, student_id } = body;
|
|
|
// 检查是否已经有数据
|