From 0183cdab4c41a01e832a52ff374bc442647b42ef Mon Sep 17 00:00:00 2001 From: haoyanbin <605649647@qq.com> Date: Mon, 27 Dec 2021 15:29:17 +0800 Subject: [PATCH] Api --- app/operate/apis/org_ad.go | 40 +- app/operate/apis/org_club.go | 40 +- app/operate/apis/org_club_player.go | 123 +++++ app/operate/apis/org_club_team.go | 123 +++++ app/operate/apis/org_player.go | 40 +- app/operate/apis/org_team.go | 40 +- app/operate/apis/org_team_club.go | 86 ++++ app/operate/apis/org_team_match.go | 155 ++++++ app/operate/apis/org_team_match_evaluate.go | 158 ++++++ app/operate/apis/org_team_player.go | 123 +++++ app/operate/apis/org_team_team.go | 123 +++++ app/operate/apis/org_team_user.go | 40 +- app/operate/apis/org_user.go | 453 ++++++++++++++++++ app/operate/router/org_club_player.go | 24 + app/operate/router/org_club_team.go | 24 + .../{org_club_user.go => org_team_club.go} | 13 +- app/operate/router/org_team_match.go | 25 + app/operate/router/org_team_match_evaluate.go | 25 + app/operate/router/org_team_player.go | 24 + app/operate/router/org_team_team.go | 24 + app/operate/router/org_user.go | 39 ++ 21 files changed, 1634 insertions(+), 108 deletions(-) create mode 100644 app/operate/apis/org_club_player.go create mode 100644 app/operate/apis/org_club_team.go create mode 100644 app/operate/apis/org_team_club.go create mode 100644 app/operate/apis/org_team_match.go create mode 100644 app/operate/apis/org_team_match_evaluate.go create mode 100644 app/operate/apis/org_team_player.go create mode 100644 app/operate/apis/org_team_team.go create mode 100644 app/operate/apis/org_user.go create mode 100644 app/operate/router/org_club_player.go create mode 100644 app/operate/router/org_club_team.go rename app/operate/router/{org_club_user.go => org_team_club.go} (50%) create mode 100644 app/operate/router/org_team_match.go create mode 100644 app/operate/router/org_team_match_evaluate.go create mode 100644 app/operate/router/org_team_player.go create mode 100644 app/operate/router/org_team_team.go create mode 100644 app/operate/router/org_user.go diff --git a/app/operate/apis/org_ad.go b/app/operate/apis/org_ad.go index cc247bf..2d0e3b5 100644 --- a/app/operate/apis/org_ad.go +++ b/app/operate/apis/org_ad.go @@ -18,10 +18,10 @@ type OrgAd struct { api.Api } -// GetPage 获å–广告列表 -// @Summary 获å–广告列表 -// @Description 获å–广告列表 -// @Tags 广告 +// GetPage <è¿è¥>获å–广告列表 +// @Summary <è¿è¥>获å–广告列表 +// @Description <è¿è¥>获å–广告列表 +// @Tags <è¿è¥>广告 // @Param pageSize query int false "é¡µæ¡æ•°" // @Param pageIndex query int false "页ç " // @Success 200 {string} string "{"code": 200, "data": [...]}" @@ -54,10 +54,10 @@ func (e OrgAd) GetPage(c *gin.Context) { e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") } -// Get 获å–广告 -// @Summary 获å–广告 -// @Description 获å–广告 -// @Tags 广告 +// Get <è¿è¥>获å–广告 +// @Summary <è¿è¥>获å–广告 +// @Description <è¿è¥>获å–广告 +// @Tags <è¿è¥>广告 // @Param id path string false "id" // @Success 200 {string} string {data=models.OrgAd} "{"code": 200, "data": [...]}" // @Router /api/v1/org-ad/{id} [get] @@ -87,10 +87,10 @@ func (e OrgAd) Get(c *gin.Context) { e.OK( object, "查询æˆåŠŸ") } -// Insert 创建广告 -// @Summary 创建广告 -// @Description 创建广告 -// @Tags 广告 +// Insert <è¿è¥>创建广告 +// @Summary <è¿è¥>创建广告 +// @Description <è¿è¥>创建广告 +// @Tags <è¿è¥>广告 // @Accept application/json // @Product application/json // @Param data body dto.OrgAdInsertReq true "data" @@ -122,10 +122,10 @@ func (e OrgAd) Insert(c *gin.Context) { e.OK(req.GetId(), "创建æˆåŠŸ") } -// Update 修改广告 -// @Summary 修改广告 -// @Description 修改广告 -// @Tags 广告 +// Update <è¿è¥>修改广告 +// @Summary <è¿è¥>修改广告 +// @Description <è¿è¥>修改广告 +// @Tags <è¿è¥>广告 // @Accept application/json // @Product application/json // @Param data body dto.OrgAdUpdateReq true "body" @@ -156,10 +156,10 @@ func (e OrgAd) Update(c *gin.Context) { e.OK( req.GetId(), "修改æˆåŠŸ") } -// Delete åˆ é™¤å¹¿å‘Š -// @Summary åˆ é™¤å¹¿å‘Š -// @Description åˆ é™¤å¹¿å‘Š -// @Tags 广告 +// Delete <è¿è¥>åˆ é™¤å¹¿å‘Š +// @Summary <è¿è¥>åˆ é™¤å¹¿å‘Š +// @Description <è¿è¥>åˆ é™¤å¹¿å‘Š +// @Tags <è¿è¥>广告 // @Param ids body []int false "ids" // @Success 200 {string} string "{"code": 200, "message": "åˆ é™¤æˆåŠŸ"}" // @Router /api/v1/org-ad [delete] diff --git a/app/operate/apis/org_club.go b/app/operate/apis/org_club.go index 0837211..7771d04 100644 --- a/app/operate/apis/org_club.go +++ b/app/operate/apis/org_club.go @@ -18,10 +18,10 @@ type OrgClub struct { api.Api } -// GetPage 获å–俱ä¹éƒ¨åˆ—表 -// @Summary 获å–俱ä¹éƒ¨åˆ—表 -// @Description 获å–俱ä¹éƒ¨åˆ—表 -// @Tags 俱ä¹éƒ¨ +// GetPage <俱ä¹éƒ¨>获å–俱ä¹éƒ¨åˆ—表 +// @Summary <俱ä¹éƒ¨>获å–俱ä¹éƒ¨åˆ—表 +// @Description <俱ä¹éƒ¨>获å–俱ä¹éƒ¨åˆ—表 +// @Tags <俱ä¹éƒ¨>俱ä¹éƒ¨ // @Param pageSize query int false "é¡µæ¡æ•°" // @Param pageIndex query int false "页ç " // @Success 200 {string} string "{"code": 200, "data": [...]}" @@ -54,10 +54,10 @@ func (e OrgClub) GetPage(c *gin.Context) { e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") } -// Get 获å–俱ä¹éƒ¨ -// @Summary 获å–俱ä¹éƒ¨ -// @Description 获å–俱ä¹éƒ¨ -// @Tags 俱ä¹éƒ¨ +// Get <俱ä¹éƒ¨>获å–俱ä¹éƒ¨ +// @Summary <俱ä¹éƒ¨>获å–俱ä¹éƒ¨ +// @Description <俱ä¹éƒ¨>获å–俱ä¹éƒ¨ +// @Tags <俱ä¹éƒ¨>俱ä¹éƒ¨ // @Param id path string false "id" // @Success 200 {string} string "{"code": 200, "data": [...]}" // @Router /api/v1/org-club/{id} [get] @@ -87,10 +87,10 @@ func (e OrgClub) Get(c *gin.Context) { e.OK( object, "查询æˆåŠŸ") } -// Insert 创建俱ä¹éƒ¨ -// @Summary 创建俱ä¹éƒ¨ -// @Description 创建俱ä¹éƒ¨ -// @Tags 俱ä¹éƒ¨ +// Insert <俱ä¹éƒ¨>创建俱ä¹éƒ¨ +// @Summary <俱ä¹éƒ¨>创建俱ä¹éƒ¨ +// @Description <俱ä¹éƒ¨>创建俱ä¹éƒ¨ +// @Tags <俱ä¹éƒ¨>俱ä¹éƒ¨ // @Accept application/json // @Product application/json // @Param data body dto.OrgClubInsertReq true "data" @@ -122,10 +122,10 @@ func (e OrgClub) Insert(c *gin.Context) { e.OK(req.GetId(), "创建æˆåŠŸ") } -// Update 修改俱ä¹éƒ¨ -// @Summary 修改俱ä¹éƒ¨ -// @Description 修改俱ä¹éƒ¨ -// @Tags 俱ä¹éƒ¨ +// Update <俱ä¹éƒ¨>修改俱ä¹éƒ¨ +// @Summary <俱ä¹éƒ¨>修改俱ä¹éƒ¨ +// @Description <俱ä¹éƒ¨>修改俱ä¹éƒ¨ +// @Tags <俱ä¹éƒ¨>俱ä¹éƒ¨ // @Accept application/json // @Product application/json // @Param data body dto.OrgClubUpdateReq true "body" @@ -156,10 +156,10 @@ func (e OrgClub) Update(c *gin.Context) { e.OK( req.GetId(), "修改æˆåŠŸ") } -// Delete åˆ é™¤ä¿±ä¹éƒ¨ -// @Summary åˆ é™¤ä¿±ä¹éƒ¨ -// @Description åˆ é™¤ä¿±ä¹éƒ¨ -// @Tags 俱ä¹éƒ¨ +// Delete <俱ä¹éƒ¨>åˆ é™¤ä¿±ä¹éƒ¨ +// @Summary <俱ä¹éƒ¨>åˆ é™¤ä¿±ä¹éƒ¨ +// @Description <俱ä¹éƒ¨>åˆ é™¤ä¿±ä¹éƒ¨ +// @Tags <俱ä¹éƒ¨>俱ä¹éƒ¨ // @Param ids body []int false "ids" // @Success 200 {string} string "{"code": 200, "message": "åˆ é™¤æˆåŠŸ"}" // @Router /api/v1/org-club [delete] diff --git a/app/operate/apis/org_club_player.go b/app/operate/apis/org_club_player.go new file mode 100644 index 0000000..e48052d --- /dev/null +++ b/app/operate/apis/org_club_player.go @@ -0,0 +1,123 @@ +package apis + +import ( + "fmt" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + + "go-admin/app/operate/models" + "go-admin/app/operate/service" + "go-admin/app/operate/service/dto" + "go-admin/common/actions" +) + +type OrgClubPlayer struct { + api.Api +} + +// GetPage <俱ä¹éƒ¨>获å–çƒå‘˜æ•°æ®åˆ—表 +// @Summary <俱ä¹éƒ¨>获å–çƒå‘˜æ•°æ®åˆ—表 +// @Description <俱ä¹éƒ¨>获å–çƒå‘˜æ•°æ®åˆ—表 +// @Tags <俱ä¹éƒ¨>çƒå‘˜ +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-player [get] +// @Security Bearer +func (e OrgClubPlayer) GetPage(c *gin.Context) { + req := dto.OrgPlayerGetPageReq{} + s := service.OrgPlayer{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgPlayer, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒå‘˜ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// GetPage <俱ä¹éƒ¨>获å–çƒå‘˜æ¯”赛列表 +// @Summary <俱ä¹éƒ¨>获å–çƒå‘˜æ¯”赛列表 +// @Description <俱ä¹éƒ¨>获å–çƒå‘˜æ¯”赛列表 +// @Tags <俱ä¹éƒ¨>çƒå‘˜ +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-player/get-match [get] +// @Security Bearer +func (e OrgClubPlayer) GetPageMatch(c *gin.Context) { + req := dto.OrgPlayerGetPageReq{} + s := service.OrgPlayer{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgPlayer, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒå‘˜ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// Get <俱ä¹éƒ¨>获å–çƒå‘˜æ¯”赛详情 +// @Summary <俱ä¹éƒ¨>获å–çƒå‘˜æ¯”赛详情 +// @Description <俱ä¹éƒ¨>获å–çƒå‘˜æ¯”赛详情 +// @Tags <俱ä¹éƒ¨>çƒå‘˜ +// @Param id path string false "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-player/{id} [get] +// @Security Bearer +func (e OrgClubPlayer) Get(c *gin.Context) { + req := dto.OrgPlayerGetReq{} + s := service.OrgPlayer{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgPlayer + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒå‘˜å¤±è´¥ï¼Œ\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} diff --git a/app/operate/apis/org_club_team.go b/app/operate/apis/org_club_team.go new file mode 100644 index 0000000..7888049 --- /dev/null +++ b/app/operate/apis/org_club_team.go @@ -0,0 +1,123 @@ +package apis + +import ( + "fmt" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + + "go-admin/app/operate/models" + "go-admin/app/operate/service" + "go-admin/app/operate/service/dto" + "go-admin/common/actions" +) + +type OrgClubTeam struct { + api.Api +} + +// GetPage <俱ä¹éƒ¨>获å–çƒé˜Ÿæ•°æ®åˆ—表 +// @Summary <俱ä¹éƒ¨>获å–çƒé˜Ÿæ•°æ®åˆ—表 +// @Description <俱ä¹éƒ¨>获å–çƒé˜Ÿæ•°æ®åˆ—表 +// @Tags <俱ä¹éƒ¨>çƒé˜Ÿ +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-club-team [get] +// @Security Bearer +func (e OrgClubTeam) GetPage(c *gin.Context) { + req := dto.OrgTeamGetPageReq{} + s := service.OrgTeam{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgTeam, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒé˜Ÿ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// GetPage <俱ä¹éƒ¨>获å–çƒé˜Ÿæ¯”赛列表 +// @Summary <俱ä¹éƒ¨>获å–çƒé˜Ÿæ¯”赛列表 +// @Description <俱ä¹éƒ¨>获å–çƒé˜Ÿæ¯”赛列表 +// @Tags <俱ä¹éƒ¨>çƒé˜Ÿ +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-club-team/get-match [get] +// @Security Bearer +func (e OrgClubTeam) GetPageMatch(c *gin.Context) { + req := dto.OrgTeamGetPageReq{} + s := service.OrgTeam{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgTeam, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒé˜Ÿ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// Get <俱ä¹éƒ¨>获å–çƒé˜Ÿæ¯”赛详情 +// @Summary <俱ä¹éƒ¨>获å–çƒé˜Ÿæ¯”赛详情 +// @Description <俱ä¹éƒ¨>获å–çƒé˜Ÿæ¯”赛详情 +// @Tags <俱ä¹éƒ¨>çƒé˜Ÿ +// @Param id path string false "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-club-team/{id} [get] +// @Security Bearer +func (e OrgClubTeam) Get(c *gin.Context) { + req := dto.OrgTeamGetReq{} + s := service.OrgTeam{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgTeam + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒé˜Ÿå¤±è´¥ï¼Œ\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} \ No newline at end of file diff --git a/app/operate/apis/org_player.go b/app/operate/apis/org_player.go index 6d2f3c8..885f6f7 100644 --- a/app/operate/apis/org_player.go +++ b/app/operate/apis/org_player.go @@ -18,10 +18,10 @@ type OrgPlayer struct { api.Api } -// GetPage 获å–çƒå‘˜åˆ—表 -// @Summary 获å–çƒå‘˜åˆ—表 -// @Description 获å–çƒå‘˜åˆ—表 -// @Tags çƒå‘˜ +// GetPage <çƒé˜Ÿ>获å–çƒå‘˜åˆ—表 +// @Summary <çƒé˜Ÿ>获å–çƒå‘˜åˆ—表 +// @Description <çƒé˜Ÿ>获å–çƒå‘˜åˆ—表 +// @Tags <çƒé˜Ÿ>çƒå‘˜ // @Param pageSize query int false "é¡µæ¡æ•°" // @Param pageIndex query int false "页ç " // @Success 200 {string} string "{"code": 200, "data": [...]}" @@ -54,10 +54,10 @@ func (e OrgPlayer) GetPage(c *gin.Context) { e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") } -// Get 获å–çƒå‘˜ -// @Summary 获å–çƒå‘˜ -// @Description 获å–çƒå‘˜ -// @Tags çƒå‘˜ +// Get <çƒé˜Ÿ>获å–çƒå‘˜ +// @Summary <çƒé˜Ÿ>获å–çƒå‘˜ +// @Description <çƒé˜Ÿ>获å–çƒå‘˜ +// @Tags <çƒé˜Ÿ>çƒå‘˜ // @Param id path string false "id" // @Success 200 {string} string "{"code": 200, "data": [...]}" // @Router /api/v1/org-player/{id} [get] @@ -87,10 +87,10 @@ func (e OrgPlayer) Get(c *gin.Context) { e.OK( object, "查询æˆåŠŸ") } -// Insert 创建çƒå‘˜ -// @Summary 创建çƒå‘˜ -// @Description 创建çƒå‘˜ -// @Tags çƒå‘˜ +// Insert <çƒé˜Ÿ>创建çƒå‘˜ +// @Summary <çƒé˜Ÿ>创建çƒå‘˜ +// @Description <çƒé˜Ÿ>创建çƒå‘˜ +// @Tags <çƒé˜Ÿ>çƒå‘˜ // @Accept application/json // @Product application/json // @Param data body dto.OrgPlayerInsertReq true "data" @@ -122,10 +122,10 @@ func (e OrgPlayer) Insert(c *gin.Context) { e.OK(req.GetId(), "创建æˆåŠŸ") } -// Update 修改çƒå‘˜ -// @Summary 修改çƒå‘˜ -// @Description 修改çƒå‘˜ -// @Tags çƒå‘˜ +// Update <çƒé˜Ÿ>修改çƒå‘˜ +// @Summary <çƒé˜Ÿ>修改çƒå‘˜ +// @Description <çƒé˜Ÿ>修改çƒå‘˜ +// @Tags <çƒé˜Ÿ>çƒå‘˜ // @Accept application/json // @Product application/json // @Param data body dto.OrgPlayerUpdateReq true "body" @@ -156,10 +156,10 @@ func (e OrgPlayer) Update(c *gin.Context) { e.OK( req.GetId(), "修改æˆåŠŸ") } -// Delete åˆ é™¤çƒå‘˜ -// @Summary åˆ é™¤çƒå‘˜ -// @Description åˆ é™¤çƒå‘˜ -// @Tags çƒå‘˜ +// Delete <çƒé˜Ÿ>åˆ é™¤çƒå‘˜ +// @Summary <çƒé˜Ÿ>åˆ é™¤çƒå‘˜ +// @Description <çƒé˜Ÿ>åˆ é™¤çƒå‘˜ +// @Tags <çƒé˜Ÿ>çƒå‘˜ // @Param ids body []int false "ids" // @Success 200 {string} string "{"code": 200, "message": "åˆ é™¤æˆåŠŸ"}" // @Router /api/v1/org-player [delete] diff --git a/app/operate/apis/org_team.go b/app/operate/apis/org_team.go index 1923ea6..7e57bf2 100644 --- a/app/operate/apis/org_team.go +++ b/app/operate/apis/org_team.go @@ -18,10 +18,10 @@ type OrgTeam struct { api.Api } -// GetPage 获å–çƒé˜Ÿåˆ—表 -// @Summary 获å–çƒé˜Ÿåˆ—表 -// @Description 获å–çƒé˜Ÿåˆ—表 -// @Tags çƒé˜Ÿ +// GetPage <çƒé˜Ÿ>获å–çƒé˜Ÿåˆ—表 +// @Summary <çƒé˜Ÿ>获å–çƒé˜Ÿåˆ—表 +// @Description <çƒé˜Ÿ>获å–çƒé˜Ÿåˆ—表 +// @Tags <çƒé˜Ÿ>çƒé˜Ÿ // @Param pageSize query int false "é¡µæ¡æ•°" // @Param pageIndex query int false "页ç " // @Success 200 {string} string "{"code": 200, "data": [...]}" @@ -54,10 +54,10 @@ func (e OrgTeam) GetPage(c *gin.Context) { e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") } -// Get 获å–çƒé˜Ÿ -// @Summary 获å–çƒé˜Ÿ -// @Description 获å–çƒé˜Ÿ -// @Tags çƒé˜Ÿ +// Get <çƒé˜Ÿ>获å–çƒé˜Ÿ +// @Summary <çƒé˜Ÿ>获å–çƒé˜Ÿ +// @Description <çƒé˜Ÿ>获å–çƒé˜Ÿ +// @Tags <çƒé˜Ÿ>çƒé˜Ÿ // @Param id path string false "id" // @Success 200 {string} string "{"code": 200, "data": [...]}" // @Router /api/v1/org-team/{id} [get] @@ -87,10 +87,10 @@ func (e OrgTeam) Get(c *gin.Context) { e.OK( object, "查询æˆåŠŸ") } -// Insert 创建çƒé˜Ÿ -// @Summary 创建çƒé˜Ÿ -// @Description 创建çƒé˜Ÿ -// @Tags çƒé˜Ÿ +// Insert <çƒé˜Ÿ>创建çƒé˜Ÿ +// @Summary <çƒé˜Ÿ>创建çƒé˜Ÿ +// @Description <çƒé˜Ÿ>创建çƒé˜Ÿ +// @Tags <çƒé˜Ÿ>çƒé˜Ÿ // @Accept application/json // @Product application/json // @Param data body dto.OrgTeamInsertReq true "data" @@ -122,10 +122,10 @@ func (e OrgTeam) Insert(c *gin.Context) { e.OK(req.GetId(), "创建æˆåŠŸ") } -// Update 修改çƒé˜Ÿ -// @Summary 修改çƒé˜Ÿ -// @Description 修改çƒé˜Ÿ -// @Tags çƒé˜Ÿ +// Update <çƒé˜Ÿ>修改çƒé˜Ÿ +// @Summary <çƒé˜Ÿ>修改çƒé˜Ÿ +// @Description <çƒé˜Ÿ>修改çƒé˜Ÿ +// @Tags <çƒé˜Ÿ>çƒé˜Ÿ // @Accept application/json // @Product application/json // @Param data body dto.OrgTeamUpdateReq true "body" @@ -156,10 +156,10 @@ func (e OrgTeam) Update(c *gin.Context) { e.OK( req.GetId(), "修改æˆåŠŸ") } -// Delete åˆ é™¤çƒé˜Ÿ -// @Summary åˆ é™¤çƒé˜Ÿ -// @Description åˆ é™¤çƒé˜Ÿ -// @Tags çƒé˜Ÿ +// Delete <çƒé˜Ÿ>åˆ é™¤çƒé˜Ÿ +// @Summary <çƒé˜Ÿ>åˆ é™¤çƒé˜Ÿ +// @Description <çƒé˜Ÿ>åˆ é™¤çƒé˜Ÿ +// @Tags <çƒé˜Ÿ>çƒé˜Ÿ // @Param ids body []int false "ids" // @Success 200 {string} string "{"code": 200, "message": "åˆ é™¤æˆåŠŸ"}" // @Router /api/v1/org-team [delete] diff --git a/app/operate/apis/org_team_club.go b/app/operate/apis/org_team_club.go new file mode 100644 index 0000000..d1598dd --- /dev/null +++ b/app/operate/apis/org_team_club.go @@ -0,0 +1,86 @@ +package apis + +import ( + "fmt" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + + "go-admin/app/operate/models" + "go-admin/app/operate/service" + "go-admin/app/operate/service/dto" + "go-admin/common/actions" +) + +type OrgTeamClub struct { + api.Api +} + +// Get <çƒé˜Ÿ>获å–俱ä¹éƒ¨è¯¦æƒ… +// @Summary <çƒé˜Ÿ>获å–俱ä¹éƒ¨è¯¦æƒ… +// @Description <çƒé˜Ÿ>获å–俱ä¹éƒ¨è¯¦æƒ… +// @Tags <çƒé˜Ÿ>俱ä¹éƒ¨ +// @Param id path string false "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-club/{id} [get] +// @Security Bearer +func (e OrgTeamClub) Get(c *gin.Context) { + req := dto.OrgClubGetReq{} + s := service.OrgClub{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgClub + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–俱ä¹éƒ¨å¤±è´¥ï¼Œ\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} + +// Update <çƒé˜Ÿ>修改俱ä¹éƒ¨ +// @Summary <çƒé˜Ÿ>修改俱ä¹éƒ¨ +// @Description <çƒé˜Ÿ>修改俱ä¹éƒ¨ +// @Tags <çƒé˜Ÿ>俱ä¹éƒ¨ +// @Accept application/json +// @Product application/json +// @Param data body dto.OrgClubUpdateReq true "body" +// @Success 200 {string} string "{"code": 200, "message": "修改æˆåŠŸ"}" +// @Router /api/v1/org-team-club/{id} [put] +// @Security Bearer +func (e OrgTeamClub) Update(c *gin.Context) { + req := dto.OrgClubUpdateReq{} + s := service.OrgClub{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + req.SetUpdateBy(user.GetUserId(c)) + p := actions.GetPermissionFromContext(c) + + err = s.Update(&req, p) + if err != nil { + e.Error(500, err, fmt.Sprintf("修改俱ä¹éƒ¨ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + e.OK( req.GetId(), "修改æˆåŠŸ") +} \ No newline at end of file diff --git a/app/operate/apis/org_team_match.go b/app/operate/apis/org_team_match.go new file mode 100644 index 0000000..c6d2579 --- /dev/null +++ b/app/operate/apis/org_team_match.go @@ -0,0 +1,155 @@ +package apis + +import ( + "fmt" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + + "go-admin/app/operate/models" + "go-admin/app/operate/service" + "go-admin/app/operate/service/dto" + "go-admin/common/actions" +) + +type OrgTeamMatch struct { + api.Api +} + +// GetPage <çƒé˜Ÿ>èŽ·å–æ¯”赛列表 +// @Summary <çƒé˜Ÿ>èŽ·å–æ¯”赛列表 +// @Description <çƒé˜Ÿ>èŽ·å–æ¯”赛列表 +// @Tags <çƒé˜Ÿ>比赛 +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-match [get] +// @Security Bearer +func (e OrgTeamMatch) GetPage(c *gin.Context) { + req := dto.OrgMatchGetPageReq{} + s := service.OrgMatch{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgMatch, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("èŽ·å–æ¯”èµ› 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// Get <çƒé˜Ÿ>èŽ·å–æ¯”赛所有çƒå‘˜ +// @Summary <çƒé˜Ÿ>èŽ·å–æ¯”赛所有çƒå‘˜ +// @Description <çƒé˜Ÿ>èŽ·å–æ¯”赛所有çƒå‘˜ +// @Tags <çƒé˜Ÿ>比赛 +// @Param id path string false "id" +// @Success 200 {string} string {data=models.OrgMatch} "{"code": 200, "data": [...]}" +// @Router /api/v1/get-players/{id} [get] +// @Security Bearer +func (e OrgTeamMatch) GetPlayers(c *gin.Context) { + req := dto.OrgMatchGetReq{} + s := service.OrgMatch{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgMatch + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("èŽ·å–æ¯”赛失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} + +// Get <çƒé˜Ÿ>èŽ·å–æ¯”赛已设置çƒå‘˜ +// @Summary <çƒé˜Ÿ>èŽ·å–æ¯”赛已设置çƒå‘˜ +// @Description <çƒé˜Ÿ>èŽ·å–æ¯”赛已设置çƒå‘˜ +// @Tags <çƒé˜Ÿ>比赛 +// @Param id path string false "id" +// @Success 200 {string} string {data=models.OrgMatch} "{"code": 200, "data": [...]}" +// @Router /api/v1/get-players/get-players-is-set/{id} [get] +// @Security Bearer +func (e OrgTeamMatch) GetPlayersIsSet(c *gin.Context) { + req := dto.OrgMatchGetReq{} + s := service.OrgMatch{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgMatch + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("èŽ·å–æ¯”赛失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} + +// Update <çƒé˜Ÿ>修改比赛çƒå‘˜ +// @Summary <çƒé˜Ÿ>修改比赛çƒå‘˜ +// @Description <çƒé˜Ÿ>修改比赛çƒå‘˜ +// @Tags <çƒé˜Ÿ>比赛 +// @Accept application/json +// @Product application/json +// @Param data body dto.OrgMatchUpdateReq true "body" +// @Success 200 {string} string "{"code": 200, "message": "修改æˆåŠŸ"}" +// @Router /api/v1/get-players/{id} [put] +// @Security Bearer +func (e OrgTeamMatch) UpdatePlayers(c *gin.Context) { + req := dto.OrgMatchUpdateReq{} + s := service.OrgMatch{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + req.SetUpdateBy(user.GetUserId(c)) + p := actions.GetPermissionFromContext(c) + + err = s.Update(&req, p) + if err != nil { + e.Error(500, err, fmt.Sprintf("修改比赛 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + e.OK( req.GetId(), "修改æˆåŠŸ") +} diff --git a/app/operate/apis/org_team_match_evaluate.go b/app/operate/apis/org_team_match_evaluate.go new file mode 100644 index 0000000..42bffc6 --- /dev/null +++ b/app/operate/apis/org_team_match_evaluate.go @@ -0,0 +1,158 @@ +package apis + +import ( + "fmt" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + + "go-admin/app/operate/models" + "go-admin/app/operate/service" + "go-admin/app/operate/service/dto" + "go-admin/common/actions" +) + +type OrgTeamMatchEvaluate struct { + api.Api +} + +// GetPage <çƒé˜Ÿ>教练评价列表 +// @Summary <çƒé˜Ÿ>教练评价列表 +// @Description <çƒé˜Ÿ>教练评价列表 +// @Tags <çƒé˜Ÿ>教练评价 +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-match-evaluate [get] +// @Security Bearer +func (e OrgTeamMatchEvaluate) GetPage(c *gin.Context) { + req := dto.OrgMatchEvaluateGetPageReq{} + s := service.OrgMatchEvaluate{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgMatchEvaluate, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("èŽ·å–æ¯”èµ›çƒå‘˜ä¿¡æ¯ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// GetPage <çƒé˜Ÿ>教练评价比赛列表 +// @Summary <çƒé˜Ÿ>教练评价比赛列表 +// @Description <çƒé˜Ÿ>教练评价比赛列表 +// @Tags <çƒé˜Ÿ>教练评价 +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-match-evaluate/get-match [get] +// @Security Bearer +func (e OrgTeamMatchEvaluate) GetPageMatch(c *gin.Context) { + req := dto.OrgMatchEvaluateGetPageReq{} + s := service.OrgMatchEvaluate{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgMatchEvaluate, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("èŽ·å–æ¯”èµ›çƒå‘˜ä¿¡æ¯ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// Get <çƒé˜Ÿ>教练评价比赛详情 +// @Summary <çƒé˜Ÿ>教练评价比赛详情 +// @Description <çƒé˜Ÿ>教练评价比赛详情 +// @Tags <çƒé˜Ÿ>教练评价 +// @Param id path string false "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-match-evaluate/{id} [get] +// @Security Bearer +func (e OrgTeamMatchEvaluate) Get(c *gin.Context) { + req := dto.OrgMatchEvaluateGetReq{} + s := service.OrgMatchEvaluate{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgMatchEvaluate + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("èŽ·å–æ¯”èµ›çƒå‘˜ä¿¡æ¯å¤±è´¥ï¼Œ\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} + +// Update <çƒé˜Ÿ>修改评价 +// @Summary <çƒé˜Ÿ>修改评价 +// @Description <çƒé˜Ÿ>修改评价 +// @Tags <çƒé˜Ÿ>教练评价 +// @Accept application/json +// @Product application/json +// @Param data body dto.OrgMatchEvaluateUpdateReq true "body" +// @Success 200 {string} string "{"code": 200, "message": "修改æˆåŠŸ"}" +// @Router /api/v1/org-match-evaluate/{id} [put] +// @Security Bearer +func (e OrgTeamMatchEvaluate) Update(c *gin.Context) { + req := dto.OrgMatchEvaluateUpdateReq{} + s := service.OrgMatchEvaluate{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + req.SetUpdateBy(user.GetUserId(c)) + p := actions.GetPermissionFromContext(c) + + err = s.Update(&req, p) + if err != nil { + e.Error(500, err, fmt.Sprintf("修改比赛çƒå‘˜ä¿¡æ¯ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + e.OK( req.GetId(), "修改æˆåŠŸ") +} diff --git a/app/operate/apis/org_team_player.go b/app/operate/apis/org_team_player.go new file mode 100644 index 0000000..437c416 --- /dev/null +++ b/app/operate/apis/org_team_player.go @@ -0,0 +1,123 @@ +package apis + +import ( + "fmt" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + + "go-admin/app/operate/models" + "go-admin/app/operate/service" + "go-admin/app/operate/service/dto" + "go-admin/common/actions" +) + +type OrgTeamPlayer struct { + api.Api +} + +// GetPage <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°åˆ—è¡¨ +// @Summary <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°åˆ—è¡¨ +// @Description <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°åˆ—è¡¨ +// @Tags <çƒé˜Ÿ>çƒå‘˜è¡¨çް +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-player [get] +// @Security Bearer +func (e OrgTeamPlayer) GetPage(c *gin.Context) { + req := dto.OrgPlayerGetPageReq{} + s := service.OrgPlayer{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgPlayer, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒå‘˜ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// GetPage <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°æ¯”èµ›åˆ—è¡¨ +// @Summary <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°æ¯”èµ›åˆ—è¡¨ +// @Description <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°æ¯”èµ›åˆ—è¡¨ +// @Tags <çƒé˜Ÿ>çƒå‘˜è¡¨çް +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-player/get-match [get] +// @Security Bearer +func (e OrgTeamPlayer) GetPageMatch(c *gin.Context) { + req := dto.OrgPlayerGetPageReq{} + s := service.OrgPlayer{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgPlayer, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒå‘˜ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// Get <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°æ¯”èµ›è¯¦æƒ… +// @Summary <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°æ¯”èµ›è¯¦æƒ… +// @Description <çƒé˜Ÿ>获å–çƒå‘˜è¡¨çŽ°æ¯”èµ›è¯¦æƒ… +// @Tags <çƒé˜Ÿ>çƒå‘˜è¡¨çް +// @Param id path string false "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-player/{id} [get] +// @Security Bearer +func (e OrgTeamPlayer) Get(c *gin.Context) { + req := dto.OrgPlayerGetReq{} + s := service.OrgPlayer{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgPlayer + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒå‘˜å¤±è´¥ï¼Œ\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} diff --git a/app/operate/apis/org_team_team.go b/app/operate/apis/org_team_team.go new file mode 100644 index 0000000..fd18c2b --- /dev/null +++ b/app/operate/apis/org_team_team.go @@ -0,0 +1,123 @@ +package apis + +import ( + "fmt" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + + "go-admin/app/operate/models" + "go-admin/app/operate/service" + "go-admin/app/operate/service/dto" + "go-admin/common/actions" +) + +type OrgTeamTeam struct { + api.Api +} + +// GetPage <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°åˆ—è¡¨ +// @Summary <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°åˆ—è¡¨ +// @Description <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°åˆ—è¡¨ +// @Tags <çƒé˜Ÿ>çƒé˜Ÿè¡¨çް +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-team [get] +// @Security Bearer +func (e OrgTeamTeam) GetPage(c *gin.Context) { + req := dto.OrgTeamGetPageReq{} + s := service.OrgTeam{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgTeam, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒé˜Ÿ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// GetPage <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°æ¯”èµ›åˆ—è¡¨ +// @Summary <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°æ¯”èµ›åˆ—è¡¨ +// @Description <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°æ¯”èµ›åˆ—è¡¨ +// @Tags <çƒé˜Ÿ>çƒé˜Ÿè¡¨çް +// @Param pageSize query int false "é¡µæ¡æ•°" +// @Param pageIndex query int false "页ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-team/get-match [get] +// @Security Bearer +func (e OrgTeamTeam) GetPageMatch(c *gin.Context) { + req := dto.OrgTeamGetPageReq{} + s := service.OrgTeam{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + p := actions.GetPermissionFromContext(c) + list := make([]models.OrgTeam, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒé˜Ÿ 失败,\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// Get <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°æ¯”èµ›è¯¦æƒ… +// @Summary <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°æ¯”èµ›è¯¦æƒ… +// @Description <çƒé˜Ÿ>获å–çƒé˜Ÿè¡¨çŽ°æ¯”èµ›è¯¦æƒ… +// @Tags <çƒé˜Ÿ>çƒé˜Ÿè¡¨çް +// @Param id path string false "id" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/org-team-team/{id} [get] +// @Security Bearer +func (e OrgTeamTeam) Get(c *gin.Context) { + req := dto.OrgTeamGetReq{} + s := service.OrgTeam{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.OrgTeam + + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(500, err, fmt.Sprintf("获å–çƒé˜Ÿå¤±è´¥ï¼Œ\r\nå¤±è´¥ä¿¡æ¯ %s", err.Error())) + return + } + + e.OK( object, "查询æˆåŠŸ") +} diff --git a/app/operate/apis/org_team_user.go b/app/operate/apis/org_team_user.go index e816bbf..203b644 100644 --- a/app/operate/apis/org_team_user.go +++ b/app/operate/apis/org_team_user.go @@ -18,10 +18,10 @@ type OrgTeamUser struct { api.Api } -// GetPage 获å–çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯åˆ—表 -// @Summary 获å–çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯åˆ—表 -// @Description 获å–çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯åˆ—表 -// @Tags çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ +// GetPage <çƒé˜Ÿ>工作人员列表 +// @Summary <çƒé˜Ÿ>工作人员列表 +// @Description <çƒé˜Ÿ>工作人员列表 +// @Tags <çƒé˜Ÿ>工作人员 // @Param pageSize query int false "é¡µæ¡æ•°" // @Param pageIndex query int false "页ç " // @Success 200 {string} string "{"code": 200, "data": [...]}" @@ -54,10 +54,10 @@ func (e OrgTeamUser) GetPage(c *gin.Context) { e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") } -// Get 获å–çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Summary 获å–çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Description 获å–çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Tags çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ +// Get <çƒé˜Ÿ>å·¥ä½œäººå‘˜ä¿¡æ¯ +// @Summary <çƒé˜Ÿ>å·¥ä½œäººå‘˜ä¿¡æ¯ +// @Description <çƒé˜Ÿ>å·¥ä½œäººå‘˜ä¿¡æ¯ +// @Tags <çƒé˜Ÿ>工作人员 // @Param id path string false "id" // @Success 200 {string} string "{"code": 200, "data": [...]}" // @Router /api/v1/org-team-user/{id} [get] @@ -87,10 +87,10 @@ func (e OrgTeamUser) Get(c *gin.Context) { e.OK( object, "查询æˆåŠŸ") } -// Insert 创建çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Summary 创建çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Description 创建çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Tags çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ +// Insert <çƒé˜Ÿ>创建工作人员 +// @Summary <çƒé˜Ÿ>创建工作人员 +// @Description <çƒé˜Ÿ>创建工作人员 +// @Tags <çƒé˜Ÿ>工作人员 // @Accept application/json // @Product application/json // @Param data body dto.OrgTeamUserInsertReq true "data" @@ -122,10 +122,10 @@ func (e OrgTeamUser) Insert(c *gin.Context) { e.OK(req.GetId(), "创建æˆåŠŸ") } -// Update 修改çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Summary 修改çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Description 修改çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Tags çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ +// Update <çƒé˜Ÿ>修改工作人员 +// @Summary <çƒé˜Ÿ>修改工作人员 +// @Description <çƒé˜Ÿ>修改工作人员 +// @Tags <çƒé˜Ÿ>工作人员 // @Accept application/json // @Product application/json // @Param data body dto.OrgTeamUserUpdateReq true "body" @@ -156,10 +156,10 @@ func (e OrgTeamUser) Update(c *gin.Context) { e.OK( req.GetId(), "修改æˆåŠŸ") } -// Delete åˆ é™¤çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Summary åˆ é™¤çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Description åˆ é™¤çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ -// @Tags çƒé˜Ÿäººå‘˜è´¦æˆ·ä¿¡æ¯ +// Delete <çƒé˜Ÿ>åˆ é™¤å·¥ä½œäººå‘˜ +// @Summary <çƒé˜Ÿ>åˆ é™¤å·¥ä½œäººå‘˜ +// @Description <çƒé˜Ÿ>åˆ é™¤å·¥ä½œäººå‘˜ +// @Tags <çƒé˜Ÿ>工作人员 // @Param ids body []int false "ids" // @Success 200 {string} string "{"code": 200, "message": "åˆ é™¤æˆåŠŸ"}" // @Router /api/v1/org-team-user [delete] diff --git a/app/operate/apis/org_user.go b/app/operate/apis/org_user.go new file mode 100644 index 0000000..9ae5e94 --- /dev/null +++ b/app/operate/apis/org_user.go @@ -0,0 +1,453 @@ +package apis + +import ( + "github.com/gin-gonic/gin/binding" + "go-admin/app/admin/models" + "net/http" + + "github.com/gin-gonic/gin" + "github.com/go-admin-team/go-admin-core/sdk/api" + "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" + _ "github.com/go-admin-team/go-admin-core/sdk/pkg/response" + "github.com/google/uuid" + + "go-admin/app/admin/service" + "go-admin/app/admin/service/dto" + "go-admin/common/actions" +) + +type SysUser struct { + api.Api +} + +// GetPage +// @Summary åˆ—è¡¨ç”¨æˆ·ä¿¡æ¯æ•°æ® +// @Description 获å–JSON +// @Tags 用户 +// @Param username query string false "username" +// @Success 200 {string} {object} response.Response "{"code": 200, "data": [...]}" +// @Router /api/v1/sys-user [get] +// @Security Bearer +func (e SysUser) GetPage(c *gin.Context) { + s := service.SysUser{} + req :=dto.SysUserGetPageReq{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + //æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + + list := make([]models.SysUser, 0) + var count int64 + + err = s.GetPage(&req, p, &list, &count) + if err != nil { + e.Error(500, err, "查询失败") + return + } + + e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询æˆåŠŸ") +} + +// Get +// @Summary 获å–用户 +// @Description 获å–JSON +// @Tags 用户 +// @Param userId path int true "用户编ç " +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/sys-user/{userId} [get] +// @Security Bearer +func (e SysUser) Get(c *gin.Context) { + s := service.SysUser{} + req :=dto.SysUserById{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req, nil). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + var object models.SysUser + //æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + err = s.Get(&req, p, &object) + if err != nil { + e.Error(http.StatusUnprocessableEntity, err, "查询失败") + return + } + e.OK(object, "查询æˆåŠŸ") +} + +// Insert +// @Summary 创建用户 +// @Description 获å–JSON +// @Tags 用户 +// @Accept application/json +// @Product application/json +// @Param data body dto.SysUserInsertReq true "用户数æ®" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/sys-user [post] +// @Security Bearer +func (e SysUser) Insert(c *gin.Context) { + s := service.SysUser{} + req :=dto.SysUserInsertReq{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req, binding.JSON). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + // 设置创建人 + req.SetCreateBy(user.GetUserId(c)) + err = s.Insert(&req) + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + e.OK(req.GetId(), "创建æˆåŠŸ") +} + +// Update +// @Summary ä¿®æ”¹ç”¨æˆ·æ•°æ® +// @Description 获å–JSON +// @Tags 用户 +// @Accept application/json +// @Product application/json +// @Param data body dto.SysUserUpdateReq true "body" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/sys-user/{userId} [put] +// @Security Bearer +func (e SysUser) Update(c *gin.Context) { + s := service.SysUser{} + req :=dto.SysUserUpdateReq{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + req.SetUpdateBy(user.GetUserId(c)) + + //æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + + err = s.Update(&req, p) + if err != nil { + e.Logger.Error(err) + return + } + e.OK(req.GetId(), "æ›´æ–°æˆåŠŸ") +} + +// Delete +// @Summary åˆ é™¤ç”¨æˆ·æ•°æ® +// @Description åˆ é™¤æ•°æ® +// @Tags 用户 +// @Param userId path int true "userId" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/sys-user/{userId} [delete] +// @Security Bearer +func (e SysUser) Delete(c *gin.Context) { + s := service.SysUser{} + req :=dto.SysUserById{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req, binding.JSON). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + // 设置编辑人 + req.SetUpdateBy(user.GetUserId(c)) + + // æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + + err = s.Remove(&req, p) + if err != nil { + e.Logger.Error(err) + return + } + e.OK(req.GetId(), "åˆ é™¤æˆåŠŸ") +} + +// InsetAvatar +// @Summary ä¿®æ”¹å¤´åƒ +// @Description 获å–JSON +// @Tags 个人ä¸å¿ƒ +// @Accept multipart/form-data +// @Param file formData file true "file" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/user/avatar [post] +// @Security Bearer +func (e SysUser) InsetAvatar(c *gin.Context) { + s := service.SysUser{} + req :=dto.UpdateSysUserAvatarReq{} + err := e.MakeContext(c). + MakeOrm(). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + // æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + form, _ := c.MultipartForm() + files := form.File["upload[]"] + guid := uuid.New().String() + filPath := "static/uploadfile/" + guid + ".jpg" + for _, file := range files { + e.Logger.Debugf("upload avatar file: %s", file.Filename) + // ä¸Šä¼ æ–‡ä»¶è‡³æŒ‡å®šç›®å½• + err = c.SaveUploadedFile(file, filPath) + if err != nil { + e.Logger.Errorf("save file error, %s", err.Error()) + e.Error(500, err, "") + return + } + } + req.UserId = p.UserId + req.Avatar = "/" + filPath + + err = s.UpdateAvatar(&req, p) + if err != nil { + e.Logger.Error(err) + return + } + e.OK(filPath, "修改æˆåŠŸ") +} + +// UpdateStatus ä¿®æ”¹ç”¨æˆ·çŠ¶æ€ +// @Summary ä¿®æ”¹ç”¨æˆ·çŠ¶æ€ +// @Description 获å–JSON +// @Tags 用户 +// @Accept application/json +// @Product application/json +// @Param data body dto.UpdateSysUserStatusReq true "body" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/user/status [put] +// @Security Bearer +func (e SysUser) UpdateStatus(c *gin.Context) { + s := service.SysUser{} + req :=dto.UpdateSysUserStatusReq{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req, binding.JSON, nil). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + req.SetUpdateBy(user.GetUserId(c)) + + //æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + + err = s.UpdateStatus(&req, p) + if err != nil { + e.Logger.Error(err) + return + } + e.OK(req.GetId(), "æ›´æ–°æˆåŠŸ") +} + +// ResetPwd é‡ç½®ç”¨æˆ·å¯†ç +// @Summary é‡ç½®ç”¨æˆ·å¯†ç +// @Description 获å–JSON +// @Tags 用户 +// @Accept application/json +// @Product application/json +// @Param data body dto.ResetSysUserPwdReq true "body" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/user/pwd/reset [put] +// @Security Bearer +func (e SysUser) ResetPwd(c *gin.Context) { + s := service.SysUser{} + req :=dto.ResetSysUserPwdReq{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req, binding.JSON). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + req.SetUpdateBy(user.GetUserId(c)) + + //æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + + err = s.ResetPwd(&req, p) + if err != nil { + e.Logger.Error(err) + return + } + e.OK(req.GetId(), "æ›´æ–°æˆåŠŸ") +} + +// UpdatePwd +// @Summary é‡ç½®å¯†ç +// @Description 获å–JSON +// @Tags 用户 +// @Accept application/json +// @Product application/json +// @Param data body dto.PassWord true "body" +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/user/pwd/set [put] +// @Security Bearer +func (e SysUser) UpdatePwd(c *gin.Context) { + s := service.SysUser{} + req :=dto.PassWord{} + err := e.MakeContext(c). + MakeOrm(). + Bind(&req). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + // æ•°æ®æƒé™æ£€æŸ¥ + p := actions.GetPermissionFromContext(c) + + err = s.UpdatePwd(user.GetUserId(c), req.OldPassword, req.NewPassword, p) + if err != nil { + e.Logger.Error(err) + e.Error(http.StatusForbidden, err, "密ç 修改失败") + return + } + e.OK(nil, "密ç 修改æˆåŠŸ") +} + +// GetProfile +// @Summary 获å–个人ä¸å¿ƒç”¨æˆ· +// @Description 获å–JSON +// @Tags 个人ä¸å¿ƒ +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/user/profile [get] +// @Security Bearer +func (e SysUser) GetProfile(c *gin.Context) { + s := service.SysUser{} + req :=dto.SysUserById{} + err := e.MakeContext(c). + MakeOrm(). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + + req.Id = user.GetUserId(c) + + sysUser := models.SysUser{} + roles := make([]models.SysRole, 0) + posts := make([]models.SysPost, 0) + err = s.GetProfile(&req, &sysUser, &roles, &posts) + if err != nil { + e.Logger.Errorf("get user profile error, %s", err.Error()) + e.Error(500, err, "获å–用户信æ¯å¤±è´¥") + return + } + e.OK(gin.H{ + "user": sysUser, + "roles": roles, + "posts": posts, + }, "查询æˆåŠŸ") +} + +// GetInfo +// @Summary 获å–ä¸ªäººä¿¡æ¯ +// @Description 获å–JSON +// @Tags 个人ä¸å¿ƒ +// @Success 200 {string} string "{"code": 200, "data": [...]}" +// @Router /api/v1/getinfo [get] +// @Security Bearer +func (e SysUser) GetInfo(c *gin.Context) { + req :=dto.SysUserById{} + s := service.SysUser{} + r := service.SysRole{} + err := e.MakeContext(c). + MakeOrm(). + MakeService(&r.Service). + MakeService(&s.Service). + Errors + if err != nil { + e.Logger.Error(err) + e.Error(500, err, err.Error()) + return + } + p := actions.GetPermissionFromContext(c) + var roles = make([]string, 1) + roles[0] = user.GetRoleName(c) + var permissions = make([]string, 1) + permissions[0] = "*:*:*" + var buttons = make([]string, 1) + buttons[0] = "*:*:*" + + var mp = make(map[string]interface{}) + mp["roles"] = roles + if user.GetRoleName(c) == "admin" || user.GetRoleName(c) == "系统管ç†å‘˜" { + mp["permissions"] = permissions + mp["buttons"] = buttons + } else { + list, _ := r.GetById(user.GetRoleId(c)) + mp["permissions"] = list + mp["buttons"] = list + } + sysUser := models.SysUser{} + req.Id = user.GetUserId(c) + err = s.Get(&req, p, &sysUser) + if err != nil { + e.Error(http.StatusUnauthorized, err, "登录失败") + return + } + mp["introduction"] = " am a super administrator" + mp["avatar"] = "https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif" + if sysUser.Avatar != "" { + mp["avatar"] = sysUser.Avatar + } + mp["userName"] = sysUser.NickName + mp["userId"] = sysUser.UserId + mp["deptId"] = sysUser.DeptId + mp["name"] = sysUser.NickName + mp["code"] = 200 + e.OK(mp, "") +} \ No newline at end of file diff --git a/app/operate/router/org_club_player.go b/app/operate/router/org_club_player.go new file mode 100644 index 0000000..6adb00f --- /dev/null +++ b/app/operate/router/org_club_player.go @@ -0,0 +1,24 @@ +package router + +import ( + "github.com/gin-gonic/gin" + jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" + + "go-admin/app/operate/apis" + "go-admin/common/middleware" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerOrgClubPlayerRouter) +} + +// registerOrgClubPlayerRouter +func registerOrgClubPlayerRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.OrgClubPlayer{} + r := v1.Group("/org-club-player").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetPage) + r.GET("get-match", api.GetPageMatch) + r.GET("/:id", api.Get) + } +} \ No newline at end of file diff --git a/app/operate/router/org_club_team.go b/app/operate/router/org_club_team.go new file mode 100644 index 0000000..9113200 --- /dev/null +++ b/app/operate/router/org_club_team.go @@ -0,0 +1,24 @@ +package router + +import ( + "github.com/gin-gonic/gin" + jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" + + "go-admin/app/operate/apis" + "go-admin/common/middleware" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerOrgClubTeamRouter) +} + +// registerOrgClubTeamRouter +func registerOrgClubTeamRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.OrgClubTeam{} + r := v1.Group("/org-club-team").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetPage) + r.GET("get-match", api.GetPageMatch) + r.GET("/:id", api.Get) + } +} \ No newline at end of file diff --git a/app/operate/router/org_club_user.go b/app/operate/router/org_team_club.go similarity index 50% rename from app/operate/router/org_club_user.go rename to app/operate/router/org_team_club.go index 158bdb6..584ded3 100644 --- a/app/operate/router/org_club_user.go +++ b/app/operate/router/org_team_club.go @@ -9,18 +9,15 @@ import ( ) func init() { - routerCheckRole = append(routerCheckRole, registerOrgClubUserRouter) + routerCheckRole = append(routerCheckRole, registerOrgTeamClubRouter) } -// registerOrgClubUserRouter -func registerOrgClubUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { - api := apis.OrgClubUser{} - r := v1.Group("/org-club-user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) +// registerOrgTeamClubRouter +func registerOrgTeamClubRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.OrgTeamClub{} + r := v1.Group("/org-team-club").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) { - r.GET("", api.GetPage) r.GET("/:id", api.Get) - r.POST("", api.Insert) r.PUT("/:id", api.Update) - r.DELETE("", api.Delete) } } \ No newline at end of file diff --git a/app/operate/router/org_team_match.go b/app/operate/router/org_team_match.go new file mode 100644 index 0000000..1d45635 --- /dev/null +++ b/app/operate/router/org_team_match.go @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" + + "go-admin/app/operate/apis" + "go-admin/common/middleware" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerOrgTeamMatchRouter) +} + +// registerOrgTeamMatchRouter +func registerOrgTeamMatchRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.OrgTeamMatch{} + r := v1.Group("/org-team-match").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetPage) + r.GET("/:id", api.GetPlayers) + r.GET("/get-players-is-set/:id", api.GetPlayersIsSet) + r.PUT("/:id", api.UpdatePlayers) + } +} \ No newline at end of file diff --git a/app/operate/router/org_team_match_evaluate.go b/app/operate/router/org_team_match_evaluate.go new file mode 100644 index 0000000..4e09db8 --- /dev/null +++ b/app/operate/router/org_team_match_evaluate.go @@ -0,0 +1,25 @@ +package router + +import ( + "github.com/gin-gonic/gin" + jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" + + "go-admin/app/operate/apis" + "go-admin/common/middleware" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerOrgTeamMatchEvaluateRouter) +} + +// registerOrgTeamMatchEvaluateRouter +func registerOrgTeamMatchEvaluateRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.OrgTeamMatchEvaluate{} + r := v1.Group("/org-team-match-evaluate").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetPage) + r.GET("/get-match", api.GetPageMatch) + r.GET("/:id", api.Get) + r.PUT("/:id", api.Update) + } +} \ No newline at end of file diff --git a/app/operate/router/org_team_player.go b/app/operate/router/org_team_player.go new file mode 100644 index 0000000..f8f23dc --- /dev/null +++ b/app/operate/router/org_team_player.go @@ -0,0 +1,24 @@ +package router + +import ( + "github.com/gin-gonic/gin" + jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" + + "go-admin/app/operate/apis" + "go-admin/common/middleware" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerOrgTeamPlayerRouter) +} + +// registerOrgTeamPlayerRouter +func registerOrgTeamPlayerRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.OrgTeamPlayer{} + r := v1.Group("/org-team-player").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetPage) + r.GET("get-match", api.GetPageMatch) + r.GET("/:id", api.Get) + } +} \ No newline at end of file diff --git a/app/operate/router/org_team_team.go b/app/operate/router/org_team_team.go new file mode 100644 index 0000000..13f1d9f --- /dev/null +++ b/app/operate/router/org_team_team.go @@ -0,0 +1,24 @@ +package router + +import ( + "github.com/gin-gonic/gin" + jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" + + "go-admin/app/operate/apis" + "go-admin/common/middleware" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerOrgTeamTeamRouter) +} + +// registerOrgTeamTeamRouter +func registerOrgTeamTeamRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.OrgTeamTeam{} + r := v1.Group("/org-team-team").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()) + { + r.GET("", api.GetPage) + r.GET("get-match", api.GetPageMatch) + r.GET("/:id", api.Get) + } +} \ No newline at end of file diff --git a/app/operate/router/org_user.go b/app/operate/router/org_user.go new file mode 100644 index 0000000..4a545a6 --- /dev/null +++ b/app/operate/router/org_user.go @@ -0,0 +1,39 @@ +package router + +import ( + "github.com/gin-gonic/gin" + jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth" + "go-admin/app/admin/apis" + "go-admin/common/actions" + "go-admin/common/middleware" +) + +func init() { + routerCheckRole = append(routerCheckRole, registerSysUserRouter) +} + +// 需认è¯çš„路由代ç +func registerSysUserRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { + api := apis.SysUser{} + r := v1.Group("/sys-user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction()) + { + r.GET("", api.GetPage) + r.GET("/:id", api.Get) + r.POST("", api.Insert) + r.PUT("", api.Update) + r.DELETE("", api.Delete) + } + + user := v1.Group("/user").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole()).Use(actions.PermissionAction()) + { + user.GET("/profile", api.GetProfile) + user.POST("/avatar", api.InsetAvatar) + user.PUT("/pwd/set", api.UpdatePwd) + user.PUT("/pwd/reset", api.ResetPwd) + user.PUT("/status", api.UpdateStatus) + } + v1auth := v1.Group("").Use(authMiddleware.MiddlewareFunc()) + { + v1auth.GET("/getinfo", api.GetInfo) + } +} \ No newline at end of file -- 2.18.1