19cc7a778c
- Deleted old gRPC service definitions in `game_grpc.pb.go` and `public.go`. - Added new API server implementations for objectstory, player, and shop services. - Introduced configuration files for new APIs in `etc/*.yaml`. - Created main entry points for each service in `objectstory.go`, `player.go`, and `shop.go`. - Removed unused user update handler and user API files. - Added utility functions for context management and HTTP header parsing. - Introduced PostgreSQL backup configuration in `backup/postgreSql.yaml`.
43 lines
966 B
Go
43 lines
966 B
Go
// 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, err error) {
|
|
// 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, err
|
|
}
|
|
return &types.Game{
|
|
Id: game.Games.Id,
|
|
Name: game.Games.Name,
|
|
Icon: game.Games.Icon,
|
|
Category: game.Games.Category,
|
|
}, nil
|
|
}
|