修改商店模块购买次数共享bug

This commit is contained in:
liwei1dao 2022-07-25 15:41:58 +08:00
parent c7d8bc15dc
commit 3be9f754ba
12 changed files with 116 additions and 74 deletions

View File

@ -240,11 +240,11 @@ func (this *numericMapKeyDecoder) GetType() reflect.Kind {
return this.decoder.GetType() return this.decoder.GetType()
} }
func (this *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, extra core.IExtractor) { func (this *numericMapKeyDecoder) Decode(ptr unsafe.Pointer, extra core.IExtractor) {
if extra.ReadKeyStart() { if !extra.ReadKeyStart() {
return return
} }
this.decoder.Decode(ptr, extra) this.decoder.Decode(ptr, extra)
if extra.ReadKeyEnd() { if !extra.ReadKeyEnd() {
return return
} }
} }

View File

@ -168,7 +168,7 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) {
return return
} }
ret = uint32(ind) ret = uint32(ind)
if len(buf) > 10 { if len(buf) > 11 {
i := 1 i := 1
ind2 := intDigits[buf[i]] ind2 := intDigits[buf[i]]
if ind2 == invalidCharForNumber { if ind2 == invalidCharForNumber {
@ -246,11 +246,13 @@ func ReadUint32ForString(buf []byte) (ret uint32, n int, err error) {
err = errors.New("ReadUint32ForString overflow") err = errors.New("ReadUint32ForString overflow")
return return
} }
n = i
ret = value2 ret = value2
continue continue
} }
ret = (ret << 3) + (ret << 1) + uint32(ind) ret = (ret << 3) + (ret << 1) + uint32(ind)
} }
n = len(buf)
return return
} }
@ -266,8 +268,8 @@ func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) {
return return
} }
ret = uint64(ind) ret = uint64(ind)
if len(buf) > 10 { if len(buf) > 11 {
i := 0 i := 1
ind2 := intDigits[buf[i]] ind2 := intDigits[buf[i]]
if ind2 == invalidCharForNumber { if ind2 == invalidCharForNumber {
n = i n = i
@ -345,10 +347,12 @@ func ReadUint64ForString(buf []byte) (ret uint64, n int, err error) {
return return
} }
ret = value2 ret = value2
n = i
continue continue
} }
ret = (ret << 3) + (ret << 1) + uint64(ind) ret = (ret << 3) + (ret << 1) + uint64(ind)
} }
n = len(buf)
return return
} }

View File

@ -1,6 +1,7 @@
package shop package shop
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -13,7 +14,9 @@ import (
//参数校验 //参数校验
func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.ShopBuyReq) (code pb.ErrorCode) { 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 return
} }
@ -26,13 +29,6 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
shopitem *pb.DBShopItem shopitem *pb.DBShopItem
need []*cfg.Game_atn 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 { if conf, err = this.module.configure.GetShopItemsConfigure(req.GoodsId); err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
@ -42,8 +38,8 @@ func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb
Id: primitive.NewObjectID().Hex(), Id: primitive.NewObjectID().Hex(),
Uid: session.GetUserId(), Uid: session.GetUserId(),
GoodsId: conf.Key, GoodsId: conf.Key,
BuyNum: 0, BuyNum: map[int32]int32{1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
LastBuyTime: 0, LastBuyTime: map[int32]int64{1: 0, 2: 0, 3: 0, 4: 0, 5: 0},
} }
} }
need = make([]*cfg.Game_atn, len(conf.Need)) 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 { if code = this.module.DispenseRes(session, conf.Iteminfo, true); code != pb.ErrorCode_Success {
return return
} }
shopitem.BuyNum++ if conf.Buyminnum-shopitem.BuyNum[int32(req.ShopType)] < 0 {
shopitem.LastBuyTime = time.Now().Unix() code = pb.ErrorCode_ShopGoodsIsSoldOut
return
}
shopitem.BuyNum[int32(req.ShopType)]++
shopitem.LastBuyTime[int32(req.ShopType)] = time.Now().Unix()
if !ok { if !ok {
this.module.modelShopItems.AddList(session.GetUserId(), shopitem.Id, shopitem) this.module.modelShopItems.AddList(session.GetUserId(), shopitem.Id, shopitem)
} else { } else {
this.module.modelShopItems.ChangeList(session.GetUserId(), shopitem.Id, map[string]interface{}{ this.module.modelShopItems.ChangeList(session.GetUserId(), shopitem.Id, map[string]interface{}{
"buynum": shopitem.BuyNum, fmt.Sprintf("buynum.%d", req.ShopType): shopitem.BuyNum,
"lastbuytime": shopitem.LastBuyTime, fmt.Sprintf("lastbuytime.%d", req.ShopType): shopitem.LastBuyTime,
}) })
} }
session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{IsSucc: true})
return return
} }

