fix: 游戏创建与打手详情接口未返回数据

AddGamesResp 加 Games 字段,创建后查询回填。Game.Id 加 optional
避免请求解析时要求传 id。getPlayerLogic 初始化 resp 避免 copier
写入 nil 指针。补跑 ent go generate 确保 userfollows schema 与
生成代码一致。
This commit is contained in:
zetaloop
2026-04-05 17:43:57 +08:00
parent 168cec6d57
commit f0048f9e12
11 changed files with 130 additions and 102 deletions
@@ -30,8 +30,7 @@ func NewCreateGameLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
}
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{
game, err := l.svcCtx.GameRpc.AddGames(l.ctx, &pb.AddGamesReq{
Name: req.Name,
Icon: req.Icon,
Category: req.Category,
@@ -42,5 +41,10 @@ func (l *CreateGameLogic) CreateGame(req *types.Game) (resp *types.Game, err err
return nil, errors.New("add game err")
}
return &types.Game{}, nil
return &types.Game{
Id: game.Games.Id,
Name: game.Games.Name,
Icon: game.Games.Icon,
Category: game.Games.Category,
}, nil
}
+2 -2
View File
@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.9.2
// goctl 1.10.1
package types
@@ -7,7 +7,7 @@ type EmptyResp struct {
}
type Game struct {
Id int64 `json:"id"`
Id int64 `json:"id,optional"`
Name string `json:"name"`
Icon string `json:"icon"`
Category string `json:"category"`
+16 -15
View File
@@ -3,11 +3,13 @@ package logic
import (
"context"
"errors"
"juwan-backend/app/game/rpc/internal/models/games"
"juwan-backend/app/snowflake/rpc/snowflake"
"juwan-backend/app/game/rpc/internal/svc"
"juwan-backend/app/game/rpc/pb"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
@@ -44,21 +46,20 @@ func (l *AddGamesLogic) AddGames(in *pb.AddGamesReq) (*pb.AddGamesResp, error) {
return nil, errors.New("add game failed")
}
return &pb.AddGamesResp{}, nil
game, err := l.svcCtx.GameModelRO.Games.Query().Where(games.IDEQ(idResp.Id)).First(l.ctx)
if err != nil {
logx.Errorf("AddGamesLogic.getGamesById err:%v", err)
return nil, errors.New("get game failed")
}
/*
type AddGamesReq struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` //name
Icon string `protobuf:"bytes,2,opt,name=icon,proto3" json:"icon,omitempty"` //icon
Category string `protobuf:"bytes,3,opt,name=category,proto3" json:"category,omitempty"` //category
SortOrder int64 `protobuf:"varint,4,opt,name=sortOrder,proto3" json:"sortOrder,omitempty"` //sortOrder
IsActive bool `protobuf:"varint,5,opt,name=isActive,proto3" json:"isActive,omitempty"` //isActive
CreatedAt int64 `protobuf:"varint,6,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //createdAt
UpdatedAt int64 `protobuf:"varint,7,opt,name=updatedAt,proto3" json:"updatedAt,omitempty"` //updatedAt
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
pbGame := pb.Games{}
err = copier.Copy(&pbGame, &game)
if err != nil {
logx.Errorf("AddGamesLogic.copier err:%v", err)
return nil, errors.New("get game failed")
}
pbGame.CreatedAt = game.CreatedAt.Unix()
pbGame.UpdatedAt = game.UpdatedAt.Unix()
return &pb.AddGamesResp{Games: &pbGame}, nil
}
*/
+87 -78
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v5.29.6
// source: game.proto
// protoc v7.34.1
// source: desc/rpc/game.proto
package pb
@@ -38,7 +38,7 @@ type Games struct {
func (x *Games) Reset() {
*x = Games{}
mi := &file_game_proto_msgTypes[0]
mi := &file_desc_rpc_game_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -50,7 +50,7 @@ func (x *Games) String() string {
func (*Games) ProtoMessage() {}
func (x *Games) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[0]
mi := &file_desc_rpc_game_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -63,7 +63,7 @@ func (x *Games) ProtoReflect() protoreflect.Message {
// Deprecated: Use Games.ProtoReflect.Descriptor instead.
func (*Games) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{0}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{0}
}
func (x *Games) GetId() int64 {
@@ -137,7 +137,7 @@ type AddGamesReq struct {
func (x *AddGamesReq) Reset() {
*x = AddGamesReq{}
mi := &file_game_proto_msgTypes[1]
mi := &file_desc_rpc_game_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -149,7 +149,7 @@ func (x *AddGamesReq) String() string {
func (*AddGamesReq) ProtoMessage() {}
func (x *AddGamesReq) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[1]
mi := &file_desc_rpc_game_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -162,7 +162,7 @@ func (x *AddGamesReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddGamesReq.ProtoReflect.Descriptor instead.
func (*AddGamesReq) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{1}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{1}
}
func (x *AddGamesReq) GetName() string {
@@ -216,13 +216,14 @@ func (x *AddGamesReq) GetUpdatedAt() int64 {
type AddGamesResp struct {
state protoimpl.MessageState `protogen:"open.v1"`
Games *Games `protobuf:"bytes,1,opt,name=games,proto3" json:"games,omitempty"` //games
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AddGamesResp) Reset() {
*x = AddGamesResp{}
mi := &file_game_proto_msgTypes[2]
mi := &file_desc_rpc_game_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -234,7 +235,7 @@ func (x *AddGamesResp) String() string {
func (*AddGamesResp) ProtoMessage() {}
func (x *AddGamesResp) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[2]
mi := &file_desc_rpc_game_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -247,7 +248,14 @@ func (x *AddGamesResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use AddGamesResp.ProtoReflect.Descriptor instead.
func (*AddGamesResp) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{2}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{2}
}
func (x *AddGamesResp) GetGames() *Games {
if x != nil {
return x.Games
}
return nil
}
type UpdateGamesReq struct {
@@ -266,7 +274,7 @@ type UpdateGamesReq struct {
func (x *UpdateGamesReq) Reset() {
*x = UpdateGamesReq{}
mi := &file_game_proto_msgTypes[3]
mi := &file_desc_rpc_game_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -278,7 +286,7 @@ func (x *UpdateGamesReq) String() string {
func (*UpdateGamesReq) ProtoMessage() {}
func (x *UpdateGamesReq) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[3]
mi := &file_desc_rpc_game_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -291,7 +299,7 @@ func (x *UpdateGamesReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateGamesReq.ProtoReflect.Descriptor instead.
func (*UpdateGamesReq) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{3}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{3}
}
func (x *UpdateGamesReq) GetId() int64 {
@@ -358,7 +366,7 @@ type UpdateGamesResp struct {
func (x *UpdateGamesResp) Reset() {
*x = UpdateGamesResp{}
mi := &file_game_proto_msgTypes[4]
mi := &file_desc_rpc_game_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -370,7 +378,7 @@ func (x *UpdateGamesResp) String() string {
func (*UpdateGamesResp) ProtoMessage() {}
func (x *UpdateGamesResp) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[4]
mi := &file_desc_rpc_game_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -383,7 +391,7 @@ func (x *UpdateGamesResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use UpdateGamesResp.ProtoReflect.Descriptor instead.
func (*UpdateGamesResp) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{4}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{4}
}
type DelGamesReq struct {
@@ -395,7 +403,7 @@ type DelGamesReq struct {
func (x *DelGamesReq) Reset() {
*x = DelGamesReq{}
mi := &file_game_proto_msgTypes[5]
mi := &file_desc_rpc_game_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -407,7 +415,7 @@ func (x *DelGamesReq) String() string {
func (*DelGamesReq) ProtoMessage() {}
func (x *DelGamesReq) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[5]
mi := &file_desc_rpc_game_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -420,7 +428,7 @@ func (x *DelGamesReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use DelGamesReq.ProtoReflect.Descriptor instead.
func (*DelGamesReq) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{5}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{5}
}
func (x *DelGamesReq) GetId() int64 {
@@ -438,7 +446,7 @@ type DelGamesResp struct {
func (x *DelGamesResp) Reset() {
*x = DelGamesResp{}
mi := &file_game_proto_msgTypes[6]
mi := &file_desc_rpc_game_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -450,7 +458,7 @@ func (x *DelGamesResp) String() string {
func (*DelGamesResp) ProtoMessage() {}
func (x *DelGamesResp) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[6]
mi := &file_desc_rpc_game_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -463,7 +471,7 @@ func (x *DelGamesResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use DelGamesResp.ProtoReflect.Descriptor instead.
func (*DelGamesResp) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{6}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{6}
}
type GetGamesByIdReq struct {
@@ -475,7 +483,7 @@ type GetGamesByIdReq struct {
func (x *GetGamesByIdReq) Reset() {
*x = GetGamesByIdReq{}
mi := &file_game_proto_msgTypes[7]
mi := &file_desc_rpc_game_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -487,7 +495,7 @@ func (x *GetGamesByIdReq) String() string {
func (*GetGamesByIdReq) ProtoMessage() {}
func (x *GetGamesByIdReq) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[7]
mi := &file_desc_rpc_game_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -500,7 +508,7 @@ func (x *GetGamesByIdReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetGamesByIdReq.ProtoReflect.Descriptor instead.
func (*GetGamesByIdReq) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{7}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{7}
}
func (x *GetGamesByIdReq) GetId() int64 {
@@ -519,7 +527,7 @@ type GetGamesByIdResp struct {
func (x *GetGamesByIdResp) Reset() {
*x = GetGamesByIdResp{}
mi := &file_game_proto_msgTypes[8]
mi := &file_desc_rpc_game_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -531,7 +539,7 @@ func (x *GetGamesByIdResp) String() string {
func (*GetGamesByIdResp) ProtoMessage() {}
func (x *GetGamesByIdResp) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[8]
mi := &file_desc_rpc_game_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -544,7 +552,7 @@ func (x *GetGamesByIdResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetGamesByIdResp.ProtoReflect.Descriptor instead.
func (*GetGamesByIdResp) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{8}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{8}
}
func (x *GetGamesByIdResp) GetGames() *Games {
@@ -572,7 +580,7 @@ type SearchGamesReq struct {
func (x *SearchGamesReq) Reset() {
*x = SearchGamesReq{}
mi := &file_game_proto_msgTypes[9]
mi := &file_desc_rpc_game_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -584,7 +592,7 @@ func (x *SearchGamesReq) String() string {
func (*SearchGamesReq) ProtoMessage() {}
func (x *SearchGamesReq) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[9]
mi := &file_desc_rpc_game_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -597,7 +605,7 @@ func (x *SearchGamesReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchGamesReq.ProtoReflect.Descriptor instead.
func (*SearchGamesReq) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{9}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{9}
}
func (x *SearchGamesReq) GetPage() int64 {
@@ -679,7 +687,7 @@ type SearchGamesResp struct {
func (x *SearchGamesResp) Reset() {
*x = SearchGamesResp{}
mi := &file_game_proto_msgTypes[10]
mi := &file_desc_rpc_game_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -691,7 +699,7 @@ func (x *SearchGamesResp) String() string {
func (*SearchGamesResp) ProtoMessage() {}
func (x *SearchGamesResp) ProtoReflect() protoreflect.Message {
mi := &file_game_proto_msgTypes[10]
mi := &file_desc_rpc_game_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -704,7 +712,7 @@ func (x *SearchGamesResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use SearchGamesResp.ProtoReflect.Descriptor instead.
func (*SearchGamesResp) Descriptor() ([]byte, []int) {
return file_game_proto_rawDescGZIP(), []int{10}
return file_desc_rpc_game_proto_rawDescGZIP(), []int{10}
}
func (x *SearchGamesResp) GetGames() []*Games {
@@ -714,12 +722,11 @@ func (x *SearchGamesResp) GetGames() []*Games {
return nil
}
var File_game_proto protoreflect.FileDescriptor
var File_desc_rpc_game_proto protoreflect.FileDescriptor
const file_game_proto_rawDesc = "" +
const file_desc_rpc_game_proto_rawDesc = "" +
"\n" +
"\n" +
"game.proto\x12\x02pb\"\xd1\x01\n" +
"\x13desc/rpc/game.proto\x12\x02pb\"\xd1\x01\n" +
"\x05Games\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" +
@@ -736,8 +743,9 @@ const file_game_proto_rawDesc = "" +
"\tsortOrder\x18\x04 \x01(\x03R\tsortOrder\x12\x1a\n" +
"\bisActive\x18\x05 \x01(\bR\bisActive\x12\x1c\n" +
"\tcreatedAt\x18\x06 \x01(\x03R\tcreatedAt\x12\x1c\n" +
"\tupdatedAt\x18\a \x01(\x03R\tupdatedAt\"\x0e\n" +
"\fAddGamesResp\"\xda\x01\n" +
"\tupdatedAt\x18\a \x01(\x03R\tupdatedAt\"/\n" +
"\fAddGamesResp\x12\x1f\n" +
"\x05games\x18\x01 \x01(\v2\t.pb.GamesR\x05games\"\xda\x01\n" +
"\x0eUpdateGamesReq\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" +
"\x04name\x18\x02 \x01(\tR\x04name\x12\x12\n" +
@@ -787,19 +795,19 @@ const file_game_proto_rawDesc = "" +
"\vSearchGames\x12\x12.pb.SearchGamesReq\x1a\x13.pb.SearchGamesRespB\x06Z\x04./pbb\x06proto3"
var (
file_game_proto_rawDescOnce sync.Once
file_game_proto_rawDescData []byte
file_desc_rpc_game_proto_rawDescOnce sync.Once
file_desc_rpc_game_proto_rawDescData []byte
)
func file_game_proto_rawDescGZIP() []byte {
file_game_proto_rawDescOnce.Do(func() {
file_game_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_game_proto_rawDesc), len(file_game_proto_rawDesc)))
func file_desc_rpc_game_proto_rawDescGZIP() []byte {
file_desc_rpc_game_proto_rawDescOnce.Do(func() {
file_desc_rpc_game_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_desc_rpc_game_proto_rawDesc), len(file_desc_rpc_game_proto_rawDesc)))
})
return file_game_proto_rawDescData
return file_desc_rpc_game_proto_rawDescData
}
var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_game_proto_goTypes = []any{
var file_desc_rpc_game_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_desc_rpc_game_proto_goTypes = []any{
(*Games)(nil), // 0: pb.Games
(*AddGamesReq)(nil), // 1: pb.AddGamesReq
(*AddGamesResp)(nil), // 2: pb.AddGamesResp
@@ -812,47 +820,48 @@ var file_game_proto_goTypes = []any{
(*SearchGamesReq)(nil), // 9: pb.SearchGamesReq
(*SearchGamesResp)(nil), // 10: pb.SearchGamesResp
}
var file_game_proto_depIdxs = []int32{
0, // 0: pb.GetGamesByIdResp.games:type_name -> pb.Games
0, // 1: pb.SearchGamesResp.games:type_name -> pb.Games
1, // 2: pb.GameService.AddGames:input_type -> pb.AddGamesReq
3, // 3: pb.GameService.UpdateGames:input_type -> pb.UpdateGamesReq
5, // 4: pb.GameService.DelGames:input_type -> pb.DelGamesReq
7, // 5: pb.GameService.GetGamesById:input_type -> pb.GetGamesByIdReq
9, // 6: pb.GameService.SearchGames:input_type -> pb.SearchGamesReq
2, // 7: pb.GameService.AddGames:output_type -> pb.AddGamesResp
4, // 8: pb.GameService.UpdateGames:output_type -> pb.UpdateGamesResp
6, // 9: pb.GameService.DelGames:output_type -> pb.DelGamesResp
8, // 10: pb.GameService.GetGamesById:output_type -> pb.GetGamesByIdResp
10, // 11: pb.GameService.SearchGames:output_type -> pb.SearchGamesResp
7, // [7:12] is the sub-list for method output_type
2, // [2:7] is the sub-list for method input_type
2, // [2:2] is the sub-list for extension type_name
2, // [2:2] is the sub-list for extension extendee
0, // [0:2] is the sub-list for field type_name
var file_desc_rpc_game_proto_depIdxs = []int32{
0, // 0: pb.AddGamesResp.games:type_name -> pb.Games
0, // 1: pb.GetGamesByIdResp.games:type_name -> pb.Games
0, // 2: pb.SearchGamesResp.games:type_name -> pb.Games
1, // 3: pb.GameService.AddGames:input_type -> pb.AddGamesReq
3, // 4: pb.GameService.UpdateGames:input_type -> pb.UpdateGamesReq
5, // 5: pb.GameService.DelGames:input_type -> pb.DelGamesReq
7, // 6: pb.GameService.GetGamesById:input_type -> pb.GetGamesByIdReq
9, // 7: pb.GameService.SearchGames:input_type -> pb.SearchGamesReq
2, // 8: pb.GameService.AddGames:output_type -> pb.AddGamesResp
4, // 9: pb.GameService.UpdateGames:output_type -> pb.UpdateGamesResp
6, // 10: pb.GameService.DelGames:output_type -> pb.DelGamesResp
8, // 11: pb.GameService.GetGamesById:output_type -> pb.GetGamesByIdResp
10, // 12: pb.GameService.SearchGames:output_type -> pb.SearchGamesResp
8, // [8:13] is the sub-list for method output_type
3, // [3:8] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
}
func init() { file_game_proto_init() }
func file_game_proto_init() {
if File_game_proto != nil {
func init() { file_desc_rpc_game_proto_init() }
func file_desc_rpc_game_proto_init() {
if File_desc_rpc_game_proto != nil {
return
}
file_game_proto_msgTypes[9].OneofWrappers = []any{}
file_desc_rpc_game_proto_msgTypes[9].OneofWrappers = []any{}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_game_proto_rawDesc), len(file_game_proto_rawDesc)),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_desc_rpc_game_proto_rawDesc), len(file_desc_rpc_game_proto_rawDesc)),
NumEnums: 0,
NumMessages: 11,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_game_proto_goTypes,
DependencyIndexes: file_game_proto_depIdxs,
MessageInfos: file_game_proto_msgTypes,
GoTypes: file_desc_rpc_game_proto_goTypes,
DependencyIndexes: file_desc_rpc_game_proto_depIdxs,
MessageInfos: file_desc_rpc_game_proto_msgTypes,
}.Build()
File_game_proto = out.File
file_game_proto_goTypes = nil
file_game_proto_depIdxs = nil
File_desc_rpc_game_proto = out.File
file_desc_rpc_game_proto_goTypes = nil
file_desc_rpc_game_proto_depIdxs = nil
}
+3 -3
View File
@@ -1,8 +1,8 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v5.29.6
// source: game.proto
// - protoc v7.34.1
// source: desc/rpc/game.proto
package pb
@@ -271,5 +271,5 @@ var GameService_ServiceDesc = grpc.ServiceDesc{
},
},
Streams: []grpc.StreamDesc{},
Metadata: "game.proto",
Metadata: "desc/rpc/game.proto",
}
@@ -38,6 +38,7 @@ func (l *GetPlayerLogic) GetPlayer(req *types.GetPlayerReq) (resp *types.PlayerP
logx.Errorf("GetPlayerLogic.GetPlayers err: %v", err)
return nil, errors.New("failed to get player details")
}
resp = &types.PlayerProfile{}
err = copier.Copy(resp, &player)
if err != nil {
logx.Errorf("copier.Copy err: %v", err)
+2
View File
@@ -16,7 +16,9 @@ import (
func init() {
userfollowsFields := schema.UserFollows{}.Fields()
_ = userfollowsFields
// userfollowsDescCreatedAt is the schema descriptor for created_at field.
userfollowsDescCreatedAt := userfollowsFields[3].Descriptor()
// userfollows.DefaultCreatedAt holds the default value on creation for the created_at field.
userfollows.DefaultCreatedAt = userfollowsDescCreatedAt.Default.(func() time.Time)
userpreferencesFields := schema.UserPreferences{}.Fields()
_ = userpreferencesFields
@@ -42,6 +42,7 @@ func ValidColumn(column string) bool {
}
var (
// DefaultCreatedAt holds the default value on creation for the "created_at" field.
DefaultCreatedAt func() time.Time
)
@@ -38,6 +38,14 @@ func (_c *UserFollowsCreate) SetCreatedAt(v time.Time) *UserFollowsCreate {
return _c
}
// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
func (_c *UserFollowsCreate) SetNillableCreatedAt(v *time.Time) *UserFollowsCreate {
if v != nil {
_c.SetCreatedAt(*v)
}
return _c
}
// SetID sets the "id" field.
func (_c *UserFollowsCreate) SetID(v int64) *UserFollowsCreate {
_c.mutation.SetID(v)
@@ -77,6 +85,7 @@ func (_c *UserFollowsCreate) ExecX(ctx context.Context) {
}
}
// defaults sets the default values of the builder before save.
func (_c *UserFollowsCreate) defaults() {
if _, ok := _c.mutation.CreatedAt(); !ok {
v := userfollows.DefaultCreatedAt()
+1 -1
View File
@@ -4,7 +4,7 @@ import "common.api"
type (
Game {
Id int64 `json:"id"`
Id int64 `json:"id,optional"`
Name string `json:"name"`
Icon string `json:"icon"`
Category string `json:"category"`
+1
View File
@@ -31,6 +31,7 @@ message AddGamesReq {
}
message AddGamesResp {
Games games = 1; //games
}
message UpdateGamesReq {