sunsheng 1 year ago
parent
commit
6e68b74423
1 changed files with 0 additions and 37 deletions
  1. 0 37
      src/api/learnLog.go

+ 0 - 37
src/api/learnLog.go

@@ -28,38 +28,6 @@ func CreateLearnLog(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	if len(learnLog.Cid) < 1 {
 		return nil, errors.New("模块id不能为空")
 	}
-	// // 查询该学员的学习记录是否存在
-	// // 一年一条记录
-	// searchLearnLog := &model.LearnLog{}
-	// year := time.Now().Year()                                      // 获取当前年份
-	// loc, _ := time.LoadLocation("Asia/Shanghai")                   // 加载中国的时区
-	// startTime := time.Date(year, time.January, 1, 0, 0, 0, 0, loc) // 使用中国的时区
-	// endTime := time.Date(year+1, time.January, 1, 0, 0, 0, 0, loc) // 使用中国的时区
-	// found, err := repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
-	// 	Db: db,
-	// 	Query: repo.Map{
-	// 		"uid": apictx.User.ID,
-	// 		"cid": learnLog.Cid,
-	// 		"createTime": repo.Map{
-	// 			"$gte": startTime,
-	// 			"$lt":  endTime,
-	// 		},
-	// 	},
-	// }, searchLearnLog)
-	// if err != nil {
-	// 	return nil, err
-	// }
-	// if found {
-	// 	update := bson.M{"$inc": bson.M{"learnTime": 1}, "$set": bson.M{"updateTime": time.Now()}}
-	// 	res, err := repo.RepoUpdateSetDbDocProps(apictx.CreateRepoCtx(), db, repo.CollectionLearnLog, searchLearnLog.Id.Hex(), update)
-	// 	if err != nil {
-	// 		return nil, err
-	// 	}
-	// 	if res.ModifiedCount > 0 {
-	// 		return true, nil
-	// 	}
-	// 	return false, nil
-	// }
 
 	// 没找到数据,创建
 	learnLog.Uid = apictx.User.ID
@@ -68,11 +36,6 @@ func CreateLearnLog(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	learnLog.CreateTime = time.Now()
 	learnLog.UpdateTime = time.Now()
 	return repo.RepoAddDbDoc(apictx.CreateRepoCtx(), db, repo.CollectionLearnLog, learnLog)
-	// if err != nil {
-	// 	log.Error(err)
-	// 	return false, nil
-	// }
-	// return true, nil
 }
 
 // 每分钟记录下学习时长