From 3833918e5f3bc03188c53d2f4c49aedd467995a9 Mon Sep 17 00:00:00 2001 From: yangduo Date: Fri, 16 Aug 2024 15:53:16 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/adminserver/api/v1/system/gameswitch.go | 9 ++++++--- server/adminserver/model/system/gameswitch.go | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server/adminserver/api/v1/system/gameswitch.go b/server/adminserver/api/v1/system/gameswitch.go index 87083fe2..ec949649 100644 --- a/server/adminserver/api/v1/system/gameswitch.go +++ b/server/adminserver/api/v1/system/gameswitch.go @@ -81,6 +81,7 @@ func (this *GameSwitchApi) List(c *gin.Context) { if exist { p.Remark = desc } + p.AuditOpen = q5.SafeToInt32(pg.Rows.GetByName("audit_is_open")) p.CreateTime = q5.SafeToInt32(pg.Rows.GetByName("createtime")) p.ModifyTime = q5.SafeToInt32(pg.Rows.GetByName("modifytime")) } @@ -137,9 +138,10 @@ func (this *GameSwitchApi) Add(c *gin.Context) { func (this *GameSwitchApi) Edit(c *gin.Context) { req := struct { - Name string `binding:"required" json:"switch_name"` - Open *int32 `binding:"required" json:"is_open"` - Remark string `json:"remark"` + Name string `binding:"required" json:"switch_name"` + Open *int32 `binding:"required" json:"is_open"` + AuditOpen *int32 `binding:"required" json:"audit_is_open"` + Remark string `json:"remark"` }{} if err := c.ShouldBindJSON(&req); err != nil { c.JSON(http.StatusOK, gin.H{ @@ -168,6 +170,7 @@ func (this *GameSwitchApi) Edit(c *gin.Context) { nowDaySeconds := int32(f5.GetApp().GetRealSeconds()) gswitch.Opened = *req.Open + gswitch.AuditOpen = *req.AuditOpen gswitch.ModifyTime = nowDaySeconds if err := db.Where("switch_name = ?", req.Name).Save(gswitch).Error; err != nil { c.JSON(http.StatusOK, gin.H{ diff --git a/server/adminserver/model/system/gameswitch.go b/server/adminserver/model/system/gameswitch.go index eb84f178..a23373dd 100644 --- a/server/adminserver/model/system/gameswitch.go +++ b/server/adminserver/model/system/gameswitch.go @@ -4,6 +4,7 @@ type GameSwitch struct { Idx int64 `gorm:"uniqueIndex;comment:idx" json:"idx"` Name string `gorm:"column:switch_name" json:"switch_name"` Opened int32 `gorm:"column:is_open" json:"is_open"` + AuditOpen int32 `gorm:"column:audit_is_open" json:"audit_is_open"` CreateTime int32 `gorm:"column:createtime" json:"createtime"` ModifyTime int32 `gorm:"column:modifytime" json:"modifytime"` }