diff --git a/modules/shop/core.go b/modules/shop/core.go index 250ce0b33..872ea8e09 100644 --- a/modules/shop/core.go +++ b/modules/shop/core.go @@ -43,20 +43,20 @@ func transGoods(goods []*cfg.Game_shopitemData, ushoputem map[int32]*pb.DBShopIt Sale: int32(v.Sale), } result[i].LeftBuyNum = v.Buyminnum - uitem.BuyNum - result[i].Items = make([]*pb.Resource, len(v.Iteminfo)) + result[i].Items = make([]*pb.UserAssets, len(v.Iteminfo)) for i1, v1 := range v.Iteminfo { - result[i].Items[i1] = &pb.Resource{ - ResourceType: v1.A, - ResourceId: v1.T, - Amount: v1.N, + result[i].Items[i1] = &pb.UserAssets{ + A: v1.A, + T: v1.T, + N: v1.N, } } - result[i].Consume = make([]*pb.Resource, len(v.Need)) + result[i].Consume = make([]*pb.UserAssets, len(v.Need)) for i1, v1 := range v.Need { - result[i].Items[i1] = &pb.Resource{ - ResourceType: v1.A, - ResourceId: v1.T, - Amount: v1.N, + result[i].Items[i1] = &pb.UserAssets{ + A: v1.A, + T: v1.T, + N: v1.N, } } } diff --git a/pb/comm.pb.go b/pb/comm.pb.go index e2ea9ec41..dcac48fc8 100644 --- a/pb/comm.pb.go +++ b/pb/comm.pb.go @@ -726,6 +726,70 @@ func (x *NoticeUserCloseReq) GetUserId() string { return "" } +//用户资产数据 对标*cfg.Game_atn 数据结构 +type UserAssets struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + A string `protobuf:"bytes,1,opt,name=A,proto3" json:"A"` + T string `protobuf:"bytes,2,opt,name=T,proto3" json:"T"` + N int32 `protobuf:"varint,3,opt,name=N,proto3" json:"N"` +} + +func (x *UserAssets) Reset() { + *x = UserAssets{} + if protoimpl.UnsafeEnabled { + mi := &file_comm_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserAssets) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserAssets) ProtoMessage() {} + +func (x *UserAssets) ProtoReflect() protoreflect.Message { + mi := &file_comm_proto_msgTypes[10] + 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 UserAssets.ProtoReflect.Descriptor instead. +func (*UserAssets) Descriptor() ([]byte, []int) { + return file_comm_proto_rawDescGZIP(), []int{10} +} + +func (x *UserAssets) GetA() string { + if x != nil { + return x.A + } + return "" +} + +func (x *UserAssets) GetT() string { + if x != nil { + return x.T + } + return "" +} + +func (x *UserAssets) GetN() int32 { + if x != nil { + return x.N + } + return 0 +} + var File_comm_proto protoreflect.FileDescriptor var file_comm_proto_rawDesc = []byte{ @@ -808,13 +872,16 @@ var file_comm_proto_rawDesc = []byte{ 0x12, 0x24, 0x0a, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x55, 0x73, 0x65, 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x43, - 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, - 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, - 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, - 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, - 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x36, + 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x0c, 0x0a, 0x01, + 0x41, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x41, 0x12, 0x0c, 0x0a, 0x01, 0x54, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x54, 0x12, 0x0c, 0x0a, 0x01, 0x4e, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x01, 0x4e, 0x2a, 0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x74, + 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, 0x0a, 0x02, + 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, 0x07, 0x0a, + 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, 0x64, 0x10, + 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -830,7 +897,7 @@ func file_comm_proto_rawDescGZIP() []byte { } var file_comm_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_comm_proto_goTypes = []interface{}{ (HeroAttributesType)(0), // 0: HeroAttributesType (*UserMessage)(nil), // 1: UserMessage @@ -843,18 +910,19 @@ var file_comm_proto_goTypes = []interface{}{ (*BroadCastMessageReq)(nil), // 8: BroadCastMessageReq (*AgentCloseeReq)(nil), // 9: AgentCloseeReq (*NoticeUserCloseReq)(nil), // 10: NoticeUserCloseReq - (*anypb.Any)(nil), // 11: google.protobuf.Any - (ErrorCode)(0), // 12: ErrorCode + (*UserAssets)(nil), // 11: UserAssets + (*anypb.Any)(nil), // 12: google.protobuf.Any + (ErrorCode)(0), // 13: ErrorCode } var file_comm_proto_depIdxs = []int32{ - 11, // 0: UserMessage.data:type_name -> google.protobuf.Any - 11, // 1: AgentMessage.Message:type_name -> google.protobuf.Any - 12, // 2: RPCMessageReply.Code:type_name -> ErrorCode - 11, // 3: RPCMessageReply.ErrorData:type_name -> google.protobuf.Any + 12, // 0: UserMessage.data:type_name -> google.protobuf.Any + 12, // 1: AgentMessage.Message:type_name -> google.protobuf.Any + 13, // 2: RPCMessageReply.Code:type_name -> ErrorCode + 12, // 3: RPCMessageReply.ErrorData:type_name -> google.protobuf.Any 1, // 4: RPCMessageReply.Reply:type_name -> UserMessage 1, // 5: AgentSendMessageReq.Reply:type_name -> UserMessage - 11, // 6: BatchMessageReq.Data:type_name -> google.protobuf.Any - 11, // 7: BroadCastMessageReq.Data:type_name -> google.protobuf.Any + 12, // 6: BatchMessageReq.Data:type_name -> google.protobuf.Any + 12, // 7: BroadCastMessageReq.Data:type_name -> google.protobuf.Any 8, // [8:8] is the sub-list for method output_type 8, // [8:8] is the sub-list for method input_type 8, // [8:8] is the sub-list for extension type_name @@ -989,6 +1057,18 @@ func file_comm_proto_init() { return nil } } + file_comm_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserAssets); 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{ @@ -996,7 +1076,7 @@ func file_comm_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_comm_proto_rawDesc, NumEnums: 1, - NumMessages: 10, + NumMessages: 11, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/proto/comm.proto b/pb/proto/comm.proto index ae3ef83bc..e33218916 100644 --- a/pb/proto/comm.proto +++ b/pb/proto/comm.proto @@ -76,3 +76,9 @@ enum HeroAttributesType{ Crit = 4; //暴击 } +//用户资产数据 对标*cfg.Game_atn 数据结构 +message UserAssets{ + string A=1; + string T=2; + int32 N=3; +} \ No newline at end of file diff --git a/pb/proto/shop/shop_msg.proto b/pb/proto/shop/shop_msg.proto index 1bacece72..96c3dc9d2 100644 --- a/pb/proto/shop/shop_msg.proto +++ b/pb/proto/shop/shop_msg.proto @@ -1,20 +1,14 @@ syntax = "proto3"; option go_package = ".;pb"; import "shop/shop_db.proto"; +import "comm.proto"; -//资源对象 -message Resource { - string ResourceType = 1; //资源类型 - string ResourceId = 2; //资源Id - int32 Amount = 3; //数量 -} - //商品对象数据 message ShopItem { int32 GoodsId = 1; //商品Id - repeated Resource Items = 2; //货物 - repeated Resource Consume = 3; //消耗 + repeated UserAssets Items = 2; //货物 + repeated UserAssets Consume = 3; //消耗 int32 Sale = 4; //打折 int32 LeftBuyNum = 5; //还可购买次数 } diff --git a/pb/shop_msg.pb.go b/pb/shop_msg.pb.go index 9fd96cdf1..bbc2da864 100644 --- a/pb/shop_msg.pb.go +++ b/pb/shop_msg.pb.go @@ -90,11 +90,11 @@ type ShopItem struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GoodsId int32 `protobuf:"varint,1,opt,name=GoodsId,proto3" json:"GoodsId"` //商品Id - Items []*Resource `protobuf:"bytes,2,rep,name=Items,proto3" json:"Items"` //货物 - Consume []*Resource `protobuf:"bytes,3,rep,name=Consume,proto3" json:"Consume"` //消耗 - Sale int32 `protobuf:"varint,4,opt,name=Sale,proto3" json:"Sale"` //打折 - LeftBuyNum int32 `protobuf:"varint,5,opt,name=LeftBuyNum,proto3" json:"LeftBuyNum"` //还可购买次数 + GoodsId int32 `protobuf:"varint,1,opt,name=GoodsId,proto3" json:"GoodsId"` //商品Id + Items []*UserAssets `protobuf:"bytes,2,rep,name=Items,proto3" json:"Items"` //货物 + Consume []*UserAssets `protobuf:"bytes,3,rep,name=Consume,proto3" json:"Consume"` //消耗 + Sale int32 `protobuf:"varint,4,opt,name=Sale,proto3" json:"Sale"` //打折 + LeftBuyNum int32 `protobuf:"varint,5,opt,name=LeftBuyNum,proto3" json:"LeftBuyNum"` //还可购买次数 } func (x *ShopItem) Reset() { @@ -136,14 +136,14 @@ func (x *ShopItem) GetGoodsId() int32 { return 0 } -func (x *ShopItem) GetItems() []*Resource { +func (x *ShopItem) GetItems() []*UserAssets { if x != nil { return x.Items } return nil } -func (x *ShopItem) GetConsume() []*Resource { +func (x *ShopItem) GetConsume() []*UserAssets { if x != nil { return x.Consume } @@ -369,20 +369,21 @@ var File_shop_shop_msg_proto protoreflect.FileDescriptor var file_shop_shop_msg_proto_rawDesc = []byte{ 0x0a, 0x13, 0x73, 0x68, 0x6f, 0x70, 0x2f, 0x73, 0x68, 0x6f, 0x70, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x73, 0x68, 0x6f, 0x70, 0x2f, 0x73, 0x68, 0x6f, 0x70, - 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x66, 0x0a, 0x08, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x22, 0x9e, 0x01, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18, - 0x0a, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x1f, 0x0a, 0x05, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x23, 0x0a, 0x07, 0x43, 0x6f, 0x6e, - 0x73, 0x75, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x12, + 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x66, 0x0a, 0x08, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x54, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x52, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0xa2, 0x01, + 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x6f, + 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x47, 0x6f, 0x6f, + 0x64, 0x73, 0x49, 0x64, 0x12, 0x21, 0x0a, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, + 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x12, 0x25, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x75, + 0x6d, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41, + 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x07, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x53, 0x61, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x53, 0x61, 0x6c, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x4c, 0x65, 0x66, 0x74, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x4c, 0x65, 0x66, 0x74, 0x42, 0x75, 0x79, 0x4e, @@ -424,12 +425,13 @@ var file_shop_shop_msg_proto_goTypes = []interface{}{ (*ShopGetListResp)(nil), // 3: ShopGetListResp (*ShopBuyReq)(nil), // 4: ShopBuyReq (*ShopBuyResp)(nil), // 5: ShopBuyResp - (ShopType)(0), // 6: ShopType + (*UserAssets)(nil), // 6: UserAssets + (ShopType)(0), // 7: ShopType } var file_shop_shop_msg_proto_depIdxs = []int32{ - 0, // 0: ShopItem.Items:type_name -> Resource - 0, // 1: ShopItem.Consume:type_name -> Resource - 6, // 2: ShopGetListReq.sType:type_name -> ShopType + 6, // 0: ShopItem.Items:type_name -> UserAssets + 6, // 1: ShopItem.Consume:type_name -> UserAssets + 7, // 2: ShopGetListReq.sType:type_name -> ShopType 1, // 3: ShopGetListResp.Goods:type_name -> ShopItem 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type @@ -444,6 +446,7 @@ func file_shop_shop_msg_proto_init() { return } file_shop_shop_db_proto_init() + file_comm_proto_init() if !protoimpl.UnsafeEnabled { file_shop_shop_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Resource); i {