mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-30 18:00:56 +01:00
加入权限管理
This commit is contained in:
@@ -3,6 +3,7 @@ package routes
|
||||
import (
|
||||
"crawlab/constants"
|
||||
"crawlab/model"
|
||||
"crawlab/services"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/globalsign/mgo/bson"
|
||||
"net/http"
|
||||
@@ -22,7 +23,7 @@ func GetHomeStats(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 任务总数
|
||||
taskCount, err := model.GetTaskCount(nil)
|
||||
taskCount, err := model.GetTaskCount(bson.M{"user_id": services.GetCurrentUserId(c)})
|
||||
if err != nil {
|
||||
HandleError(http.StatusInternalServerError, c, err)
|
||||
return
|
||||
@@ -36,21 +37,21 @@ func GetHomeStats(c *gin.Context) {
|
||||
}
|
||||
|
||||
// 爬虫总数
|
||||
spiderCount, err := model.GetSpiderCount()
|
||||
spiderCount, err := model.GetSpiderCount(bson.M{"user_id": services.GetCurrentUserId(c)})
|
||||
if err != nil {
|
||||
HandleError(http.StatusInternalServerError, c, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 定时任务数
|
||||
scheduleCount, err := model.GetScheduleCount()
|
||||
scheduleCount, err := model.GetScheduleCount(bson.M{"user_id": services.GetCurrentUserId(c)})
|
||||
if err != nil {
|
||||
HandleError(http.StatusInternalServerError, c, err)
|
||||
return
|
||||
}
|
||||
|
||||
// 每日任务数
|
||||
items, err := model.GetDailyTaskStats(bson.M{})
|
||||
items, err := model.GetDailyTaskStats(bson.M{"user_id": services.GetCurrentUserId(c)})
|
||||
if err != nil {
|
||||
HandleError(http.StatusInternalServerError, c, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user