From fe776970a9024c605c59cc7ecb246c06b542a64a Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 18 Jul 2022 10:10:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=81=93=E5=85=B7=E5=87=BA?= =?UTF-8?q?=E5=94=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/stup.sh | 20 ++++++------ modules/items/api_getlist.go | 6 ++-- modules/items/api_sellItem.go | 45 +++++++++++++++++++++++--- modules/items/modelitems.go | 48 +++++++++++++-------------- modules/items/module.go | 8 ++--- pb/items_msg.pb.go | 59 ++++++++++++++++++---------------- pb/proto/items/items_msg.proto | 5 ++- 7 files changed, 115 insertions(+), 76 deletions(-) diff --git a/bin/stup.sh b/bin/stup.sh index 08bcd3127..7d9278ebd 100755 --- a/bin/stup.sh +++ b/bin/stup.sh @@ -4,16 +4,16 @@ start(){ echo "starting..." - nohup $CMD > /dev/null 2>&1 & - # nohup $CMD >output.log 2>&1 & - if [ $? -ne 0 ] - then - echo "start failed, please check the log!" - exit $? - else - echo $! > $SERVICE.pid - echo "start success" - fi + nohup $CMD > /dev/null 2>&1 & + # nohup $CMD >output.log 2>&1 & + if [ $? -ne 0 ] + then + echo "start failed, please check the log!" + exit $? + else + echo $! > $SERVICE.pid + echo "start success" + fi } stop(){ echo "stopping..." diff --git a/modules/items/api_getlist.go b/modules/items/api_getlist.go index b73ad5010..b6429da06 100644 --- a/modules/items/api_getlist.go +++ b/modules/items/api_getlist.go @@ -30,16 +30,16 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ItemsGetlistReq) if code == pb.ErrorCode_Success { go func() { //异步处理修改数据 if len(modifys) > 0 { - this.module.modelItems.Pack_UpdateUserPack(session.GetUserId(), modifys...) + this.module.modelItems.UpdateUserPack(session.GetUserId(), modifys...) } if len(dels) > 0 { - this.module.modelItems.Pack_DeleteUserPack(session.GetUserId(), dels...) + this.module.modelItems.DeleteUserPack(session.GetUserId(), dels...) } }() } }() - if items, err = this.module.modelItems.Pack_QueryUserPack(session.GetUserId()); err != nil { + if items, err = this.module.modelItems.QueryUserPack(session.GetUserId()); err != nil { this.module.Errorf("QueryUserPackReq err:%v", err) code = pb.ErrorCode_CacheReadError return diff --git a/modules/items/api_sellItem.go b/modules/items/api_sellItem.go index 03d05c075..3cd70a1fb 100644 --- a/modules/items/api_sellItem.go +++ b/modules/items/api_sellItem.go @@ -3,20 +3,57 @@ package items import ( "go_dreamfactory/comm" "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" "google.golang.org/protobuf/proto" ) //参数校验 func (this *apiComp) SellItemCheck(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode) { - + if req.GridId != "" || req.Amount <= 0 { + code = pb.ErrorCode_ReqParameterError + } return } //出售道具 func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemReq) (code pb.ErrorCode, data proto.Message) { - defer func() { - session.SendMsg(string(this.module.GetType()), "sellitem", &pb.ItemsSellItemResp{}) - }() + var ( + err error + item *pb.DB_UserItemData + itemcf *cfg.Game_itemData + ) + if code = this.SellItemCheck(session, req); code != pb.ErrorCode_Success { + return + } + if item, err = this.module.modelItems.QueryUserPackByGridId(session.GetUserId(), req.GridId); err != nil { + code = pb.ErrorCode_ReqParameterError + return + } + if itemcf, err = this.module.configure.GetItemConfigure(item.ItemId); err != nil { + code = pb.ErrorCode_ConfigurationException + return + } + if req.Amount < item.Amount { + code = pb.ErrorCode_ReqParameterError + this.module.Errorf("SellItemCheck over all amount:[%d:%d]", req.Amount, item.Amount) + return + } + if code = this.module.DispenseRes(session.GetUserId(), itemcf.Sale, true); code != pb.ErrorCode_Success { + return + } + item.Amount = item.Amount - req.Amount + if item.Amount == 0 { + if err = this.module.modelItems.DelUserPack(session.GetUserId(), item.GridId); err != nil { + code = pb.ErrorCode_DBError + return + } + } else { + if err = this.module.modelItems.UpdateUserPack(session.GetUserId(), item); err != nil { + code = pb.ErrorCode_DBError + return + } + } + session.SendMsg(string(this.module.GetType()), "sellitem", &pb.ItemsSellItemResp{Item: item}) return } diff --git a/modules/items/modelitems.go b/modules/items/modelitems.go index 987ac4c88..40e2750b0 100644 --- a/modules/items/modelitems.go +++ b/modules/items/modelitems.go @@ -32,7 +32,7 @@ func (this *ModelItemsComp) Init(service core.IService, module core.IModule, com } ///查询用户背包数据 -func (this *ModelItemsComp) Pack_QueryUserPack(uId string) (itmes []*pb.DB_UserItemData, err error) { +func (this *ModelItemsComp) QueryUserPack(uId string) (itmes []*pb.DB_UserItemData, err error) { itmes = make([]*pb.DB_UserItemData, 0) if err = this.GetList(uId, &itmes); err != nil { this.module.Errorf("err:%v", err) @@ -41,7 +41,7 @@ func (this *ModelItemsComp) Pack_QueryUserPack(uId string) (itmes []*pb.DB_UserI } ///查询用户指定格子的物品数据 -func (this *ModelItemsComp) Pack_QueryUserPackByGridId(uId string, grid string) (itme *pb.DB_UserItemData, err error) { +func (this *ModelItemsComp) QueryUserPackByGridId(uId string, grid string) (itme *pb.DB_UserItemData, err error) { itme = &pb.DB_UserItemData{} if err = this.GetListObj(uId, grid, itme); err != nil { this.module.Errorf("err:%v", err) @@ -50,7 +50,7 @@ func (this *ModelItemsComp) Pack_QueryUserPackByGridId(uId string, grid string) } //更新用户的背包信息 -func (this *ModelItemsComp) Pack_AddUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { +func (this *ModelItemsComp) AddUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { for _, v := range itmes { this.AddList(uId, v.GridId, v) } @@ -58,7 +58,7 @@ func (this *ModelItemsComp) Pack_AddUserPack(uId string, itmes ...*pb.DB_UserIte } //更新用户的背包信息 -func (this *ModelItemsComp) Pack_DelUserPack(uId string, ids ...string) (err error) { +func (this *ModelItemsComp) DelUserPack(uId string, ids ...string) (err error) { if err = this.DelListlds(uId, ids...); err != nil { this.module.Errorf("err:%v", err) } @@ -66,7 +66,7 @@ func (this *ModelItemsComp) Pack_DelUserPack(uId string, ids ...string) (err err } //更新用户的背包信息 -func (this *ModelItemsComp) Pack_UpdateUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { +func (this *ModelItemsComp) UpdateUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { for _, v := range itmes { this.ChangeList(uId, v.GridId, map[string]interface{}{ "amount": v.Amount, @@ -76,7 +76,7 @@ func (this *ModelItemsComp) Pack_UpdateUserPack(uId string, itmes ...*pb.DB_User } //更新用户的背包信息 -func (this *ModelItemsComp) Pack_DeleteUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { +func (this *ModelItemsComp) DeleteUserPack(uId string, itmes ...*pb.DB_UserItemData) (err error) { gridIds := make([]string, len(itmes)) for i, v := range itmes { gridIds[i] = v.GridId @@ -89,12 +89,12 @@ func (this *ModelItemsComp) Pack_DeleteUserPack(uId string, itmes ...*pb.DB_User } //查询用户背包物品数量 -func (this *ModelItemsComp) Pack_QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) { +func (this *ModelItemsComp) QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) { var ( itmes []*pb.DB_UserItemData err error ) - if itmes, err = this.Pack_QueryUserPack(uId); err != nil { + if itmes, err = this.QueryUserPack(uId); err != nil { this.module.Errorf("err:%v", err) return } @@ -110,7 +110,7 @@ func (this *ModelItemsComp) Pack_QueryUserPackItemsAmount(uId string, itemid ... } ///添加或则减少物品到用户背包 -func (this *ModelItemsComp) Pack_AddItemToUserPack(uId string, itemId int32, addnum int32) (change []*pb.DB_UserItemData, err error) { +func (this *ModelItemsComp) AddItemToUserPack(uId string, itemId int32, addnum int32) (change []*pb.DB_UserItemData, err error) { var ( itmes []*pb.DB_UserItemData add []*pb.DB_UserItemData @@ -121,12 +121,12 @@ func (this *ModelItemsComp) Pack_AddItemToUserPack(uId string, itemId int32, add if addnum == 0 { return } - if itmes, err = this.Pack_QueryUserPack(uId); err != nil { + if itmes, err = this.QueryUserPack(uId); err != nil { this.module.Errorf("err:%v", err) return } change = make([]*pb.DB_UserItemData, len(itmes)) - add, update, del, leftnum = this.pack_addItemToUserPack(uId, itmes, itemId, addnum) + add, update, del, leftnum = this.addItemToUserPack(uId, itmes, itemId, addnum) if leftnum < 0 { err = ItemNotEnoughError return @@ -135,21 +135,21 @@ func (this *ModelItemsComp) Pack_AddItemToUserPack(uId string, itemId int32, add return } if len(add) > 0 { - if err = this.Pack_AddUserPack(uId, add...); err != nil { + if err = this.AddUserPack(uId, add...); err != nil { this.module.Errorf("err:%v", err) return } change = append(change, add...) } if len(del) > 0 { - if err = this.Pack_DeleteUserPack(uId, del...); err != nil { + if err = this.DeleteUserPack(uId, del...); err != nil { this.module.Errorf("err:%v", err) return } change = append(change, del...) } if len(update) > 0 { - if err = this.Pack_UpdateUserPack(uId, update...); err != nil { + if err = this.UpdateUserPack(uId, update...); err != nil { this.module.Errorf("err:%v", err) return } @@ -159,7 +159,7 @@ func (this *ModelItemsComp) Pack_AddItemToUserPack(uId string, itemId int32, add } ///添加或则减少多个物品到用户背包 -func (this *ModelItemsComp) Pack_AddItemsToUserPack(uId string, items map[int32]int32) (change []*pb.DB_UserItemData, err error) { +func (this *ModelItemsComp) AddItemsToUserPack(uId string, items map[int32]int32) (change []*pb.DB_UserItemData, err error) { var ( itmes []*pb.DB_UserItemData add []*pb.DB_UserItemData @@ -167,13 +167,13 @@ func (this *ModelItemsComp) Pack_AddItemsToUserPack(uId string, items map[int32] update []*pb.DB_UserItemData leftnum int64 ) - if itmes, err = this.Pack_QueryUserPack(uId); err != nil { + if itmes, err = this.QueryUserPack(uId); err != nil { this.module.Errorf("err:%v", err) return } change = make([]*pb.DB_UserItemData, len(itmes)) for k, v := range items { - add, update, del, leftnum = this.pack_addItemToUserPack(uId, itmes, k, v) + add, update, del, leftnum = this.addItemToUserPack(uId, itmes, k, v) if leftnum < 0 { err = ItemNotEnoughError return @@ -182,21 +182,21 @@ func (this *ModelItemsComp) Pack_AddItemsToUserPack(uId string, items map[int32] return } if len(add) > 0 { - if err = this.Pack_AddUserPack(uId, add...); err != nil { + if err = this.AddUserPack(uId, add...); err != nil { this.module.Errorf("err:%v", err) return } change = append(change, add...) } if len(del) > 0 { - if err = this.Pack_DeleteUserPack(uId, del...); err != nil { + if err = this.DeleteUserPack(uId, del...); err != nil { this.module.Errorf("err:%v", err) return } change = append(change, del...) } if len(update) > 0 { - if err = this.Pack_UpdateUserPack(uId, update...); err != nil { + if err = this.UpdateUserPack(uId, update...); err != nil { this.module.Errorf("err:%v", err) return } @@ -207,7 +207,7 @@ func (this *ModelItemsComp) Pack_AddItemsToUserPack(uId string, items map[int32] } ///修改指定格子的物品数量 -func (this *ModelItemsComp) Pack_AddItemToUserPackByGrid(uId string, gridid string, itemId int32, addnum int32) (err error) { +func (this *ModelItemsComp) AddItemToUserPackByGrid(uId string, gridid string, itemId int32, addnum int32) (err error) { var ( conf *cfg.Game_itemData itme *pb.DB_UserItemData @@ -223,7 +223,7 @@ func (this *ModelItemsComp) Pack_AddItemToUserPackByGrid(uId string, gridid stri return } - if itme, err = this.Pack_QueryUserPackByGridId(uId, gridid); err != nil { + if itme, err = this.QueryUserPackByGridId(uId, gridid); err != nil { this.module.Errorf("err:%v", err) return } @@ -241,14 +241,14 @@ func (this *ModelItemsComp) Pack_AddItemToUserPackByGrid(uId string, gridid stri return } else { itme.Amount = uint32(num) - this.Pack_UpdateUserPack(uId, itme) + this.UpdateUserPack(uId, itme) } } return } ///添加移除物品到用户背包 -func (this *ModelItemsComp) pack_addItemToUserPack(uid string, items []*pb.DB_UserItemData, itemId int32, addnum int32) (add, update, del []*pb.DB_UserItemData, leftnum int64) { +func (this *ModelItemsComp) addItemToUserPack(uid string, items []*pb.DB_UserItemData, itemId int32, addnum int32) (add, update, del []*pb.DB_UserItemData, leftnum int64) { var ( err error conf *cfg.Game_itemData diff --git a/modules/items/module.go b/modules/items/module.go index ce2aab871..9f7a44f31 100644 --- a/modules/items/module.go +++ b/modules/items/module.go @@ -49,7 +49,7 @@ func (this *Items) OnInstallComp() { func (this *Items) QueryItemAmount(source *comm.ModuleCallSource, uId string, itemid int32) (amount uint32) { defer this.Debugf("获取物品 uId:%s itemid:%d addnum:%d ", uId, itemid, amount) amount = 0 - if result := this.modelItems.Pack_QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 0 { + if result := this.modelItems.QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 0 { return result[itemid] } return @@ -57,7 +57,7 @@ func (this *Items) QueryItemAmount(source *comm.ModuleCallSource, uId string, it ///查询用户背包多个物品数量 func (this *Items) QueryItemsAmount(source *comm.ModuleCallSource, uId string, itemid ...int32) (result map[int32]uint32) { - result = this.modelItems.Pack_QueryUserPackItemsAmount(uId, itemid...) + result = this.modelItems.QueryUserPackItemsAmount(uId, itemid...) return } @@ -68,7 +68,7 @@ func (this *Items) AddItem(source *comm.ModuleCallSource, uId string, itemid, ad change []*pb.DB_UserItemData ) defer this.Debugf("给用户添加物品 uId:%s itemid:%d addnum:%d issucc:%v", uId, itemid, addnum, err == nil) - if change, err = this.modelItems.Pack_AddItemToUserPack(uId, itemid, addnum); err != nil { + if change, err = this.modelItems.AddItemToUserPack(uId, itemid, addnum); err != nil { this.Errorf("给用户添加物品 uId:%s itemid:%d addnum:%d err:%v", uId, itemid, addnum, err) if err == ItemNotEnoughError { code = pb.ErrorCode_ItemsNoEnough @@ -94,7 +94,7 @@ func (this *Items) AddItems(source *comm.ModuleCallSource, uId string, items map ) defer this.Debugf("给用户添加物品 uId:%s items:%d items:%v", uId, items, err == nil) - if change, err = this.modelItems.Pack_AddItemsToUserPack(uId, items); err != nil { + if change, err = this.modelItems.AddItemsToUserPack(uId, items); err != nil { this.Errorf("给用户添加物品 uId:%s items:%d err:%v", uId, items, err) if err == ItemNotEnoughError { code = pb.ErrorCode_ItemsNoEnough diff --git a/pb/items_msg.pb.go b/pb/items_msg.pb.go index 52347d417..ea6f8e172 100644 --- a/pb/items_msg.pb.go +++ b/pb/items_msg.pb.go @@ -171,8 +171,7 @@ type ItemsUseItemReq struct { unknownFields protoimpl.UnknownFields GridId string `protobuf:"bytes,1,opt,name=GridId,proto3" json:"GridId"` //格子Id - ItemId int32 `protobuf:"varint,2,opt,name=ItemId,proto3" json:"ItemId"` //物品Id - Amount uint32 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount"` //使用数量 + Amount uint32 `protobuf:"varint,2,opt,name=Amount,proto3" json:"Amount"` //使用数量 } func (x *ItemsUseItemReq) Reset() { @@ -214,13 +213,6 @@ func (x *ItemsUseItemReq) GetGridId() string { return "" } -func (x *ItemsUseItemReq) GetItemId() int32 { - if x != nil { - return x.ItemId - } - return 0 -} - func (x *ItemsUseItemReq) GetAmount() uint32 { if x != nil { return x.Amount @@ -336,6 +328,8 @@ type ItemsSellItemResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Item *DB_UserItemData `protobuf:"bytes,1,opt,name=Item,proto3" json:"Item"` //变化物品 } func (x *ItemsSellItemResp) Reset() { @@ -370,6 +364,13 @@ func (*ItemsSellItemResp) Descriptor() ([]byte, []int) { return file_items_items_msg_proto_rawDescGZIP(), []int{6} } +func (x *ItemsSellItemResp) GetItem() *DB_UserItemData { + if x != nil { + return x.Item + } + return nil +} + var File_items_items_msg_proto protoreflect.FileDescriptor var file_items_items_msg_proto_rawDesc = []byte{ @@ -385,22 +386,23 @@ var file_items_items_msg_proto_rawDesc = []byte{ 0x64, 0x73, 0x22, 0x39, 0x0a, 0x0f, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x05, 0x47, 0x72, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x74, - 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x47, 0x72, 0x69, 0x64, 0x73, 0x22, 0x59, 0x0a, + 0x65, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x05, 0x47, 0x72, 0x69, 0x64, 0x73, 0x22, 0x41, 0x0a, 0x0f, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, - 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x12, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x22, 0x5a, 0x0a, 0x10, - 0x49, 0x74, 0x65, 0x6d, 0x73, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, - 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, - 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, - 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x13, 0x0a, 0x11, 0x49, 0x74, 0x65, 0x6d, - 0x73, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, - 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x12, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x55, 0x73, 0x65, 0x49, 0x74, 0x65, 0x6d, + 0x52, 0x65, 0x73, 0x70, 0x22, 0x5a, 0x0a, 0x10, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x53, 0x65, 0x6c, + 0x6c, 0x49, 0x74, 0x65, 0x6d, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x47, 0x72, 0x69, 0x64, + 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x47, 0x72, 0x69, 0x64, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x49, 0x74, 0x65, 0x6d, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x39, 0x0a, 0x11, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x53, 0x65, 0x6c, 0x6c, 0x49, 0x74, 0x65, + 0x6d, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x42, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x49, 0x74, 0x65, + 0x6d, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x49, 0x74, 0x65, 0x6d, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -429,11 +431,12 @@ var file_items_items_msg_proto_goTypes = []interface{}{ var file_items_items_msg_proto_depIdxs = []int32{ 7, // 0: ItemsGetlistResp.Grids:type_name -> DB_UserItemData 7, // 1: ItemsChangePush.Grids:type_name -> DB_UserItemData - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] 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 + 7, // 2: ItemsSellItemResp.Item:type_name -> DB_UserItemData + 3, // [3:3] is the sub-list for method output_type + 3, // [3:3] 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_items_items_msg_proto_init() } diff --git a/pb/proto/items/items_msg.proto b/pb/proto/items/items_msg.proto index 820f2e23f..6fba7f3d8 100644 --- a/pb/proto/items/items_msg.proto +++ b/pb/proto/items/items_msg.proto @@ -20,8 +20,7 @@ message ItemsChangePush { //使用物品请求 message ItemsUseItemReq { string GridId = 1; //格子Id - int32 ItemId = 2; //物品Id - uint32 Amount = 3; //使用数量 + uint32 Amount = 2; //使用数量 } //使用物品请求 回应 @@ -38,5 +37,5 @@ message ItemsSellItemReq { //出售道具请求 回应 message ItemsSellItemResp { - + DB_UserItemData Item = 1; //变化物品 } \ No newline at end of file