View File

@ -101,7 +101,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
} }
items = append(items, randomGoods(_items)) items = append(items, randomGoods(_items))
} }
goods = transGoods(items, ushoputem) goods = transGoods(req.SType, items, ushoputem)
sdata.LastRefreshTime = time.Now().Unix() sdata.LastRefreshTime = time.Now().Unix()
sdata.Items = make([]int32, len(items)) sdata.Items = make([]int32, len(items))
for i, v := range 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)) items = append(items, randomGoods(_items))
} }
goods = transGoods(items, ushoputem) goods = transGoods(req.SType, items, ushoputem)
sdata.LastRefreshTime = time.Now().Unix() sdata.LastRefreshTime = time.Now().Unix()
sdata.Items = make([]int32, len(items)) sdata.Items = make([]int32, len(items))
for i, v := range items { for i, v := range items {
@ -130,7 +130,7 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
return return
} }
goods = transGoods(items, ushoputem) goods = transGoods(req.SType, items, ushoputem)
} }
} else { } else {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError

View File

@ -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)) result = make([]*pb.ShopItem, len(goods))
ok := false ok := false
uitem := &pb.DBShopItem{} uitem := &pb.DBShopItem{}
@ -43,7 +43,7 @@ func transGoods(goods []*cfg.Game_shopitemData, ushoputem map[int32]*pb.DBShopIt
GoodsId: v.Key, GoodsId: v.Key,
Sale: int32(v.Sale), 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)) result[i].Items = make([]*pb.UserAssets, len(v.Iteminfo))
for i1, v1 := range v.Iteminfo { for i1, v1 := range v.Iteminfo {
result[i].Items[i1] = &pb.UserAssets{ result[i].Items[i1] = &pb.UserAssets{

View File

@ -34,7 +34,7 @@ func (this *modelShopItemsComp) QueryUserShopData(uId string) (result map[int32]
result = make(map[int32]*pb.DBShopItem) result = make(map[int32]*pb.DBShopItem)
data := make([]*pb.DBShopItem, 0) data := make([]*pb.DBShopItem, 0)
if err = this.GetList(uId, &data); err != nil && err != mgo.MongodbNil { if err = this.GetList(uId, &data); err != nil && err != mgo.MongodbNil {
err = nil this.module.Errorf("err:%v", err)
return return
} }
err = nil err = nil

View File

@ -118,6 +118,8 @@ const (
ErrorCode_TaskActiveNoenough ErrorCode = 1606 //活跃值未达标 ErrorCode_TaskActiveNoenough ErrorCode = 1606 //活跃值未达标
ErrorCode_TaskNoFinished ErrorCode = 1607 //任务未完成 ErrorCode_TaskNoFinished ErrorCode = 1607 //任务未完成
ErrorCode_TaskFinished ErrorCode = 1608 //已完成 ErrorCode_TaskFinished ErrorCode = 1608 //已完成
// shop
ErrorCode_ShopGoodsIsSoldOut ErrorCode = 1700 //商品已售罄
) )
// Enum value maps for ErrorCode. // Enum value maps for ErrorCode.
@ -211,6 +213,7 @@ var (
1606: "TaskActiveNoenough", 1606: "TaskActiveNoenough",
1607: "TaskNoFinished", 1607: "TaskNoFinished",
1608: "TaskFinished", 1608: "TaskFinished",
1700: "ShopGoodsIsSoldOut",
} }
ErrorCode_value = map[string]int32{ ErrorCode_value = map[string]int32{
"Success": 0, "Success": 0,
@ -301,6 +304,7 @@ var (
"TaskActiveNoenough": 1606, "TaskActiveNoenough": 1606,
"TaskNoFinished": 1607, "TaskNoFinished": 1607,
"TaskFinished": 1608, "TaskFinished": 1608,
"ShopGoodsIsSoldOut": 1700,
} }
) )
@ -335,7 +339,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
var file_errorcode_proto_rawDesc = []byte{ var file_errorcode_proto_rawDesc = []byte{
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 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, 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, 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, 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, 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, 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, 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, 0x73, 0x68, 0x65, 0x64, 0x10, 0xc8, 0x0c, 0x12, 0x17, 0x0a, 0x12, 0x53, 0x68, 0x6f, 0x70, 0x47,
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (

View File

@ -103,4 +103,7 @@ enum ErrorCode {
TaskActiveNoenough = 1606; // TaskActiveNoenough = 1606; //
TaskNoFinished = 1607; // TaskNoFinished = 1607; //
TaskFinished = 1608; // TaskFinished = 1608; //
// shop
ShopGoodsIsSoldOut = 1700; //
} }

View File

@ -30,6 +30,6 @@ message DBShopItem {
string id = 1; //@go_tags(`bson:"_id"`) id string id = 1; //@go_tags(`bson:"_id"`) id
string uid = 2; //@go_tags(`bson:"uid"`) id string uid = 2; //@go_tags(`bson:"uid"`) id
int32 goodsId = 3; //@go_tags(`bson:"goodsId"`)Id int32 goodsId = 3; //@go_tags(`bson:"goodsId"`)Id
int32 buyNum = 4; //@go_tags(`bson:"buyNum"`) map<int32,int32> buyNum = 4; //@go_tags(`bson:"buyNum"`)
int64 lastBuyTime = 5; //@go_tags(`bson:"lastBuyTime"`) map<int32,int64> lastBuyTime = 5; //@go_tags(`bson:"lastBuyTime"`)
} }

View File

@ -26,7 +26,8 @@ message ShopGetListResp {
// //
message ShopBuyReq { message ShopBuyReq {
int32 GoodsId = 1; //Id ShopType ShopType = 1; //
int32 GoodsId = 2; //Id
} }
// //

View File

@ -241,11 +241,11 @@ type DBShopItem struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //装备id 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 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 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"`)购买数量 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 int64 `protobuf:"varint,5,opt,name=lastBuyTime,proto3" json:"lastBuyTime"` //@go_tags(`bson:"lastBuyTime"`)最后一次购买的时间 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() { func (x *DBShopItem) Reset() {
@ -301,18 +301,18 @@ func (x *DBShopItem) GetGoodsId() int32 {
return 0 return 0
} }
func (x *DBShopItem) GetBuyNum() int32 { func (x *DBShopItem) GetBuyNum() map[int32]int32 {
if x != nil { if x != nil {
return x.BuyNum return x.BuyNum
} }
return 0 return nil
} }
func (x *DBShopItem) GetLastBuyTime() int64 { func (x *DBShopItem) GetLastBuyTime() map[int32]int64 {
if x != nil { if x != nil {
return x.LastBuyTime return x.LastBuyTime
} }
return 0 return nil
} }
var File_shop_shop_db_proto protoreflect.FileDescriptor 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, 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, 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, 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, 0x52, 0x0c, 0x61, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 0x22, 0xb4,
0x01, 0x0a, 0x0a, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x12, 0x0e, 0x0a, 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, 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, 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, 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, 0x52, 0x07, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x06, 0x62, 0x75, 0x79,
0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x4e, 0x75, 0x6d, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x53, 0x68,
0x6d, 0x12, 0x20, 0x0a, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x42, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x45, 0x6e, 0x74,
0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, 0x72, 0x79, 0x52, 0x06, 0x62, 0x75, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x3e, 0x0a, 0x0b, 0x6c, 0x61,
0x69, 0x6d, 0x65, 0x2a, 0x5f, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x12, 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x08, 0x0a, 0x04, 0x4e, 0x75, 0x6c, 0x6c, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x47, 0x6f, 0x6c, 0x1c, 0x2e, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 0x49, 0x74, 0x65, 0x6d, 0x2e, 0x4c, 0x61, 0x73,
0x64, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x6c,
0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x10, 0x02, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x50, 0x53, 0x61, 0x73, 0x74, 0x42, 0x75, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x42, 0x75,
0x68, 0x6f, 0x70, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x56, 0x45, 0x53, 0x68, 0x6f, 0x70, 0x79, 0x4e, 0x75, 0x6d, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
0x10, 0x04, 0x12, 0x10, 0x0a, 0x0c, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
0x6f, 0x70, 0x10, 0x05, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
0x6f, 0x74, 0x6f, 0x33, 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 ( 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_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{}{ var file_shop_shop_db_proto_goTypes = []interface{}{
(ShopType)(0), // 0: ShopType (ShopType)(0), // 0: ShopType
(*UserShopData)(nil), // 1: UserShopData (*UserShopData)(nil), // 1: UserShopData
(*DBShop)(nil), // 2: DBShop (*DBShop)(nil), // 2: DBShop
(*DBShopItem)(nil), // 3: DBShopItem (*DBShopItem)(nil), // 3: DBShopItem
nil, // 4: DBShopItem.BuyNumEntry
nil, // 5: DBShopItem.LastBuyTimeEntry
} }
var file_shop_shop_db_proto_depIdxs = []int32{ var file_shop_shop_db_proto_depIdxs = []int32{
1, // 0: DBShop.goldShop:type_name -> UserShopData 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, // 2: DBShop.pvpShop:type_name -> UserShopData
1, // 3: DBShop.pveShop:type_name -> UserShopData 1, // 3: DBShop.pveShop:type_name -> UserShopData
1, // 4: DBShop.allianceShop:type_name -> UserShopData 1, // 4: DBShop.allianceShop:type_name -> UserShopData
5, // [5:5] is the sub-list for method output_type 4, // 5: DBShopItem.buyNum:type_name -> DBShopItem.BuyNumEntry
5, // [5:5] is the sub-list for method input_type 5, // 6: DBShopItem.lastBuyTime:type_name -> DBShopItem.LastBuyTimeEntry
5, // [5:5] is the sub-list for extension type_name 7, // [7:7] is the sub-list for method output_type
5, // [5:5] is the sub-list for extension extendee 7, // [7:7] is the sub-list for method input_type
0, // [0:5] is the sub-list for field type_name 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() } func init() { file_shop_shop_db_proto_init() }
@ -444,7 +459,7 @@ func file_shop_shop_db_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_shop_shop_db_proto_rawDesc, RawDescriptor: file_shop_shop_db_proto_rawDesc,
NumEnums: 1, NumEnums: 1,
NumMessages: 3, NumMessages: 5,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,
}, },

View File

@ -210,7 +210,8 @@ type ShopBuyReq struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields 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() { func (x *ShopBuyReq) Reset() {
@ -245,6 +246,13 @@ func (*ShopBuyReq) Descriptor() ([]byte, []int) {
return file_shop_shop_msg_proto_rawDescGZIP(), []int{3} 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 { func (x *ShopBuyReq) GetGoodsId() int32 {
if x != nil { if x != nil {
return x.GoodsId 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, 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, 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, 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, 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, 0x18, 0x0a, 0x07, 0x47, 0x6f, 0x6f, 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x12, 0x25, 0x0a, 0x08, 0x53, 0x68, 0x6f,
0x64, 0x73, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x70, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x53, 0x68,
0x73, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x08, 0x53, 0x68, 0x6f, 0x70, 0x54, 0x79, 0x70, 0x65,
0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
0x28, 0x08, 0x52, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x05, 0x52, 0x07, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x49, 0x64, 0x22, 0x25, 0x0a, 0x0b, 0x53, 0x68,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 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 ( var (
@ -361,11 +372,12 @@ var file_shop_shop_msg_proto_depIdxs = []int32{
5, // 1: ShopItem.Consume:type_name -> UserAssets 5, // 1: ShopItem.Consume:type_name -> UserAssets
6, // 2: ShopGetListReq.sType:type_name -> ShopType 6, // 2: ShopGetListReq.sType:type_name -> ShopType
0, // 3: ShopGetListResp.Goods:type_name -> ShopItem 0, // 3: ShopGetListResp.Goods:type_name -> ShopItem
4, // [4:4] is the sub-list for method output_type 6, // 4: ShopBuyReq.ShopType:type_name -> ShopType
4, // [4:4] is the sub-list for method input_type 5, // [5:5] is the sub-list for method output_type
4, // [4:4] is the sub-list for extension type_name 5, // [5:5] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension extendee 5, // [5:5] is the sub-list for extension type_name
0, // [0:4] is the sub-list for field 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() } func init() { file_shop_shop_msg_proto_init() }