fix: some api bug

This commit is contained in:
wwweww
2026-03-31 22:12:06 +08:00
parent c5ff4f0216
commit e7970ac25f
219 changed files with 16195 additions and 2126 deletions
@@ -0,0 +1,46 @@
// Code scaffolded by goctl. Safe to edit.
// goctl 1.9.2
package game
import (
"context"
"errors"
"juwan-backend/app/game/rpc/pb"
"juwan-backend/app/game/api/internal/svc"
"juwan-backend/app/game/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type CreateGameLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
// 创建游戏
func NewCreateGameLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateGameLogic {
return &CreateGameLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *CreateGameLogic) CreateGame(req *types.Game) (resp *types.Game, err error) {
// todo: add your logic here and delete this line
_, err = l.svcCtx.GameRpc.AddGames(l.ctx, &pb.AddGamesReq{
Name: req.Name,
Icon: req.Icon,
Category: req.Category,
IsActive: false,
})
if err != nil {
logx.Errorf("add game err: %v", err)
return nil, errors.New("add game err")
}
return &types.Game{}, nil
}
@@ -35,6 +35,7 @@ func (l *ListGamesLogic) ListGames(req *types.PageReq) (resp *types.GameListResp
Limit: req.Limit,
})
if err != nil {
logx.Errorf("ListGames err:%v", err)
return nil, err
}