animeic %!s(int64=2) %!d(string=hai) anos
pai
achega
42b321a5e4
Modificáronse 2 ficheiros con 8 adicións e 1 borrados
  1. BIN=BIN
      cmd/__debug_bin
  2. 8 1
      dao/dao-user.go

BIN=BIN
cmd/__debug_bin


+ 8 - 1
dao/dao-user.go

@@ -612,7 +612,10 @@ func InsertBatchUserByTermId(file multipart.File, termId, classId int) *result.R
 				}
 			}
 			fmt.Println()
-			if roleName == "student" && class.TermId != termId || (classId != 0 && class.Id != nil && *class.Id == classId) {
+			// !TODO 注释为之前的 选择班级不能导入的问题
+			// if roleName == "student" && class.TermId != termId || (classId != 0 && class.Id != nil && *class.Id == classId) {
+			if roleName == "student" && class.TermId != termId || (classId != 0 && class.Id != nil && *class.Id != classId) {
+				fmt.Println(111)
 				continue
 			}
 
@@ -682,6 +685,10 @@ func InsertBatchUserByTermId(file multipart.File, termId, classId int) *result.R
 			if err != nil && err != sql.ErrNoRows {
 				return result.UNKNOW_ERROR.SetMsg(err.Error())
 			}
+			// !TODO 修复count为nil时报错
+			if count == nil {
+				continue
+			}
 
 			// 6、添加考试记录
 			sqlStr = "insert into exam_record(create_at, update_at, user_id, exam_id,status) values (?,?,?,?,?)"