From 627aa8dcda4bb8df9e1588fa3b80b1ab09556abf Mon Sep 17 00:00:00 2001 From: chy <2463300564@qq.com> Date: Wed, 25 Jun 2025 15:10:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B8=B8=E6=88=8F=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E7=BC=96=E8=BE=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/game/v1/game.go | 6 +++--- internal/controller/game/game_v1_update.go | 11 ++++++----- internal/logic/game/game.go | 3 +-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/game/v1/game.go b/api/game/v1/game.go index fb89b1d..88dc506 100644 --- a/api/game/v1/game.go +++ b/api/game/v1/game.go @@ -30,9 +30,9 @@ type CreateRes struct { type UpdateReq struct { g.Meta `path:"/game" method:"put" tags:"Game" summary:"(系统)更新游戏"` - GameID int64 `json:"gameId" v:"required#游戏ID不能为空" dc:"游戏ID"` - GameName string `json:"gameName" v:"required#游戏名称不能为空" dc:"游戏名称"` - GameCode string `json:"gameCode" v:"required#游戏代号不能为空" dc:"游戏代号"` + GameID int64 `json:"gameId" dc:"游戏ID"` + GameName string `json:"gameName" dc:"游戏名称"` + GameCode string `json:"gameCode" dc:"游戏代号"` Avatar string `json:"avatar" dc:"游戏图标"` Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"` BoundType int64 `json:"boundType" v:"required#绑定类型不能为空" dc:"绑定类型"` diff --git a/internal/controller/game/game_v1_update.go b/internal/controller/game/game_v1_update.go index f8b93d5..cb62572 100644 --- a/internal/controller/game/game_v1_update.go +++ b/internal/controller/game/game_v1_update.go @@ -10,11 +10,12 @@ import ( func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) { out, err := service.Game().UpdateGame(ctx, &model.UpdateGameIn{ - GameId: req.GameID, - GameName: req.GameName, - GameCode: req.GameCode, - Avatar: req.Avatar, - Id: req.Id, + GameId: req.GameID, + GameName: req.GameName, + GameCode: req.GameCode, + Avatar: req.Avatar, + Id: req.Id, + BoundType: req.BoundType, }) if err != nil { return nil, err diff --git a/internal/logic/game/game.go b/internal/logic/game/game.go index 62e8142..a1ced66 100644 --- a/internal/logic/game/game.go +++ b/internal/logic/game/game.go @@ -80,7 +80,6 @@ func (s *sGame) CreateGame(ctx context.Context, in *model.AddGameIn) (out *model } func (s *sGame) UpdateGame(ctx context.Context, in *model.UpdateGameIn) (out *model.UpdateGameOut, err error) { - // 判断游戏是否存在 exist, err := dao.Games.Ctx(ctx).Where(do.Games{Id: in.Id}).Exist() if err != nil { @@ -118,7 +117,7 @@ func (s *sGame) UpdateGame(ctx context.Context, in *model.UpdateGameIn) (out *mo return nil, ecode.Params.Sub("游戏编码已存在") } - _, err = dao.Games.Ctx(ctx).Where(do.Games{Id: in.Id}).Update(do.Games{ + _, err = dao.Games.Ctx(ctx).Where(do.Games{Id: in.Id}).OmitEmptyData().Update(do.Games{ GameId: in.GameId, GameName: in.GameName, GameCode: in.GameCode,