|
@@ -116,42 +116,6 @@ func LatestExamExportExcel(c *gin.Context, apictx *ApiSession) (interface{}, err
|
|
return nil, nil
|
|
return nil, nil
|
|
}
|
|
}
|
|
|
|
|
|
-// func getTotalLearnTime(apictx *ApiSession, db string, uid string) (int32, error) {
|
|
|
|
-
|
|
|
|
-// // 可以查询learn_log_statistics,数据量小些
|
|
|
|
-// colls := apictx.CreateRepoCtx().Client.GetDbCollection(db, repo.CollectionLearnLogStatistics)
|
|
|
|
-
|
|
|
|
-// // colls := apictx.CreateRepoCtx().Client.GetDbCollection(db, repo.CollectionLearnLog)
|
|
|
|
-
|
|
|
|
-// // 定义聚合管道
|
|
|
|
-// pipeline := mongo.Pipeline{
|
|
|
|
-// {{Key: "$match", Value: bson.D{{Key: "uid", Value: uid}}}},
|
|
|
|
-// {{Key: "$group", Value: bson.D{
|
|
|
|
-// {Key: "_id", Value: "$uid"},
|
|
|
|
-// {Key: "totalLearnTime", Value: bson.D{{Key: "$sum", Value: "$learnTime"}}},
|
|
|
|
-// }}},
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// // 执行聚合管道
|
|
|
|
-// cursor, err := colls.Aggregate(apictx.CreateRepoCtx().Ctx, pipeline)
|
|
|
|
-// if err != nil {
|
|
|
|
-// log.Error(err)
|
|
|
|
-// return 0, err
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// // 遍历结果
|
|
|
|
-// var results []bson.M
|
|
|
|
-// if err = cursor.All(apictx.CreateRepoCtx().Ctx, &results); err != nil {
|
|
|
|
-// log.Error(err)
|
|
|
|
-// return 0, err
|
|
|
|
-// }
|
|
|
|
-// if len(results) > 0 {
|
|
|
|
-// return results[0]["totalLearnTime"].(int32), err
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// return 0, nil
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
func getHandleLatestExamLog(apictx *ApiSession, db string, examType string) ([]*HandleLatestExamLog, error) {
|
|
func getHandleLatestExamLog(apictx *ApiSession, db string, examType string) ([]*HandleLatestExamLog, error) {
|
|
colls := apictx.CreateRepoCtx().Client.GetDbCollection(db, repo.CollectionExeamLog)
|
|
colls := apictx.CreateRepoCtx().Client.GetDbCollection(db, repo.CollectionExeamLog)
|
|
|
|
|