From 3be9f754baf27a907ae44a706dbbaeb02c1520e2 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 25 Jul 2022 15:41:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=95=86=E5=BA=97=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E8=B4=AD=E4=B9=B0=E6=AC=A1=E6=95=B0=E5=85=B1=E4=BA=AB?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lego/sys/codec/factory/factory_map.go | 4 +- lego/sys/codec/utils/int.go | 10 ++-- modules/shop/api_buy.go | 30 ++++++----- modules/shop/api_getlist.go | 6 +-- modules/shop/core.go | 4 +- modules/shop/model_shopitems.go | 2 +- pb/errorcode.pb.go | 11 ++-- pb/proto/errorcode.proto | 3 ++ pb/proto/shop/shop_db.proto | 4 +- pb/proto/shop/shop_msg.proto | 3 +- pb/shop_db.pb.go | 75 ++++++++++++++++----------- pb/shop_msg.pb.go | 38 +++++++++----- 12 files changed, 116 insertions(+), 74 deletions(-) diff --git a/lego/sys/codec/factory/factory_map.go b/lego/sys/codec/factory/factory_map.go index 6288609ab..017249cb0 100644 --- a/lego/sys/codec/factory/factory_map.go +++ b/lego/sys/codec/factory/factory_map.go @@ -240,11 +240,11 @@ func (this *numericMapKeyDecoder) GetType() reflect.Kind { return this.decoder.GetType() } func (this *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, extra core.IExtractor) { - if extra.ReadKeyStart() { + if !extra.ReadKeyStart() { return } this.decoder.Decode(ptr, extra) - if extra.ReadKeyEnd() { + if !extra.ReadKeyEnd() { return } } diff --git a/lego/sys/codec/utils/int.go b/lego/sys/codec/utils/int.go index 01a27bc44..a68ebb046 100644 --- a/lego/sys/codec/utils/int.go +++ b/lego/sys/codec/utils/int.go @@ -168,7 +168,7 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { return } ret = uint32(ind) - if len(buf) > 10 { + if len(buf) > 11 { i := 1 ind2 := intDigits[buf[i]] if ind2 == invalidCharForNumber { @@ -246,11 +246,13 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) { err = errors.New("ReadUint32ForString overflow") return } + n = i ret = value2 continue } ret = (ret << 3) + (ret << 1) + uint32(ind) } + n = len(buf) return } @@ -266,8 +268,8 @@ func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) { return } ret = uint64(ind) - if len(buf) > 10 { - i := 0 + if len(buf) > 11 { + i := 1 ind2 := intDigits[buf[i]] if ind2 == invalidCharForNumber { n = i @@ -345,10 +347,12 @@ func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) { return } ret = value2 + n = i continue } ret = (ret << 3) + (ret << 1) + uint64(ind) } + n = len(buf) return } diff --git a/modules/shop/api_buy.go b/modules/shop/api_buy.go index 55d2b9eeb..1907922bb 100644 --- a/modules/shop/api_buy.go +++ b/modules/shop/api_buy.go @@ -1,6 +1,7 @@ package shop import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -13,7 +14,9 @@ import ( //参数校验 func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.ShopBuyReq) (code pb.ErrorCode) { - + if req.ShopType == 0 || req.GoodsId == 0 { + code = pb.ErrorCode_ReqParameterError + } return } @@ -26,13 +29,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb shopitem *pb.DBShopItem need []*cfg.Game_atn ) - defer func() { - if code == pb.ErrorCode_Success { - session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true}) - } else { - session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: false}) - } - }() if conf, err = this.module.configure.GetShopItemsConfigure(req.GoodsId); err != nil { code = pb.ErrorCode_SystemError return @@ -42,8 +38,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb Id: primitive.NewObjectID().Hex(), Uid: session.GetUserId(), GoodsId: conf.Key, - BuyNum: 0, - LastBuyTime: 0, + BuyNum: map[int32]int32{1: 0, 2: 0, 3: 0, 4: 0, 5: 0}, + LastBuyTime: map[int32]int64{1: 0, 2: 0, 3: 0, 4: 0, 5: 0}, } } need = make([]*cfg.Game_atn, len(conf.Need)) @@ -61,15 +57,21 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb if code = this.module.DispenseRes(session, conf.Iteminfo, true); code != pb.ErrorCode_Success { return } - shopitem.BuyNum++ - shopitem.LastBuyTime = time.Now().Unix() + if conf.Buyminnum-shopitem.BuyNum[int32(req.ShopType)] < 0 { + code = pb.ErrorCode_ShopGoodsIsSoldOut + return + } + + shopitem.BuyNum[int32(req.ShopType)]++ + shopitem.LastBuyTime[int32(req.ShopType)] = time.Now().Unix() if !ok { this.module.modelShopItems.AddList(session.GetUserId(), shopitem.Id, shopitem) } else { this.module.modelShopItems.ChangeList(session.GetUserId(), shopitem.Id, map[string]interface{}{ - "buynum": shopitem.BuyNum, - "lastbuytime": shopitem.LastBuyTime, + fmt.Sprintf("buynum.%d", req.ShopType): shopitem.BuyNum, + fmt.Sprintf("lastbuytime.%d", req.ShopType): shopitem.LastBuyTime, }) } + session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true}) return } diff --git a/modules/shop/api_getlist.go b/modules/shop/api_getlist.go index 07b8ac4a8..dd0dc41c9 100644 --- a/modules/shop/api_getlist.go +++ b/modules/shop/api_getlist.go @@ -101,7 +101,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) } items = append(items, randomGoods(_items)) } - goods = transGoods(items, ushoputem) + goods = transGoods(req.SType, items, ushoputem) sdata.LastRefreshTime = time.Now().Unix() sdata.Items = make([]int32, len(items)) for i, v := range items { @@ -118,7 +118,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) } items = append(items, randomGoods(_items)) } - goods = transGoods(items, ushoputem) + goods = transGoods(req.SType, items, ushoputem) sdata.LastRefreshTime = time.Now().Unix() sdata.Items = make([]int32, len(items)) for i, v := range items { @@ -130,7 +130,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) code = pb.ErrorCode_SystemError return } - goods = transGoods(items, ushoputem) + goods = transGoods(req.SType, items, ushoputem) } } else { code = pb.ErrorCode_ReqParameterError diff --git a/modules/shop/core.go b/modules/shop/core.go index 15cab6075..3c7354c0b 100644 --- a/modules/shop/core.go +++ b/modules/shop/core.go @@ -31,7 +31,7 @@ func randomGoods(goods []*cfg.Game_shopitemData) (result *cfg.Game_shopitemData) } //转换商品对象 -func transGoods(goods []*cfg.Game_shopitemData, ushoputem map[int32]*pb.DBShopItem) (result []*pb.ShopItem) { +func transGoods(stype pb.ShopType, goods []*cfg.Game_shopitemData, ushoputem map[int32]*pb.DBShopItem) (result []*pb.ShopItem) { result = make([]*pb.ShopItem, len(goods)) ok := false uitem := &pb.DBShopItem{} @@ -43,7 +43,7 @@ func transGoods(goods []*cfg.Game_shopitemData, ushoputem map[int32]*pb.DBShopIt GoodsId: v.Key, Sale: int32(v.Sale), } - result[i].LeftBuyNum = v.Buyminnum - uitem.BuyNum + result[i].LeftBuyNum = v.Buyminnum - uitem.BuyNum[int32(stype)] result[i].Items = make([]*pb.UserAssets, len(v.Iteminfo)) for i1, v1 := range v.Iteminfo { result[i].Items[i1] = &pb.UserAssets{ diff --git a/modules/shop/model_shopitems.go b/modules/shop/model_shopitems.go index 7f8b106d0..8a46d6b3a 100644 --- a/modules/shop/model_shopitems.go +++ b/modules/shop/model_shopitems.go @@ -34,7 +34,7 @@ func (this *modelShopItemsComp) QueryUserShopData(uId string) (result map[int32] result = make(map[int32]*pb.DBShopItem) data := make([]*pb.DBShopItem, 0) if err = this.GetList(uId, &data); err != nil && err != mgo.MongodbNil { - err = nil + this.module.Errorf("err:%v", err) return } err = nil diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 7eee71f67..99d2f1a76 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -118,6 +118,8 @@ const ( ErrorCode_TaskActiveNoenough ErrorCode = 1606 //活跃值未达标 ErrorCode_TaskNoFinished ErrorCode = 1607 //任务未完成 ErrorCode_TaskFinished ErrorCode = 1608 //已完成 + // shop + ErrorCode_ShopGoodsIsSoldOut ErrorCode = 1700 //商品已售罄 ) // Enum value maps for ErrorCode. @@ -211,6 +213,7 @@ var ( 1606: "TaskActiveNoenough", 1607: "TaskNoFinished", 1608: "TaskFinished", + 1700: "ShopGoodsIsSoldOut", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -301,6 +304,7 @@ var ( "TaskActiveNoenough": 1606, "TaskNoFinished": 1607, "TaskFinished": 1608, + "ShopGoodsIsSoldOut": 1700, } ) @@ -335,7 +339,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0xc3, 0x0e, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xdc, 0x0e, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -451,8 +455,9 @@ var file_errorcode_proto_rawDesc = []byte{ 0x74, 0x69, 0x76, 0x65, 0x4e, 0x6f, 0x65, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xc6, 0x0c, 0x12, 0x13, 0x0a, 0x0e, 0x54, 0x61, 0x73, 0x6b, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc7, 0x0c, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x53, 0x68, 0x6f, 0x70, 0x47, + 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x73, 0x53, 0x6f, 0x6c, 0x64, 0x4f, 0x75, 0x74, 0x10, 0xa4, 0x0d, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/proto/errorcode.proto b/pb/proto/errorcode.proto index 556a56595..d50b99127 100644 --- a/pb/proto/errorcode.proto +++ b/pb/proto/errorcode.proto @@ -103,4 +103,7 @@ enum ErrorCode { TaskActiveNoenough = 1606; //活跃值未达标 TaskNoFinished = 1607; //任务未完成 TaskFinished = 1608; //已完成 + + // shop + ShopGoodsIsSoldOut = 1700; //商品已售罄 } \ No newline at end of file diff --git a/pb/proto/shop/shop_db.proto b/pb/proto/shop/shop_db.proto index 3f5294eda..eebb822bd 100644 --- a/pb/proto/shop/shop_db.proto +++ b/pb/proto/shop/shop_db.proto @@ -30,6 +30,6 @@ message DBShopItem { string id = 1; //@go_tags(`bson:"_id"`) 装备id string uid = 2; //@go_tags(`bson:"uid"`) 装备id int32 goodsId = 3; //@go_tags(`bson:"goodsId"`)商品Id - int32 buyNum = 4; //@go_tags(`bson:"buyNum"`)购买数量 - int64 lastBuyTime = 5; //@go_tags(`bson:"lastBuyTime"`)最后一次购买的时间 + map buyNum = 4; //@go_tags(`bson:"buyNum"`)购买数量 + map lastBuyTime = 5; //@go_tags(`bson:"lastBuyTime"`)最后一次购买的时间 } \ No newline at end of file diff --git a/pb/proto/shop/shop_msg.proto b/pb/proto/shop/shop_msg.proto index 96c3dc9d2..f6a5ab75c 100644 --- a/pb/proto/shop/shop_msg.proto +++ b/pb/proto/shop/shop_msg.proto @@ -26,7 +26,8 @@ message ShopGetListResp { //购买商品 请求 message ShopBuyReq { - int32 GoodsId = 1; //商品Id + ShopType ShopType = 1; //商店类型 + int32 GoodsId = 2; //商品Id } //购买商品 回应 diff --git a/pb/shop_db.pb.go b/pb/shop_db.pb.go index 3fc29556c..5fe8a5354 100644 --- a/pb/shop_db.pb.go +++ b/pb/shop_db.pb.go @@ -241,11 +241,11 @@ type DBShopItem struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //装备id - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //装备id - GoodsId int32 `protobuf:"varint,3,opt,name=goodsId,proto3" json:"goodsId"` //@go_tags(`bson:"goodsId"`)商品Id - BuyNum int32 `protobuf:"varint,4,opt,name=buyNum,proto3" json:"buyNum"` //@go_tags(`bson:"buyNum"`)购买数量 - LastBuyTime int64 `protobuf:"varint,5,opt,name=lastBuyTime,proto3" json:"lastBuyTime"` //@go_tags(`bson:"lastBuyTime"`)最后一次购买的时间 + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //装备id + Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //装备id + GoodsId int32 `protobuf:"varint,3,opt,name=goodsId,proto3" json:"goodsId"` //@go_tags(`bson:"goodsId"`)商品Id + BuyNum map[int32]int32 `protobuf:"bytes,4,rep,name=buyNum,proto3" json:"buyNum" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //@go_tags(`bson:"buyNum"`)购买数量 + LastBuyTime map[int32]int64 `protobuf:"bytes,5,rep,name=lastBuyTime,proto3" json:"lastBuyTime" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //@go_tags(`bson:"lastBuyTime"`)最后一次购买的时间 } func (x *DBShopItem) Reset() { @@ -301,18 +301,18 @@ func (x *DBShopItem) GetGoodsId() int32 { return 0 } -func (x *DBShopItem) GetBuyNum() int32 { +func (x *DBShopItem) GetBuyNum() map[int32]int32 { if x != nil { return x.BuyNum } - return 0 + return nil } -func (x *DBShopItem) GetLastBuyTime() int64 { +func (x *DBShopItem) GetLastBuyTime() map[int32]int64 { if x != nil { return x.LastBuyTime } - return 0 + return nil } var File_shop_shop_db_proto protoreflect.FileDescriptor @@ -343,23 +343,34 @@ var file_shop_shop_db_proto_rawDesc = []byte{ 0x74, 0x61, 0x52, 0x07, 0x70, 0x76, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x31, 0x0a, 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, - 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x22, 0x82, - 0x01, 0x0a, 0x0a, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, + 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x22, 0xb4, + 0x02, 0x0a, 0x0a, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x07, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x79, - 0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, - 0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, - 0x69, 0x6d, 0x65, 0x2a, 0x5f, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, - 0x08, 0x0a, 0x04, 0x4e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x6f, 0x6c, - 0x64, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x6d, 0x6f, - 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x50, 0x53, - 0x68, 0x6f, 0x70, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x45, 0x53, 0x68, 0x6f, 0x70, - 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, - 0x6f, 0x70, 0x10, 0x05, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x07, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x06, 0x62, 0x75, 0x79, + 0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x53, 0x68, + 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x45, 0x6e, 0x74, + 0x72, 0x79, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x3e, 0x0a, 0x0b, 0x6c, 0x61, + 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x61, 0x73, + 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6c, + 0x61, 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x42, 0x75, + 0x79, 0x4e, 0x75, 0x6d, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3e, 0x0a, 0x10, 0x4c, 0x61, 0x73, 0x74, 0x42, 0x75, 0x79, + 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x2a, 0x5f, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x47, + 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x69, 0x61, + 0x6d, 0x6f, 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, + 0x50, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x45, 0x53, 0x68, + 0x6f, 0x70, 0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, + 0x53, 0x68, 0x6f, 0x70, 0x10, 0x05, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -375,12 +386,14 @@ func file_shop_shop_db_proto_rawDescGZIP() []byte { } var file_shop_shop_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_shop_shop_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_shop_shop_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_shop_shop_db_proto_goTypes = []interface{}{ (ShopType)(0), // 0: ShopType (*UserShopData)(nil), // 1: UserShopData (*DBShop)(nil), // 2: DBShop (*DBShopItem)(nil), // 3: DBShopItem + nil, // 4: DBShopItem.BuyNumEntry + nil, // 5: DBShopItem.LastBuyTimeEntry } var file_shop_shop_db_proto_depIdxs = []int32{ 1, // 0: DBShop.goldShop:type_name -> UserShopData @@ -388,11 +401,13 @@ var file_shop_shop_db_proto_depIdxs = []int32{ 1, // 2: DBShop.pvpShop:type_name -> UserShopData 1, // 3: DBShop.pveShop:type_name -> UserShopData 1, // 4: DBShop.allianceShop:type_name -> UserShopData - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 4, // 5: DBShopItem.buyNum:type_name -> DBShopItem.BuyNumEntry + 5, // 6: DBShopItem.lastBuyTime:type_name -> DBShopItem.LastBuyTimeEntry + 7, // [7:7] is the sub-list for method output_type + 7, // [7:7] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_shop_shop_db_proto_init() } @@ -444,7 +459,7 @@ func file_shop_shop_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_shop_shop_db_proto_rawDesc, NumEnums: 1, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/shop_msg.pb.go b/pb/shop_msg.pb.go index 00c1766e1..20aac5fa2 100644 --- a/pb/shop_msg.pb.go +++ b/pb/shop_msg.pb.go @@ -210,7 +210,8 @@ type ShopBuyReq struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - GoodsId int32 `protobuf:"varint,1,opt,name=GoodsId,proto3" json:"GoodsId"` //商品Id + ShopType ShopType `protobuf:"varint,1,opt,name=ShopType,proto3,enum=ShopType" json:"ShopType"` //商店类型 + GoodsId int32 `protobuf:"varint,2,opt,name=GoodsId,proto3" json:"GoodsId"` //商品Id } func (x *ShopBuyReq) Reset() { @@ -245,6 +246,13 @@ func (*ShopBuyReq) Descriptor() ([]byte, []int) { return file_shop_shop_msg_proto_rawDescGZIP(), []int{3} } +func (x *ShopBuyReq) GetShopType() ShopType { + if x != nil { + return x.ShopType + } + return ShopType_Null +} + func (x *ShopBuyReq) GetGoodsId() int32 { if x != nil { return x.GoodsId @@ -325,13 +333,16 @@ var file_shop_shop_msg_proto_rawDesc = []byte{ 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x22, 0x32, 0x0a, 0x0f, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x05, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x53, 0x68, 0x6f, 0x70, - 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x22, 0x26, 0x0a, 0x0a, 0x53, - 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 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, 0x22, 0x25, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, - 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x74, 0x65, 0x6d, 0x52, 0x05, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x22, 0x4d, 0x0a, 0x0a, 0x53, + 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x25, 0x0a, 0x08, 0x53, 0x68, 0x6f, + 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x53, 0x68, + 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x0b, 0x53, 0x68, + 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x73, 0x53, + 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, + 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -361,11 +372,12 @@ var file_shop_shop_msg_proto_depIdxs = []int32{ 5, // 1: ShopItem.Consume:type_name -> UserAssets 6, // 2: ShopGetListReq.sType:type_name -> ShopType 0, // 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 - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name + 6, // 4: ShopBuyReq.ShopType:type_name -> ShopType + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_shop_shop_msg_proto_init() }