fix: api descript
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package game
|
||||
|
||||
import (
|
||||
"context"
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
"juwan-backend/app/game/api/internal/types"
|
||||
"juwan-backend/app/game/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetGameLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 获取游戏详情
|
||||
func NewGetGameLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetGameLogic {
|
||||
return &GetGameLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *GetGameLogic) GetGame(req *types.GetGameReq) (resp *types.Game) {
|
||||
// todo: add your logic here and delete this line
|
||||
game, err := l.svcCtx.GameRpc.GetGamesById(l.ctx, &pb.GetGamesByIdReq{Id: req.Id})
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &types.Game{
|
||||
Id: game.Games.Id,
|
||||
Name: game.Games.Name,
|
||||
Icon: game.Games.Icon,
|
||||
Category: game.Games.Category,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
// goctl 1.9.2
|
||||
|
||||
package game
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/game/api/internal/svc"
|
||||
"juwan-backend/app/game/api/internal/types"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type ListGamesLogic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
// 获取游戏列表
|
||||
func NewListGamesLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListGamesLogic {
|
||||
return &ListGamesLogic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *ListGamesLogic) ListGames(req *types.PageReq) (resp *types.GameListResp, err error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user