diff --git a/mgrsrv/api/webapi_worldsrv.go b/mgrsrv/api/webapi_worldsrv.go index 51bc987..121270b 100644 --- a/mgrsrv/api/webapi_worldsrv.go +++ b/mgrsrv/api/webapi_worldsrv.go @@ -243,6 +243,8 @@ func init() { admin.MyAdminApp.Route("/api/player/update_tel", WorldSrvApi) // 删除账号 admin.MyAdminApp.Route("/api/player/delete", WorldSrvApi) + //添加道具 + admin.MyAdminApp.Route("/api/player/AddItem", WorldSrvApi) } func Stats() map[string]ApiStats { diff --git a/protocol/webapi/webapi.pb.go b/protocol/webapi/webapi.pb.go index 28e0f92..2234887 100644 --- a/protocol/webapi/webapi.pb.go +++ b/protocol/webapi/webapi.pb.go @@ -8494,6 +8494,125 @@ func (x *SAPlayerInviteLink) GetLink() string { return "" } +//增加道具 [/api/player/AddItem] +type ASAddItemById struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Snid int32 `protobuf:"varint,1,opt,name=Snid,proto3" json:"Snid,omitempty"` // 玩家id + Platform string `protobuf:"bytes,2,opt,name=Platform,proto3" json:"Platform,omitempty"` // 平台id + ItemInfo []*ItemInfo `protobuf:"bytes,3,rep,name=ItemInfo,proto3" json:"ItemInfo,omitempty"` //道具 +} + +func (x *ASAddItemById) Reset() { + *x = ASAddItemById{} + if protoimpl.UnsafeEnabled { + mi := &file_webapi_proto_msgTypes[125] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ASAddItemById) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ASAddItemById) ProtoMessage() {} + +func (x *ASAddItemById) ProtoReflect() protoreflect.Message { + mi := &file_webapi_proto_msgTypes[125] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ASAddItemById.ProtoReflect.Descriptor instead. +func (*ASAddItemById) Descriptor() ([]byte, []int) { + return file_webapi_proto_rawDescGZIP(), []int{125} +} + +func (x *ASAddItemById) GetSnid() int32 { + if x != nil { + return x.Snid + } + return 0 +} + +func (x *ASAddItemById) GetPlatform() string { + if x != nil { + return x.Platform + } + return "" +} + +func (x *ASAddItemById) GetItemInfo() []*ItemInfo { + if x != nil { + return x.ItemInfo + } + return nil +} + +type SAAddItemById struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Tag TagCode `protobuf:"varint,1,opt,name=Tag,proto3,enum=webapi.TagCode" json:"Tag,omitempty"` //错误码 + Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"` //错误信息(选填) +} + +func (x *SAAddItemById) Reset() { + *x = SAAddItemById{} + if protoimpl.UnsafeEnabled { + mi := &file_webapi_proto_msgTypes[126] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SAAddItemById) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SAAddItemById) ProtoMessage() {} + +func (x *SAAddItemById) ProtoReflect() protoreflect.Message { + mi := &file_webapi_proto_msgTypes[126] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SAAddItemById.ProtoReflect.Descriptor instead. +func (*SAAddItemById) Descriptor() ([]byte, []int) { + return file_webapi_proto_rawDescGZIP(), []int{126} +} + +func (x *SAAddItemById) GetTag() TagCode { + if x != nil { + return x.Tag + } + return TagCode_UNKNOWN +} + +func (x *SAAddItemById) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + var File_webapi_proto protoreflect.FileDescriptor var file_webapi_proto_rawDesc = []byte{ @@ -9409,23 +9528,34 @@ var file_webapi_proto_rawDesc = []byte{ 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x03, 0x54, 0x61, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x2a, 0xce, 0x01, 0x0a, 0x07, 0x54, 0x61, 0x67, - 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, - 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x10, 0x01, 0x12, 0x0a, - 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x49, - 0x47, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x52, - 0x4f, 0x54, 0x4f, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x04, - 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x59, 0x42, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x45, 0x52, 0x52, - 0x4f, 0x52, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x59, 0x42, 0x5f, 0x43, 0x4f, 0x44, 0x45, - 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x10, 0x06, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x6c, 0x61, 0x79, - 0x5f, 0x4e, 0x6f, 0x74, 0x45, 0x58, 0x49, 0x53, 0x54, 0x10, 0x07, 0x12, 0x09, 0x0a, 0x05, 0x4c, - 0x69, 0x6d, 0x69, 0x74, 0x10, 0x08, 0x12, 0x0c, 0x0a, 0x08, 0x54, 0x65, 0x6c, 0x45, 0x78, 0x69, - 0x73, 0x74, 0x10, 0x09, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x4e, - 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x54, 0x65, 0x6c, - 0x4e, 0x6f, 0x74, 0x42, 0x69, 0x6e, 0x64, 0x10, 0x0b, 0x42, 0x26, 0x5a, 0x24, 0x6d, 0x6f, 0x6e, - 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x61, 0x6d, - 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, 0x77, 0x65, 0x62, 0x61, 0x70, - 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x09, 0x52, 0x04, 0x4c, 0x69, 0x6e, 0x6b, 0x22, 0x6d, 0x0a, 0x0d, 0x41, 0x53, 0x41, 0x64, + 0x64, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x6e, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x6e, 0x69, 0x64, 0x12, 0x1a, 0x0a, + 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x2c, 0x0a, 0x08, 0x49, 0x74, 0x65, + 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x77, 0x65, + 0x62, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x49, + 0x74, 0x65, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x44, 0x0a, 0x0d, 0x53, 0x41, 0x41, 0x64, 0x64, + 0x49, 0x74, 0x65, 0x6d, 0x42, 0x79, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x03, 0x54, 0x61, 0x67, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x2e, 0x54, + 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x03, 0x54, 0x61, 0x67, 0x12, 0x10, 0x0a, 0x03, 0x4d, + 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x2a, 0xce, 0x01, + 0x0a, 0x07, 0x54, 0x61, 0x67, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, + 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x55, 0x43, 0x43, 0x45, 0x53, + 0x53, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x46, 0x41, 0x49, 0x4c, 0x45, 0x44, 0x10, 0x02, 0x12, + 0x0e, 0x0a, 0x0a, 0x53, 0x49, 0x47, 0x4e, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x03, 0x12, + 0x14, 0x0a, 0x10, 0x50, 0x52, 0x4f, 0x54, 0x4f, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x45, 0x52, + 0x52, 0x4f, 0x52, 0x10, 0x04, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x59, 0x42, 0x5f, 0x44, 0x41, 0x54, + 0x41, 0x5f, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x4a, 0x59, 0x42, + 0x5f, 0x43, 0x4f, 0x44, 0x45, 0x5f, 0x45, 0x58, 0x49, 0x53, 0x54, 0x10, 0x06, 0x12, 0x11, 0x0a, + 0x0d, 0x50, 0x6c, 0x61, 0x79, 0x5f, 0x4e, 0x6f, 0x74, 0x45, 0x58, 0x49, 0x53, 0x54, 0x10, 0x07, + 0x12, 0x09, 0x0a, 0x05, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x10, 0x08, 0x12, 0x0c, 0x0a, 0x08, 0x54, + 0x65, 0x6c, 0x45, 0x78, 0x69, 0x73, 0x74, 0x10, 0x09, 0x12, 0x13, 0x0a, 0x0f, 0x41, 0x63, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x10, 0x0a, 0x12, 0x0e, + 0x0a, 0x0a, 0x54, 0x65, 0x6c, 0x4e, 0x6f, 0x74, 0x42, 0x69, 0x6e, 0x64, 0x10, 0x0b, 0x42, 0x26, + 0x5a, 0x24, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x2e, 0x67, 0x61, 0x6d, 0x65, 0x73, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x2f, + 0x77, 0x65, 0x62, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -9441,7 +9571,7 @@ func file_webapi_proto_rawDescGZIP() []byte { } var file_webapi_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_webapi_proto_msgTypes = make([]protoimpl.MessageInfo, 125) +var file_webapi_proto_msgTypes = make([]protoimpl.MessageInfo, 127) var file_webapi_proto_goTypes = []interface{}{ (TagCode)(0), // 0: webapi.TagCode (*SAPlatformInfo)(nil), // 1: webapi.SAPlatformInfo @@ -9569,92 +9699,94 @@ var file_webapi_proto_goTypes = []interface{}{ (*SAPlayerDelete)(nil), // 123: webapi.SAPlayerDelete (*ASPlayerInviteLink)(nil), // 124: webapi.ASPlayerInviteLink (*SAPlayerInviteLink)(nil), // 125: webapi.SAPlayerInviteLink - (*Platform)(nil), // 126: webapi.Platform - (*PlatformGameConfig)(nil), // 127: webapi.PlatformGameConfig - (*GameConfigGroup)(nil), // 128: webapi.GameConfigGroup - (*GameConfigGlobal)(nil), // 129: webapi.GameConfigGlobal - (*PlatformDbConfig)(nil), // 130: webapi.PlatformDbConfig - (*CoinPoolSetting)(nil), // 131: webapi.CoinPoolSetting - (*RoomInfo)(nil), // 132: webapi.RoomInfo - (*PlayerSingleAdjust)(nil), // 133: webapi.PlayerSingleAdjust - (*PlayerData)(nil), // 134: webapi.PlayerData - (*HorseRaceLamp)(nil), // 135: webapi.HorseRaceLamp - (*MessageInfo)(nil), // 136: webapi.MessageInfo - (*ServerInfo)(nil), // 137: webapi.ServerInfo - (*OnlineReport)(nil), // 138: webapi.OnlineReport - (*ItemInfo)(nil), // 139: webapi.ItemInfo - (*ExchangeShop)(nil), // 140: webapi.ExchangeShop + (*ASAddItemById)(nil), // 126: webapi.ASAddItemById + (*SAAddItemById)(nil), // 127: webapi.SAAddItemById + (*Platform)(nil), // 128: webapi.Platform + (*PlatformGameConfig)(nil), // 129: webapi.PlatformGameConfig + (*GameConfigGroup)(nil), // 130: webapi.GameConfigGroup + (*GameConfigGlobal)(nil), // 131: webapi.GameConfigGlobal + (*PlatformDbConfig)(nil), // 132: webapi.PlatformDbConfig + (*CoinPoolSetting)(nil), // 133: webapi.CoinPoolSetting + (*RoomInfo)(nil), // 134: webapi.RoomInfo + (*PlayerSingleAdjust)(nil), // 135: webapi.PlayerSingleAdjust + (*PlayerData)(nil), // 136: webapi.PlayerData + (*HorseRaceLamp)(nil), // 137: webapi.HorseRaceLamp + (*MessageInfo)(nil), // 138: webapi.MessageInfo + (*ServerInfo)(nil), // 139: webapi.ServerInfo + (*OnlineReport)(nil), // 140: webapi.OnlineReport + (*ItemInfo)(nil), // 141: webapi.ItemInfo + (*ExchangeShop)(nil), // 142: webapi.ExchangeShop } var file_webapi_proto_depIdxs = []int32{ 0, // 0: webapi.ASPlatformInfo.Tag:type_name -> webapi.TagCode - 126, // 1: webapi.ASPlatformInfo.Platforms:type_name -> webapi.Platform + 128, // 1: webapi.ASPlatformInfo.Platforms:type_name -> webapi.Platform 0, // 2: webapi.ASGameConfig.Tag:type_name -> webapi.TagCode - 127, // 3: webapi.ASGameConfig.Configs:type_name -> webapi.PlatformGameConfig + 129, // 3: webapi.ASGameConfig.Configs:type_name -> webapi.PlatformGameConfig 0, // 4: webapi.ASGameConfigGroup.Tag:type_name -> webapi.TagCode - 128, // 5: webapi.ASGameConfigGroup.GameConfigGroup:type_name -> webapi.GameConfigGroup + 130, // 5: webapi.ASGameConfigGroup.GameConfigGroup:type_name -> webapi.GameConfigGroup 0, // 6: webapi.ASGameConfigGlobal.Tag:type_name -> webapi.TagCode - 129, // 7: webapi.ASGameConfigGlobal.GameStatus:type_name -> webapi.GameConfigGlobal + 131, // 7: webapi.ASGameConfigGlobal.GameStatus:type_name -> webapi.GameConfigGlobal 0, // 8: webapi.ASDbConfig.Tag:type_name -> webapi.TagCode - 130, // 9: webapi.ASDbConfig.DbConfigs:type_name -> webapi.PlatformDbConfig - 126, // 10: webapi.ASUpdatePlatform.Platforms:type_name -> webapi.Platform + 132, // 9: webapi.ASDbConfig.DbConfigs:type_name -> webapi.PlatformDbConfig + 128, // 10: webapi.ASUpdatePlatform.Platforms:type_name -> webapi.Platform 0, // 11: webapi.SAUpdatePlatform.Tag:type_name -> webapi.TagCode - 129, // 12: webapi.ASUpdateGameConfigGlobal.GameStatus:type_name -> webapi.GameConfigGlobal + 131, // 12: webapi.ASUpdateGameConfigGlobal.GameStatus:type_name -> webapi.GameConfigGlobal 0, // 13: webapi.SAUpdateGameConfigGlobal.Tag:type_name -> webapi.TagCode - 127, // 14: webapi.ASUpdateGameConfig.Config:type_name -> webapi.PlatformGameConfig + 129, // 14: webapi.ASUpdateGameConfig.Config:type_name -> webapi.PlatformGameConfig 0, // 15: webapi.SAUpdateGameConfig.Tag:type_name -> webapi.TagCode - 128, // 16: webapi.ASUpdateGameConfigGroup.GameConfigGroup:type_name -> webapi.GameConfigGroup + 130, // 16: webapi.ASUpdateGameConfigGroup.GameConfigGroup:type_name -> webapi.GameConfigGroup 0, // 17: webapi.SAUpdateGameConfigGroup.Tag:type_name -> webapi.TagCode 0, // 18: webapi.SAAddCoinById.Tag:type_name -> webapi.TagCode 0, // 19: webapi.SAResetGamePool.Tag:type_name -> webapi.TagCode - 131, // 20: webapi.ASUpdateGamePool.CoinPoolSetting:type_name -> webapi.CoinPoolSetting + 133, // 20: webapi.ASUpdateGamePool.CoinPoolSetting:type_name -> webapi.CoinPoolSetting 0, // 21: webapi.SAUpdateGamePool.Tag:type_name -> webapi.TagCode 0, // 22: webapi.SAQueryGamePoolByGameId.Tag:type_name -> webapi.TagCode - 131, // 23: webapi.SAQueryGamePoolByGameId.CoinPoolSetting:type_name -> webapi.CoinPoolSetting - 131, // 24: webapi.CoinPoolStatesInfo.CoinPoolSetting:type_name -> webapi.CoinPoolSetting + 133, // 23: webapi.SAQueryGamePoolByGameId.CoinPoolSetting:type_name -> webapi.CoinPoolSetting + 133, // 24: webapi.CoinPoolStatesInfo.CoinPoolSetting:type_name -> webapi.CoinPoolSetting 0, // 25: webapi.SAQueryAllGamePool.Tag:type_name -> webapi.TagCode 26, // 26: webapi.SAQueryAllGamePool.CoinPoolStatesInfo:type_name -> webapi.CoinPoolStatesInfo 0, // 27: webapi.SAListRoom.Tag:type_name -> webapi.TagCode - 132, // 28: webapi.SAListRoom.RoomInfo:type_name -> webapi.RoomInfo + 134, // 28: webapi.SAListRoom.RoomInfo:type_name -> webapi.RoomInfo 0, // 29: webapi.SAGetRoom.Tag:type_name -> webapi.TagCode - 132, // 30: webapi.SAGetRoom.RoomInfo:type_name -> webapi.RoomInfo + 134, // 30: webapi.SAGetRoom.RoomInfo:type_name -> webapi.RoomInfo 0, // 31: webapi.SADestroyRoom.Tag:type_name -> webapi.TagCode - 133, // 32: webapi.ASSinglePlayerAdjust.PlayerSingleAdjust:type_name -> webapi.PlayerSingleAdjust + 135, // 32: webapi.ASSinglePlayerAdjust.PlayerSingleAdjust:type_name -> webapi.PlayerSingleAdjust 0, // 33: webapi.SASinglePlayerAdjust.Tag:type_name -> webapi.TagCode - 133, // 34: webapi.SASinglePlayerAdjust.PlayerSingleAdjust:type_name -> webapi.PlayerSingleAdjust + 135, // 34: webapi.SASinglePlayerAdjust.PlayerSingleAdjust:type_name -> webapi.PlayerSingleAdjust 0, // 35: webapi.SAGetPlayerData.Tag:type_name -> webapi.TagCode - 134, // 36: webapi.SAGetPlayerData.PlayerData:type_name -> webapi.PlayerData + 136, // 36: webapi.SAGetPlayerData.PlayerData:type_name -> webapi.PlayerData 0, // 37: webapi.SAMorePlayerData.Tag:type_name -> webapi.TagCode - 134, // 38: webapi.SAMorePlayerData.PlayerData:type_name -> webapi.PlayerData + 136, // 38: webapi.SAMorePlayerData.PlayerData:type_name -> webapi.PlayerData 0, // 39: webapi.SAKickPlayer.Tag:type_name -> webapi.TagCode 42, // 40: webapi.ASUpdatePlayerElement.PlayerEleArgs:type_name -> webapi.PlayerEleArgs 0, // 41: webapi.SAUpdatePlayerElement.Tag:type_name -> webapi.TagCode 0, // 42: webapi.SAWhiteBlackControl.Tag:type_name -> webapi.TagCode 0, // 43: webapi.SAQueryHorseRaceLampList.Tag:type_name -> webapi.TagCode - 135, // 44: webapi.SAQueryHorseRaceLampList.HorseRaceLamp:type_name -> webapi.HorseRaceLamp + 137, // 44: webapi.SAQueryHorseRaceLampList.HorseRaceLamp:type_name -> webapi.HorseRaceLamp 0, // 45: webapi.SACreateHorseRaceLamp.Tag:type_name -> webapi.TagCode 0, // 46: webapi.SAGetHorseRaceLampById.Tag:type_name -> webapi.TagCode - 135, // 47: webapi.SAGetHorseRaceLampById.HorseRaceLamp:type_name -> webapi.HorseRaceLamp - 135, // 48: webapi.ASEditHorseRaceLamp.HorseRaceLamp:type_name -> webapi.HorseRaceLamp + 137, // 47: webapi.SAGetHorseRaceLampById.HorseRaceLamp:type_name -> webapi.HorseRaceLamp + 137, // 48: webapi.ASEditHorseRaceLamp.HorseRaceLamp:type_name -> webapi.HorseRaceLamp 0, // 49: webapi.SAEditHorseRaceLamp.Tag:type_name -> webapi.TagCode 0, // 50: webapi.SARemoveHorseRaceLampById.Tag:type_name -> webapi.TagCode 0, // 51: webapi.SABlackBySnId.Tag:type_name -> webapi.TagCode 0, // 52: webapi.SACreateShortMessage.Tag:type_name -> webapi.TagCode 0, // 53: webapi.SAQueryShortMessageList.Tag:type_name -> webapi.TagCode - 136, // 54: webapi.SAQueryShortMessageList.MessageInfo:type_name -> webapi.MessageInfo + 138, // 54: webapi.SAQueryShortMessageList.MessageInfo:type_name -> webapi.MessageInfo 0, // 55: webapi.SADeleteShortMessage.Tag:type_name -> webapi.TagCode 0, // 56: webapi.SAQueryOnlineReportList.Tag:type_name -> webapi.TagCode - 134, // 57: webapi.SAQueryOnlineReportList.PlayerData:type_name -> webapi.PlayerData + 136, // 57: webapi.SAQueryOnlineReportList.PlayerData:type_name -> webapi.PlayerData 0, // 58: webapi.SASrvCtrlClose.Tag:type_name -> webapi.TagCode 0, // 59: webapi.SASrvCtrlNotice.Tag:type_name -> webapi.TagCode 0, // 60: webapi.SASrvCtrlStartScript.Tag:type_name -> webapi.TagCode 0, // 61: webapi.SAListServerStates.Tag:type_name -> webapi.TagCode - 137, // 62: webapi.SAListServerStates.ServerInfo:type_name -> webapi.ServerInfo + 139, // 62: webapi.SAListServerStates.ServerInfo:type_name -> webapi.ServerInfo 0, // 63: webapi.SAServerStateSwitch.Tag:type_name -> webapi.TagCode 0, // 64: webapi.SAResetEtcdData.Tag:type_name -> webapi.TagCode 0, // 65: webapi.SAOnlineReportTotal.Tag:type_name -> webapi.TagCode - 138, // 66: webapi.SAOnlineReportTotal.OnlineReport:type_name -> webapi.OnlineReport + 140, // 66: webapi.SAOnlineReportTotal.OnlineReport:type_name -> webapi.OnlineReport 0, // 67: webapi.SAAddCoinByIdAndPT.Tag:type_name -> webapi.TagCode - 139, // 68: webapi.JybInfoAward.ItemId:type_name -> webapi.ItemInfo + 141, // 68: webapi.JybInfoAward.ItemId:type_name -> webapi.ItemInfo 83, // 69: webapi.ASCreateJYB.Award:type_name -> webapi.JybInfoAward 0, // 70: webapi.SACreateJYB.Tag:type_name -> webapi.TagCode 0, // 71: webapi.SAUpdateJYB.Tag:type_name -> webapi.TagCode @@ -9666,9 +9798,9 @@ var file_webapi_proto_depIdxs = []int32{ 94, // 77: webapi.SAGetExchangeOrder.OrderList:type_name -> webapi.ExchangeOrderInfo 0, // 78: webapi.SAUpExchangeStatus.Tag:type_name -> webapi.TagCode 0, // 79: webapi.SAGetExchangeShop.Tag:type_name -> webapi.TagCode - 140, // 80: webapi.SAGetExchangeShop.List:type_name -> webapi.ExchangeShop + 142, // 80: webapi.SAGetExchangeShop.List:type_name -> webapi.ExchangeShop 0, // 81: webapi.SAThdUpdatePlayerCoin.Tag:type_name -> webapi.TagCode - 139, // 82: webapi.SACreateOrder.ItemInfo:type_name -> webapi.ItemInfo + 141, // 82: webapi.SACreateOrder.ItemInfo:type_name -> webapi.ItemInfo 0, // 83: webapi.SACallbackPayment.Tag:type_name -> webapi.TagCode 0, // 84: webapi.SAResource.Tag:type_name -> webapi.TagCode 0, // 85: webapi.SASendSms.Tag:type_name -> webapi.TagCode @@ -9677,11 +9809,13 @@ var file_webapi_proto_depIdxs = []int32{ 0, // 88: webapi.SAGetImgVerify.Tag:type_name -> webapi.TagCode 0, // 89: webapi.SAPlayerDelete.Tag:type_name -> webapi.TagCode 0, // 90: webapi.SAPlayerInviteLink.Tag:type_name -> webapi.TagCode - 91, // [91:91] is the sub-list for method output_type - 91, // [91:91] is the sub-list for method input_type - 91, // [91:91] is the sub-list for extension type_name - 91, // [91:91] is the sub-list for extension extendee - 0, // [0:91] is the sub-list for field type_name + 141, // 91: webapi.ASAddItemById.ItemInfo:type_name -> webapi.ItemInfo + 0, // 92: webapi.SAAddItemById.Tag:type_name -> webapi.TagCode + 93, // [93:93] is the sub-list for method output_type + 93, // [93:93] is the sub-list for method input_type + 93, // [93:93] is the sub-list for extension type_name + 93, // [93:93] is the sub-list for extension extendee + 0, // [0:93] is the sub-list for field type_name } func init() { file_webapi_proto_init() } @@ -11191,6 +11325,30 @@ func file_webapi_proto_init() { return nil } } + file_webapi_proto_msgTypes[125].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ASAddItemById); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_webapi_proto_msgTypes[126].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SAAddItemById); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -11198,7 +11356,7 @@ func file_webapi_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_webapi_proto_rawDesc, NumEnums: 1, - NumMessages: 125, + NumMessages: 127, NumExtensions: 0, NumServices: 0, }, diff --git a/protocol/webapi/webapi.proto b/protocol/webapi/webapi.proto index ac95659..d5c3533 100644 --- a/protocol/webapi/webapi.proto +++ b/protocol/webapi/webapi.proto @@ -907,4 +907,14 @@ message SAPlayerInviteLink{ string Msg = 2; //错误信息(选填) string Link = 3; // 分享连接 } +//增加道具 [/api/player/AddItem] +message ASAddItemById{ + int32 Snid = 1; // 玩家id + string Platform = 2; // 平台id + repeated ItemInfo ItemInfo = 3;//道具 +} +message SAAddItemById{ + TagCode Tag = 1; //错误码 + string Msg = 2; //错误信息(选填) +} diff --git a/worldsrv/trascate_webapi.go b/worldsrv/trascate_webapi.go index 94f8b03..c86fd79 100644 --- a/worldsrv/trascate_webapi.go +++ b/worldsrv/trascate_webapi.go @@ -4512,6 +4512,48 @@ func init() { })).StartByExecutor(fmt.Sprint(msg.GetSnid())) return common.ResponseTag_TransactYield, pack })) + WebAPIHandlerMgrSingleton.RegisteWebAPIHandler("/api/player/AddItem", WebAPIHandlerWrapper( + func(tNode *transact.TransNode, params []byte) (int, proto.Message) { + pack := &webapiproto.SAAddItemById{} + msg := &webapiproto.ASAddItemById{} + + var err error + err = proto.Unmarshal(params, msg) + if err != nil || msg.Snid <= 0 { + pack.Tag = webapiproto.TagCode_FAILED + pack.Msg = "参数错误" + return common.ResponseTag_ParamError, pack + } + var items []*Item + for _, info := range msg.ItemInfo { + items = append(items, &Item{ + ItemId: info.ItemId, // 物品id + ItemNum: info.ItemNum, // 数量 + ObtainTime: time.Now().Unix(), + }) + } + p := PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) + if p != nil { + //获取道具Id + BagMgrSingleton.AddItems(p, items, 0, common.GainWay_Exchange, "system", "商城兑换", 0, 0, false) + } else { + BagMgrSingleton.AddItemsOffline(msg.Platform, msg.Snid, items, common.GainWay_Pay, + "system", "", 0, 0, false, func(err error) { + if err != nil { + pack.Tag = webapiproto.TagCode_FAILED + pack.Msg = "AddItem failed:" + err.Error() + } else { + pack.Tag = webapiproto.TagCode_SUCCESS + pack.Msg = "AddItem success" + } + tNode.TransRep.RetFiels = pack + tNode.Resume() + }) + } + pack.Tag = webapiproto.TagCode_SUCCESS + pack.Msg = "AddItem success" + return common.ResponseTag_TransactYield, pack + })) } func getPlayerDataParam(p *model.PlayerData, season *model.PlayerRankSeason) *model.WebPlayerDataParam {