新增查询全部用户api
This commit is contained in:
@@ -6,8 +6,7 @@ import (
|
||||
"main.go/api/admin"
|
||||
)
|
||||
|
||||
|
||||
func Initrouter(){
|
||||
func Initrouter() {
|
||||
router := gin.Default()
|
||||
api_v1 := router.Group("/api/v1")
|
||||
|
||||
@@ -15,19 +14,19 @@ func Initrouter(){
|
||||
public := api_v1.Group("")
|
||||
{
|
||||
//用户登录
|
||||
public.POST("/login",api.Login)
|
||||
public.POST("/login", api.Login)
|
||||
//用户注册
|
||||
public.POST("/register",api.Register)
|
||||
public.POST("/register", api.Register)
|
||||
//用户登出
|
||||
public.GET("/logout",api.Logout)
|
||||
public.GET("/logout", api.Logout)
|
||||
//获取指定id用户可公开信息
|
||||
public.GET("/user/:id",api.GetInfoByUserId)
|
||||
public.GET("/user/:id", api.GetInfoByUserId)
|
||||
//获取指定id用户分数
|
||||
public.GET("/score/:id",api.GetScoreByUserId)
|
||||
public.GET("/score/:id", api.GetScoreByUserId)
|
||||
//获取所有用户分数,降序排列
|
||||
public.GET("/score",api.GetAllScore)
|
||||
public.GET("/score", api.GetAllScore)
|
||||
//获取全部公告
|
||||
public.GET("/notice",api.GetAllNotices)
|
||||
public.GET("/notice", api.GetAllNotices)
|
||||
|
||||
}
|
||||
// 普通用户api,需要用户登陆且Role=0才能访问
|
||||
@@ -55,6 +54,9 @@ func Initrouter(){
|
||||
personal.GET("/solves/self", api.GetSelfSolves)
|
||||
// 获取当前用户分数、排名
|
||||
personal.GET("/score/self", api.GetSelfScoreAndRank)
|
||||
// 获取所有用户信息
|
||||
personal.GET("/users", api.GetAllUserInfo)
|
||||
|
||||
// 校内排行api,暂时留空
|
||||
}
|
||||
// 管理员api,需要用户登陆且Role=1才能访问
|
||||
@@ -65,8 +67,5 @@ func Initrouter(){
|
||||
manager.POST("/challenge", admin.NewChallenge)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
router.Run(":9000")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user