This commit is contained in:
yangduo 2024-08-05 17:09:38 +08:00
parent 377f7b422b
commit a6fefc579d
4 changed files with 12 additions and 9 deletions

View File

@ -18,7 +18,7 @@ func (bpa *BlockPlayerApi) List(c *gin.Context) {
req := struct { req := struct {
PageDto system.PageDto `json:"page_dto"` PageDto system.PageDto `json:"page_dto"`
}{} }{}
if err := c.ShouldBindQuery(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"code": 1, "code": 1,
"message": err.Error(), "message": err.Error(),
@ -52,12 +52,12 @@ func (bpa *BlockPlayerApi) List(c *gin.Context) {
q5.AppendSlice(&result, p) q5.AppendSlice(&result, p)
} }
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{
"code": 0, "code": 0,
"message": "获取成功", "message": "获取成功",
"data": result, "data": result,
"total": pg.Total, "total": pg.Total,
"totalpage": pg.TotalPages, "total_page": pg.TotalPages,
"curpage": pg.CurrentPage, "cur_page": pg.CurrentPage,
}) })
}) })
} }
@ -105,7 +105,7 @@ func (bpa *BlockPlayerApi) Add(c *gin.Context) {
func (bpa *BlockPlayerApi) Edit(c *gin.Context) { func (bpa *BlockPlayerApi) Edit(c *gin.Context) {
req := struct { req := struct {
Account string `binding:"required" json:"account_id"` Account string `binding:"required" json:"account_id"`
Blocked int32 `binding:"required" json:"blocked"` Blocked int32 `json:"blocked"`
}{} }{}
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
c.JSON(http.StatusOK, gin.H{ c.JSON(http.StatusOK, gin.H{

View File

@ -1,7 +1,7 @@
package system package system
type BlockPlayer struct { type BlockPlayer struct {
Account string `gorm:"column:account_id" json:"account_id,string"` Account string `gorm:"column:account_id" json:"account_id"`
Blocked int32 `gorm:"column:blocked" json:"blocked"` Blocked int32 `gorm:"column:blocked" json:"blocked"`
CreateTime int32 `gorm:"column:createtime" json:"createtime"` CreateTime int32 `gorm:"column:createtime" json:"createtime"`
ModifyTime int32 `gorm:"column:modifytime" json:"modifytime"` ModifyTime int32 `gorm:"column:modifytime" json:"modifytime"`

View File

@ -27,6 +27,8 @@ func (this *routerMgr) Init() {
this.system.InitPlayerRouter(priGroup) this.system.InitPlayerRouter(priGroup)
this.system.InitNFTRouter(priGroup) this.system.InitNFTRouter(priGroup)
this.system.InitGameSwitchRouter(priGroup) this.system.InitGameSwitchRouter(priGroup)
this.system.InitBlockPlayerRouter(priGroup)
f5.GetSysLog().Info("routerMgr.init") f5.GetSysLog().Info("routerMgr.init")
} }

View File

@ -11,4 +11,5 @@ type RouterGroup struct {
PlayerRouter PlayerRouter
NFTRouter NFTRouter
GameSwitchRoute GameSwitchRoute
BlockPlayerRoute
} }