lrf %!s(int64=2) %!d(string=hai) anos
pai
achega
6ac64eaa37
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      app/service/business/lessonStudent.js

+ 1 - 1
app/service/business/lessonStudent.js

@@ -23,7 +23,7 @@ class LessonStudentService extends CrudService {
   async beforeCreate(body) {
     const { lesson_id, school_id, student_id } = body;
     // 检查是否已经有数据
-    const data = await this.model.findOne({ lesson_id, school_id, student_id });
+    const data = await this.model.findOne({ lesson_id, school_id, student_id, $or: [{ is_try: '0', is_pay: { $ne: '-3' } }, { is_try: '1' }] });
     // 数据已存在
     if (data) throw new BusinessError(ErrorCode.DATA_EXISTED, '您已报名');
     // 数据不存在