diff --git a/bin/json/game_shop.json b/bin/json/game_shop.json new file mode 100644 index 000000000..68a471f85 --- /dev/null +++ b/bin/json/game_shop.json @@ -0,0 +1,131 @@ +[ + { + "shopid": 1, + "tab": 1, + "shopname": "金币商店", + "needshow": [ + { + "a": "attr", + "t": "gold", + "n": 1 + }, + { + "a": "attr", + "t": "money", + "n": 1 + } + ], + "rtype": 1, + "rtime": 6, + "rnum": 10, + "rneed": [ + { + "a": "attr", + "t": "money", + "n": 20 + } + ], + "shopitem": [ + 10001, + 10002, + 10003 + ] + }, + { + "shopid": 2, + "tab": 2, + "shopname": "钻石商店", + "needshow": [ + { + "a": "attr", + "t": "gold", + "n": 1 + }, + { + "a": "attr", + "t": "money", + "n": 1 + } + ], + "rtype": 2, + "rtime": 1, + "rnum": -1, + "rneed": [], + "shopitem": [ + 10004 + ] + }, + { + "shopid": 3, + "tab": 3, + "shopname": "PVP商店", + "needshow": [ + { + "a": "attr", + "t": "gold", + "n": 1 + }, + { + "a": "attr", + "t": "money", + "n": 1 + } + ], + "rtype": 3, + "rtime": 1, + "rnum": -1, + "rneed": [], + "shopitem": [ + 10005 + ] + }, + { + "shopid": 4, + "tab": 4, + "shopname": "PVE商店", + "needshow": [ + { + "a": "attr", + "t": "gold", + "n": 1 + }, + { + "a": "attr", + "t": "money", + "n": 1 + } + ], + "rtype": 3, + "rtime": 1, + "rnum": -1, + "rneed": [], + "shopitem": [ + 10006 + ] + }, + { + "shopid": 5, + "tab": 5, + "shopname": "联盟商店", + "needshow": [ + { + "a": "attr", + "t": "gold", + "n": 1 + }, + { + "a": "attr", + "t": "money", + "n": 1 + } + ], + "rtype": 2, + "rtime": 14, + "rnum": -1, + "rneed": [], + "shopitem": [ + 10007, + 10008 + ] + } +] \ No newline at end of file diff --git a/bin/json/game_shopitem.json b/bin/json/game_shopitem.json new file mode 100644 index 000000000..9fef4f6e9 --- /dev/null +++ b/bin/json/game_shopitem.json @@ -0,0 +1,1094 @@ +[ + { + "key": 1, + "id": 10001, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 110 + }, + { + "key": 2, + "id": 10001, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 10 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 20000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 1, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 111, + "mapidmax": 120 + }, + { + "key": 3, + "id": 10001, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 15 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 30000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 2, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 201, + "mapidmax": 220 + }, + { + "key": 4, + "id": 10001, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 20 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 40000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 3, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 221, + "mapidmax": 320 + }, + { + "key": 5, + "id": 10001, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 25 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 50000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 4, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 321, + "mapidmax": 340 + }, + { + "key": 6, + "id": 10001, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 30 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 60000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 5, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 340, + "mapidmax": 9999 + }, + { + "key": 7, + "id": 10002, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 8, + "id": 10002, + "iteminfo": [ + { + "a": "item", + "t": "10002", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 2, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 9, + "id": 10002, + "iteminfo": [ + { + "a": "item", + "t": "10003", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 3, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 10, + "id": 10003, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 110 + }, + { + "key": 11, + "id": 10003, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 10 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 20000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 1, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 111, + "mapidmax": 120 + }, + { + "key": 12, + "id": 10003, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 15 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 30000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 2, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 201, + "mapidmax": 220 + }, + { + "key": 13, + "id": 10003, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 20 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 40000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 3, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 221, + "mapidmax": 320 + }, + { + "key": 14, + "id": 10003, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 25 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 50000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 4, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 321, + "mapidmax": 340 + }, + { + "key": 15, + "id": 10003, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 30 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 60000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 5, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 340, + "mapidmax": 9999 + }, + { + "key": 16, + "id": 10004, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 17, + "id": 10004, + "iteminfo": [ + { + "a": "item", + "t": "10002", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 2, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 18, + "id": 10004, + "iteminfo": [ + { + "a": "item", + "t": "10003", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 3, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 19, + "id": 10005, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 110 + }, + { + "key": 20, + "id": 10005, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 10 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 20000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 1, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 111, + "mapidmax": 120 + }, + { + "key": 21, + "id": 10005, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 15 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 30000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 2, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 201, + "mapidmax": 220 + }, + { + "key": 22, + "id": 10005, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 20 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 40000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 3, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 221, + "mapidmax": 320 + }, + { + "key": 23, + "id": 10005, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 25 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 50000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 4, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 321, + "mapidmax": 340 + }, + { + "key": 24, + "id": 10005, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 30 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 60000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 5, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 340, + "mapidmax": 9999 + }, + { + "key": 25, + "id": 10006, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 26, + "id": 10006, + "iteminfo": [ + { + "a": "item", + "t": "10002", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 2, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 27, + "id": 10006, + "iteminfo": [ + { + "a": "item", + "t": "10003", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 3, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 28, + "id": 10007, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 110 + }, + { + "key": 29, + "id": 10007, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 10 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 20000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 1, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 111, + "mapidmax": 120 + }, + { + "key": 30, + "id": 10007, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 15 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 30000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 2, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 201, + "mapidmax": 220 + }, + { + "key": 31, + "id": 10007, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 20 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 40000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 3, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 221, + "mapidmax": 320 + }, + { + "key": 32, + "id": 10007, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 25 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 50000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 4, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 321, + "mapidmax": 340 + }, + { + "key": 33, + "id": 10007, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 30 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 60000 + } + ], + "sale": 5, + "salelist": [], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 5, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 340, + "mapidmax": 9999 + }, + { + "key": 34, + "id": 10008, + "iteminfo": [ + { + "a": "item", + "t": "10001", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 1, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 35, + "id": 10008, + "iteminfo": [ + { + "a": "item", + "t": "10002", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 2, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + }, + { + "key": 36, + "id": 10008, + "iteminfo": [ + { + "a": "item", + "t": "10003", + "n": 5 + } + ], + "probability": 200, + "need": [ + { + "a": "attr", + "t": "gold", + "n": 10000 + } + ], + "sale": 10, + "salelist": [ + 1000, + 1000, + 1100, + 1200, + 1300, + 1400 + ], + "buyminnum": 3, + "buymaxnum": 10, + "vip": 0, + "lvmin": 1, + "lvmax": 1, + "mapidmin": 101, + "mapidmax": 9999 + } +] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index 9f2b45254..5382bb3a3 100644 --- a/comm/const.go +++ b/comm/const.go @@ -39,6 +39,7 @@ const ( ModuleHero core.M_Modules = "hero" //英雄模块 ModuleForum core.M_Modules = "forum" //论坛模块 ModuleItems core.M_Modules = "items" //道具模块 + ModuleShop core.M_Modules = "shop" //商店模块 ) //RPC服务接口定义处 diff --git a/modules/shop/api.go b/modules/shop/api.go new file mode 100644 index 000000000..ca0db884b --- /dev/null +++ b/modules/shop/api.go @@ -0,0 +1,29 @@ +package shop + +import ( + "go_dreamfactory/modules" + + "go_dreamfactory/lego/core" +) + +/* +装备模块 API +*/ +type apiComp struct { + modules.MCompGate + service core.IService + module *Shop +} + +//组件初始化接口 +func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.MCompGate.Init(service, module, comp, options) + this.module = module.(*Shop) + this.service = service + return +} + +func (this *apiComp) Start() (err error) { + err = this.MCompGate.Start() + return +} diff --git a/modules/shop/api_buy.go b/modules/shop/api_buy.go new file mode 100644 index 000000000..9d8a0fcb6 --- /dev/null +++ b/modules/shop/api_buy.go @@ -0,0 +1,26 @@ +package shop + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) BuyCheck(session comm.IUserSession, req *pb.ShopBuyReq) (code pb.ErrorCode) { + + return +} + +///获取用户商品列表 +func (this *apiComp) Buy(session comm.IUserSession, req *pb.ShopBuyReq) (code pb.ErrorCode, data proto.Message) { + var () + defer func() { + if code == pb.ErrorCode_Success { + session.SendMsg(string(this.module.GetType()), "buy", &pb.ShopBuyResp{}) + } + }() + + return +} diff --git a/modules/shop/api_getlist.go b/modules/shop/api_getlist.go new file mode 100644 index 000000000..890f5c0a8 --- /dev/null +++ b/modules/shop/api_getlist.go @@ -0,0 +1,85 @@ +package shop + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/mgo" + "go_dreamfactory/pb" + cfg "go_dreamfactory/sys/configure/structs" + "time" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) GetlistCheck(session comm.IUserSession, req *pb.ShopGetListReq) (code pb.ErrorCode) { + + return +} + +///获取用户商品列表 +func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) (code pb.ErrorCode, data proto.Message) { + var ( + err error + shopconf *cfg.Game_shopData + shopData *pb.DBShop + sdata *pb.UserShopData + tdata time.Duration + ltime time.Duration + ) + defer func() { + if code == pb.ErrorCode_Success { + session.SendMsg(string(this.module.GetType()), "getlist", &pb.ShopGetListResp{}) + } + }() + if shopconf, err = this.module.configure.GetShopConfigure(int32(req.SType)); err != nil && err != mgo.MongodbNil { + code = pb.ErrorCode_SystemError + return + } + if shopData, err = this.module.modelShop.QueryUserShopData(session.GetUserId()); err != nil && err != mgo.MongodbNil { + code = pb.ErrorCode_SystemError + return + } + switch req.SType { + case pb.ShopType_GoldShop: + sdata = shopData.GoldShop + break + case pb.ShopType_DiamondShop: + sdata = shopData.DiamondShop + break + case pb.ShopType_PVPShop: + sdata = shopData.PVPShop + break + case pb.ShopType_PVEShop: + sdata = shopData.PVEShop + break + case pb.ShopType_AllianceShop: + sdata = shopData.AllianceShop + break + } + if sdata == nil { + sdata = &pb.UserShopData{} + } + tdata = time.Since(time.Unix(sdata.LastRefreshTime, 0)) + switch shopconf.Rtype { + case 1: + ltime = time.Hour * time.Duration(shopconf.Rtime) + break + case 2: + ltime = 24 * time.Hour * time.Duration(shopconf.Rtime) + break + case 3: + ltime = 7 * 24 * time.Hour * time.Duration(shopconf.Rtime) + break + case 4: + ltime = 30 * 7 * 24 * time.Hour * time.Duration(shopconf.Rtime) + break + } + + if tdata > ltime { //达到刷新时间 可以刷新商品列表 + + } else { + + } + + return +} diff --git a/modules/shop/configure.go b/modules/shop/configure.go new file mode 100644 index 000000000..58a144357 --- /dev/null +++ b/modules/shop/configure.go @@ -0,0 +1,46 @@ +package shop + +import ( + "fmt" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/modules" + cfg "go_dreamfactory/sys/configure/structs" +) + +const ( + game_shop = "game_shop.json" + game_shopitem = "game_shopitem.json" +) + +///背包配置管理组件 +type configureComp struct { + modules.MCompConfigure +} + +//组件初始化接口 +func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + this.ModuleCompBase.Init(service, module, comp, options) + this.LoadConfigure(game_shop, cfg.NewGame_shop) + this.LoadConfigure(game_shopitem, cfg.NewGame_shopitem) + return +} + +//获取装备配置数据 +func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.Game_shopData, err error) { + var ( + v interface{} + ok bool + ) + if v, err = this.GetConfigure(game_shop); err != nil { + log.Errorf("err:%v", err) + return + } else { + if configure, ok = v.(*cfg.Game_shop).GetDataMap()[id]; !ok { + err = fmt.Errorf("ShopConfigure not found:%d ", id) + log.Errorf("err:%v", err) + return + } + } + return +} diff --git a/modules/shop/model_shop.go b/modules/shop/model_shop.go new file mode 100644 index 000000000..82f0cdb56 --- /dev/null +++ b/modules/shop/model_shop.go @@ -0,0 +1,35 @@ +package shop + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" + "go_dreamfactory/pb" + + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/x/bsonx" +) + +///论坛 数据组件 +type modelShopComp struct { + modules.MCompModel + module *Shop +} + +//组件初始化接口 +func (this *modelShopComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) { + this.MCompModel.Init(service, module, comp, opt) + this.module = module.(*Shop) + this.TableName = "forum" + //创建uid索引 + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, + }) + return +} + +//查询用户装备数据 +func (this *modelShopComp) QueryUserShopData(uId string) (data *pb.DBShop, err error) { + data = &pb.DBShop{} + err = this.Get(uId, data) + return +} diff --git a/modules/shop/module.go b/modules/shop/module.go new file mode 100644 index 000000000..9a9a331b2 --- /dev/null +++ b/modules/shop/module.go @@ -0,0 +1,43 @@ +package shop + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +/* +模块名:商店 +描述:商城相关业务 +开发:李伟 +*/ +func NewModule() core.IModule { + m := new(Shop) + return m +} + +type Shop struct { + modules.ModuleBase + api_comp *apiComp + configure *configureComp + modelShop *modelShopComp +} + +//模块名 +func (this *Shop) GetType() core.M_Modules { + return comm.ModuleShop +} + +//模块初始化接口 注册用户创建角色事件 +func (this *Shop) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { + err = this.ModuleBase.Init(service, module, options) + return +} + +//装备组件 +func (this *Shop) OnInstallComp() { + this.ModuleBase.OnInstallComp() + this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) + this.modelShop = this.RegisterComp(new(modelShopComp)).(*modelShopComp) + this.configure = this.RegisterComp(new(configureComp)).(*configureComp) +} diff --git a/modules/shop/module_test.go b/modules/shop/module_test.go new file mode 100644 index 000000000..9df2158fa --- /dev/null +++ b/modules/shop/module_test.go @@ -0,0 +1,75 @@ +package shop_test + +import ( + "fmt" + "go_dreamfactory/comm" + "go_dreamfactory/lego" + "go_dreamfactory/lego/base/rpcx" + "go_dreamfactory/lego/core" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/modules/shop" + "go_dreamfactory/services" + "go_dreamfactory/sys/cache" + "go_dreamfactory/sys/configure" + "go_dreamfactory/sys/db" + "os" + "testing" + "time" +) + +func newService(ops ...rpcx.Option) core.IService { + s := new(TestService) + s.Configure(ops...) + return s +} + +//梦工厂基础服务对象 +type TestService struct { + rpcx.RPCXService +} + +//初始化相关系统 +func (this *TestService) InitSys() { + this.RPCXService.InitSys() + if err := cache.OnInit(this.GetSettings().Sys["cache"]); err != nil { + panic(fmt.Sprintf("init sys.cache err: %s", err.Error())) + } else { + log.Infof("init sys.cache success!") + } + if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil { + panic(fmt.Sprintf("init sys.db err: %s", err.Error())) + } else { + log.Infof("init sys.db success!") + } + if err := configure.OnInit(this.GetSettings().Sys["configure"]); err != nil { + panic(fmt.Sprintf("init sys.configure err: %s", err.Error())) + } else { + log.Infof("init sys.configure success!") + } +} + +var service core.IService +var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp() +var module = new(shop.Shop) + +//测试环境下初始化db和cache 系统 +func TestMain(m *testing.M) { + service = newService( + rpcx.SetConfPath("../../bin/conf/worker_1.yaml"), + rpcx.SetVersion("1.0.0.0"), + ) + service.OnInstallComp( //装备组件 + s_gateComp, //此服务需要接受用户的消息 需要装备网关组件 + ) + go func() { + lego.Run(service, //运行模块 + module, + ) + }() + time.Sleep(time.Second * 3) + defer os.Exit(m.Run()) +} + +func Test_Module(t *testing.T) { + +} diff --git a/pb.bat b/pb.bat index c9dbbd78c..56565edb1 100644 --- a/pb.bat +++ b/pb.bat @@ -15,4 +15,5 @@ protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\items\*.pr protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\mail\*.proto protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\equipment\*.proto protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\hero\*.proto +protoc --proto_path=%SRC% --go_out=%TAR% --go_opt=paths=import %SRC%\shop\*.proto pause \ No newline at end of file diff --git a/pb/proto/shop/shop_db.proto b/pb/proto/shop/shop_db.proto new file mode 100644 index 000000000..0fcda975f --- /dev/null +++ b/pb/proto/shop/shop_db.proto @@ -0,0 +1,28 @@ +syntax = "proto3"; +option go_package = ".;pb"; + +enum ShopType { + Null = 0; + GoldShop = 1; + DiamondShop = 2; + PVPShop = 3; + PVEShop = 4; + AllianceShop = 5; +} + +message UserShopData { + int64 LastRefreshTime = 1; //最后一次刷新时间 + int32 ManualRefreshNum = 2; //手动刷新次数 + repeated int32 Items = 3; //商品列表 +} + +message DBShop { + string id = 1; //@go_tags(`bson:"_id"`) 装备id + string uid = 2; //@go_tags(`bson:"uid"`) 装备id + UserShopData GoldShop = 3; //金币商店数据 + UserShopData DiamondShop = 4; //金币商店数据 + UserShopData PVPShop = 5; //金币商店数据 + UserShopData PVEShop = 6; //金币商店数据 + UserShopData AllianceShop = 7; //金币商店数据 + +} \ No newline at end of file diff --git a/pb/proto/shop/shop_msg.proto b/pb/proto/shop/shop_msg.proto new file mode 100644 index 000000000..e0e312ce6 --- /dev/null +++ b/pb/proto/shop/shop_msg.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; +option go_package = ".;pb"; +import "shop/shop_db.proto"; + +//获取装备列表请求 +message ShopGetListReq { + ShopType sType = 1; //商城类型 + bool IsManualRefresh = 2; //是否手动刷新 +} + +//获取装备列表请求 +message ShopGetListResp { + +} + +//购买商品 请求 +message ShopBuyReq { + +} + +//购买商品 回应 +message ShopBuyResp { + +} diff --git a/pb/shop_db.pb.go b/pb/shop_db.pb.go new file mode 100644 index 000000000..bf255244b --- /dev/null +++ b/pb/shop_db.pb.go @@ -0,0 +1,359 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: shop/shop_db.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type ShopType int32 + +const ( + ShopType_Null ShopType = 0 + ShopType_GoldShop ShopType = 1 + ShopType_DiamondShop ShopType = 2 + ShopType_PVPShop ShopType = 3 + ShopType_PVEShop ShopType = 4 + ShopType_AllianceShop ShopType = 5 +) + +// Enum value maps for ShopType. +var ( + ShopType_name = map[int32]string{ + 0: "Null", + 1: "GoldShop", + 2: "DiamondShop", + 3: "PVPShop", + 4: "PVEShop", + 5: "AllianceShop", + } + ShopType_value = map[string]int32{ + "Null": 0, + "GoldShop": 1, + "DiamondShop": 2, + "PVPShop": 3, + "PVEShop": 4, + "AllianceShop": 5, + } +) + +func (x ShopType) Enum() *ShopType { + p := new(ShopType) + *p = x + return p +} + +func (x ShopType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ShopType) Descriptor() protoreflect.EnumDescriptor { + return file_shop_shop_db_proto_enumTypes[0].Descriptor() +} + +func (ShopType) Type() protoreflect.EnumType { + return &file_shop_shop_db_proto_enumTypes[0] +} + +func (x ShopType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ShopType.Descriptor instead. +func (ShopType) EnumDescriptor() ([]byte, []int) { + return file_shop_shop_db_proto_rawDescGZIP(), []int{0} +} + +type UserShopData struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + LastRefreshTime int64 `protobuf:"varint,1,opt,name=LastRefreshTime,proto3" json:"LastRefreshTime"` //最后一次刷新时间 + ManualRefreshNum int32 `protobuf:"varint,2,opt,name=ManualRefreshNum,proto3" json:"ManualRefreshNum"` //手动刷新次数 + Items []int32 `protobuf:"varint,3,rep,packed,name=Items,proto3" json:"Items"` //商品列表 +} + +func (x *UserShopData) Reset() { + *x = UserShopData{} + if protoimpl.UnsafeEnabled { + mi := &file_shop_shop_db_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UserShopData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UserShopData) ProtoMessage() {} + +func (x *UserShopData) ProtoReflect() protoreflect.Message { + mi := &file_shop_shop_db_proto_msgTypes[0] + 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 UserShopData.ProtoReflect.Descriptor instead. +func (*UserShopData) Descriptor() ([]byte, []int) { + return file_shop_shop_db_proto_rawDescGZIP(), []int{0} +} + +func (x *UserShopData) GetLastRefreshTime() int64 { + if x != nil { + return x.LastRefreshTime + } + return 0 +} + +func (x *UserShopData) GetManualRefreshNum() int32 { + if x != nil { + return x.ManualRefreshNum + } + return 0 +} + +func (x *UserShopData) GetItems() []int32 { + if x != nil { + return x.Items + } + return nil +} + +type DBShop struct { + state protoimpl.MessageState + 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 + GoldShop *UserShopData `protobuf:"bytes,3,opt,name=GoldShop,proto3" json:"GoldShop"` //金币商店数据 + DiamondShop *UserShopData `protobuf:"bytes,4,opt,name=DiamondShop,proto3" json:"DiamondShop"` //金币商店数据 + PVPShop *UserShopData `protobuf:"bytes,5,opt,name=PVPShop,proto3" json:"PVPShop"` //金币商店数据 + PVEShop *UserShopData `protobuf:"bytes,6,opt,name=PVEShop,proto3" json:"PVEShop"` //金币商店数据 + AllianceShop *UserShopData `protobuf:"bytes,7,opt,name=AllianceShop,proto3" json:"AllianceShop"` //金币商店数据 +} + +func (x *DBShop) Reset() { + *x = DBShop{} + if protoimpl.UnsafeEnabled { + mi := &file_shop_shop_db_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DBShop) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DBShop) ProtoMessage() {} + +func (x *DBShop) ProtoReflect() protoreflect.Message { + mi := &file_shop_shop_db_proto_msgTypes[1] + 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 DBShop.ProtoReflect.Descriptor instead. +func (*DBShop) Descriptor() ([]byte, []int) { + return file_shop_shop_db_proto_rawDescGZIP(), []int{1} +} + +func (x *DBShop) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *DBShop) GetUid() string { + if x != nil { + return x.Uid + } + return "" +} + +func (x *DBShop) GetGoldShop() *UserShopData { + if x != nil { + return x.GoldShop + } + return nil +} + +func (x *DBShop) GetDiamondShop() *UserShopData { + if x != nil { + return x.DiamondShop + } + return nil +} + +func (x *DBShop) GetPVPShop() *UserShopData { + if x != nil { + return x.PVPShop + } + return nil +} + +func (x *DBShop) GetPVEShop() *UserShopData { + if x != nil { + return x.PVEShop + } + return nil +} + +func (x *DBShop) GetAllianceShop() *UserShopData { + if x != nil { + return x.AllianceShop + } + return nil +} + +var File_shop_shop_db_proto protoreflect.FileDescriptor + +var file_shop_shop_db_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x73, 0x68, 0x6f, 0x70, 0x2f, 0x73, 0x68, 0x6f, 0x70, 0x5f, 0x64, 0x62, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7a, 0x0a, 0x0c, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, + 0x44, 0x61, 0x74, 0x61, 0x12, 0x28, 0x0a, 0x0f, 0x4c, 0x61, 0x73, 0x74, 0x52, 0x65, 0x66, 0x72, + 0x65, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x4c, + 0x61, 0x73, 0x74, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x2a, + 0x0a, 0x10, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, + 0x75, 0x6d, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x10, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, + 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x4e, 0x75, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x49, 0x74, + 0x65, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x05, 0x49, 0x74, 0x65, 0x6d, 0x73, + 0x22, 0x8b, 0x02, 0x0a, 0x06, 0x44, 0x42, 0x53, 0x68, 0x6f, 0x70, 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, 0x29, 0x0a, + 0x08, 0x47, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x08, + 0x47, 0x6f, 0x6c, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x2f, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x6d, + 0x6f, 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, + 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x0b, 0x44, 0x69, + 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x50, 0x56, 0x50, + 0x53, 0x68, 0x6f, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, + 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, 0x74, 0x61, 0x52, 0x07, 0x50, 0x56, 0x50, 0x53, 0x68, + 0x6f, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x50, 0x56, 0x45, 0x53, 0x68, 0x6f, 0x70, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x53, 0x68, 0x6f, 0x70, 0x44, 0x61, + 0x74, 0x61, 0x52, 0x07, 0x50, 0x56, 0x45, 0x53, 0x68, 0x6f, 0x70, 0x12, 0x31, 0x0a, 0x0c, 0x41, + 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, 0x41, 0x6c, 0x6c, 0x69, 0x61, 0x6e, 0x63, 0x65, 0x53, 0x68, 0x6f, 0x70, 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 ( + file_shop_shop_db_proto_rawDescOnce sync.Once + file_shop_shop_db_proto_rawDescData = file_shop_shop_db_proto_rawDesc +) + +func file_shop_shop_db_proto_rawDescGZIP() []byte { + file_shop_shop_db_proto_rawDescOnce.Do(func() { + file_shop_shop_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_shop_shop_db_proto_rawDescData) + }) + return file_shop_shop_db_proto_rawDescData +} + +var file_shop_shop_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_shop_shop_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_shop_shop_db_proto_goTypes = []interface{}{ + (ShopType)(0), // 0: ShopType + (*UserShopData)(nil), // 1: UserShopData + (*DBShop)(nil), // 2: DBShop +} +var file_shop_shop_db_proto_depIdxs = []int32{ + 1, // 0: DBShop.GoldShop:type_name -> UserShopData + 1, // 1: DBShop.DiamondShop:type_name -> UserShopData + 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 +} + +func init() { file_shop_shop_db_proto_init() } +func file_shop_shop_db_proto_init() { + if File_shop_shop_db_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_shop_shop_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UserShopData); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shop_shop_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DBShop); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_shop_shop_db_proto_rawDesc, + NumEnums: 1, + NumMessages: 2, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_shop_shop_db_proto_goTypes, + DependencyIndexes: file_shop_shop_db_proto_depIdxs, + EnumInfos: file_shop_shop_db_proto_enumTypes, + MessageInfos: file_shop_shop_db_proto_msgTypes, + }.Build() + File_shop_shop_db_proto = out.File + file_shop_shop_db_proto_rawDesc = nil + file_shop_shop_db_proto_goTypes = nil + file_shop_shop_db_proto_depIdxs = nil +} diff --git a/pb/shop_msg.pb.go b/pb/shop_msg.pb.go new file mode 100644 index 000000000..78b133e33 --- /dev/null +++ b/pb/shop_msg.pb.go @@ -0,0 +1,317 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.0 +// protoc v3.20.0 +// source: shop/shop_msg.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +//获取装备列表请求 +type ShopGetListReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SType ShopType `protobuf:"varint,1,opt,name=sType,proto3,enum=ShopType" json:"sType"` //商城类型 + IsManualRefresh bool `protobuf:"varint,2,opt,name=IsManualRefresh,proto3" json:"IsManualRefresh"` //是否手动刷新 +} + +func (x *ShopGetListReq) Reset() { + *x = ShopGetListReq{} + if protoimpl.UnsafeEnabled { + mi := &file_shop_shop_msg_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShopGetListReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShopGetListReq) ProtoMessage() {} + +func (x *ShopGetListReq) ProtoReflect() protoreflect.Message { + mi := &file_shop_shop_msg_proto_msgTypes[0] + 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 ShopGetListReq.ProtoReflect.Descriptor instead. +func (*ShopGetListReq) Descriptor() ([]byte, []int) { + return file_shop_shop_msg_proto_rawDescGZIP(), []int{0} +} + +func (x *ShopGetListReq) GetSType() ShopType { + if x != nil { + return x.SType + } + return ShopType_Null +} + +func (x *ShopGetListReq) GetIsManualRefresh() bool { + if x != nil { + return x.IsManualRefresh + } + return false +} + +//获取装备列表请求 +type ShopGetListResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ShopGetListResp) Reset() { + *x = ShopGetListResp{} + if protoimpl.UnsafeEnabled { + mi := &file_shop_shop_msg_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShopGetListResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShopGetListResp) ProtoMessage() {} + +func (x *ShopGetListResp) ProtoReflect() protoreflect.Message { + mi := &file_shop_shop_msg_proto_msgTypes[1] + 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 ShopGetListResp.ProtoReflect.Descriptor instead. +func (*ShopGetListResp) Descriptor() ([]byte, []int) { + return file_shop_shop_msg_proto_rawDescGZIP(), []int{1} +} + +//购买商品 请求 +type ShopBuyReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ShopBuyReq) Reset() { + *x = ShopBuyReq{} + if protoimpl.UnsafeEnabled { + mi := &file_shop_shop_msg_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShopBuyReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShopBuyReq) ProtoMessage() {} + +func (x *ShopBuyReq) ProtoReflect() protoreflect.Message { + mi := &file_shop_shop_msg_proto_msgTypes[2] + 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 ShopBuyReq.ProtoReflect.Descriptor instead. +func (*ShopBuyReq) Descriptor() ([]byte, []int) { + return file_shop_shop_msg_proto_rawDescGZIP(), []int{2} +} + +//购买商品 回应 +type ShopBuyResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ShopBuyResp) Reset() { + *x = ShopBuyResp{} + if protoimpl.UnsafeEnabled { + mi := &file_shop_shop_msg_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ShopBuyResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ShopBuyResp) ProtoMessage() {} + +func (x *ShopBuyResp) ProtoReflect() protoreflect.Message { + mi := &file_shop_shop_msg_proto_msgTypes[3] + 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 ShopBuyResp.ProtoReflect.Descriptor instead. +func (*ShopBuyResp) Descriptor() ([]byte, []int) { + return file_shop_shop_msg_proto_rawDescGZIP(), []int{3} +} + +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, 0x5b, 0x0a, 0x0e, 0x53, 0x68, 0x6f, + 0x70, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1f, 0x0a, 0x05, 0x73, + 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x09, 0x2e, 0x53, 0x68, 0x6f, + 0x70, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x28, 0x0a, 0x0f, + 0x49, 0x73, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x49, 0x73, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x52, + 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x22, 0x11, 0x0a, 0x0f, 0x53, 0x68, 0x6f, 0x70, 0x47, 0x65, + 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x0c, 0x0a, 0x0a, 0x53, 0x68, 0x6f, + 0x70, 0x42, 0x75, 0x79, 0x52, 0x65, 0x71, 0x22, 0x0d, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x70, 0x42, + 0x75, 0x79, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_shop_shop_msg_proto_rawDescOnce sync.Once + file_shop_shop_msg_proto_rawDescData = file_shop_shop_msg_proto_rawDesc +) + +func file_shop_shop_msg_proto_rawDescGZIP() []byte { + file_shop_shop_msg_proto_rawDescOnce.Do(func() { + file_shop_shop_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_shop_shop_msg_proto_rawDescData) + }) + return file_shop_shop_msg_proto_rawDescData +} + +var file_shop_shop_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_shop_shop_msg_proto_goTypes = []interface{}{ + (*ShopGetListReq)(nil), // 0: ShopGetListReq + (*ShopGetListResp)(nil), // 1: ShopGetListResp + (*ShopBuyReq)(nil), // 2: ShopBuyReq + (*ShopBuyResp)(nil), // 3: ShopBuyResp + (ShopType)(0), // 4: ShopType +} +var file_shop_shop_msg_proto_depIdxs = []int32{ + 4, // 0: ShopGetListReq.sType:type_name -> ShopType + 1, // [1:1] is the sub-list for method output_type + 1, // [1:1] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name +} + +func init() { file_shop_shop_msg_proto_init() } +func file_shop_shop_msg_proto_init() { + if File_shop_shop_msg_proto != nil { + return + } + file_shop_shop_db_proto_init() + if !protoimpl.UnsafeEnabled { + file_shop_shop_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShopGetListReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shop_shop_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShopGetListResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shop_shop_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShopBuyReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_shop_shop_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ShopBuyResp); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_shop_shop_msg_proto_rawDesc, + NumEnums: 0, + NumMessages: 4, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_shop_shop_msg_proto_goTypes, + DependencyIndexes: file_shop_shop_msg_proto_depIdxs, + MessageInfos: file_shop_shop_msg_proto_msgTypes, + }.Build() + File_shop_shop_msg_proto = out.File + file_shop_shop_msg_proto_rawDesc = nil + file_shop_shop_msg_proto_goTypes = nil + file_shop_shop_msg_proto_depIdxs = nil +} diff --git a/sys/configure/structs/game.shop.go b/sys/configure/structs/game.shop.go new file mode 100644 index 000000000..56e75f4cf --- /dev/null +++ b/sys/configure/structs/game.shop.go @@ -0,0 +1,42 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +type Game_shop struct { + _dataMap map[int32]*Game_shopData + _dataList []*Game_shopData +} + +func NewGame_shop(_buf []map[string]interface{}) (*Game_shop, error) { + _dataList := make([]*Game_shopData, 0, len(_buf)) + dataMap := make(map[int32]*Game_shopData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_shopData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Shopid] = _v + } + } + return &Game_shop{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_shop) GetDataMap() map[int32]*Game_shopData { + return table._dataMap +} + +func (table *Game_shop) GetDataList() []*Game_shopData { + return table._dataList +} + +func (table *Game_shop) Get(key int32) *Game_shopData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.shopData.go b/sys/configure/structs/game.shopData.go new file mode 100644 index 000000000..151a0dd43 --- /dev/null +++ b/sys/configure/structs/game.shopData.go @@ -0,0 +1,80 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +import "errors" + +type Game_shopData struct { + Shopid int32 + Tab int32 + Shopname string + Needshow []*Game_atn + Rtype int32 + Rtime int32 + Rnum int32 + Rneed []*Game_atn + Shopitem []int32 +} + +func (Game_shopData) GetTypeId() int { + return 923847228 +} + +func NewGame_shopData(_buf map[string]interface{}) (_v *Game_shopData, err error) { + _v = &Game_shopData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["shopid"].(float64); !_ok_ { err = errors.New("shopid error"); return }; _v.Shopid = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tab"].(float64); !_ok_ { err = errors.New("tab error"); return }; _v.Tab = int32(_tempNum_) } + { var _ok_ bool; if _v.Shopname, _ok_ = _buf["shopname"].(string); !_ok_ { err = errors.New("shopname error"); return } } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["needshow"].([]interface{}); !_ok_ { err = errors.New("needshow error"); return } + + _v.Needshow = make([]*Game_atn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Game_atn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = NewGame_atn(_x_); err != nil { return } } + _v.Needshow = append(_v.Needshow, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rtype"].(float64); !_ok_ { err = errors.New("rtype error"); return }; _v.Rtype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rtime"].(float64); !_ok_ { err = errors.New("rtime error"); return }; _v.Rtime = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rnum"].(float64); !_ok_ { err = errors.New("rnum error"); return }; _v.Rnum = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["rneed"].([]interface{}); !_ok_ { err = errors.New("rneed error"); return } + + _v.Rneed = make([]*Game_atn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Game_atn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = NewGame_atn(_x_); err != nil { return } } + _v.Rneed = append(_v.Rneed, _list_v_) + } + } + + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["shopitem"].([]interface{}); !_ok_ { err = errors.New("shopitem error"); return } + + _v.Shopitem = make([]int32, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ int32 + { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } + _v.Shopitem = append(_v.Shopitem, _list_v_) + } + } + + return +} diff --git a/sys/configure/structs/game.shopitem.go b/sys/configure/structs/game.shopitem.go new file mode 100644 index 000000000..54c4f7c32 --- /dev/null +++ b/sys/configure/structs/game.shopitem.go @@ -0,0 +1,42 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +type Game_shopitem struct { + _dataMap map[int32]*Game_shopitemData + _dataList []*Game_shopitemData +} + +func NewGame_shopitem(_buf []map[string]interface{}) (*Game_shopitem, error) { + _dataList := make([]*Game_shopitemData, 0, len(_buf)) + dataMap := make(map[int32]*Game_shopitemData) + for _, _ele_ := range _buf { + if _v, err2 := NewGame_shopitemData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Key] = _v + } + } + return &Game_shopitem{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *Game_shopitem) GetDataMap() map[int32]*Game_shopitemData { + return table._dataMap +} + +func (table *Game_shopitem) GetDataList() []*Game_shopitemData { + return table._dataList +} + +func (table *Game_shopitem) Get(key int32) *Game_shopitemData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/game.shopitemData.go b/sys/configure/structs/game.shopitemData.go new file mode 100644 index 000000000..80df79843 --- /dev/null +++ b/sys/configure/structs/game.shopitemData.go @@ -0,0 +1,90 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +package cfg + +import "errors" + +type Game_shopitemData struct { + Key int32 + Id int32 + Iteminfo []*Game_atn + Probability int32 + Need []*Game_atn + Sale float32 + Salelist []int32 + Buyminnum int32 + Buymaxnum int32 + Vip int32 + Lvmin int32 + Lvmax int32 + Mapidmin int32 + Mapidmax int32 +} + +func (Game_shopitemData) GetTypeId() int { + return 683408079 +} + +func NewGame_shopitemData(_buf map[string]interface{}) (_v *Game_shopitemData, err error) { + _v = &Game_shopitemData{} + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["iteminfo"].([]interface{}); !_ok_ { err = errors.New("iteminfo error"); return } + + _v.Iteminfo = make([]*Game_atn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Game_atn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = NewGame_atn(_x_); err != nil { return } } + _v.Iteminfo = append(_v.Iteminfo, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["probability"].(float64); !_ok_ { err = errors.New("probability error"); return }; _v.Probability = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["need"].([]interface{}); !_ok_ { err = errors.New("need error"); return } + + _v.Need = make([]*Game_atn, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Game_atn + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = NewGame_atn(_x_); err != nil { return } } + _v.Need = append(_v.Need, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["sale"].(float64); !_ok_ { err = errors.New("sale error"); return }; _v.Sale = float32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["salelist"].([]interface{}); !_ok_ { err = errors.New("salelist error"); return } + + _v.Salelist = make([]int32, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ int32 + { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } + _v.Salelist = append(_v.Salelist, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buyminnum"].(float64); !_ok_ { err = errors.New("buyminnum error"); return }; _v.Buyminnum = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buymaxnum"].(float64); !_ok_ { err = errors.New("buymaxnum error"); return }; _v.Buymaxnum = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["vip"].(float64); !_ok_ { err = errors.New("vip error"); return }; _v.Vip = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lvmin"].(float64); !_ok_ { err = errors.New("lvmin error"); return }; _v.Lvmin = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lvmax"].(float64); !_ok_ { err = errors.New("lvmax error"); return }; _v.Lvmax = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["mapidmin"].(float64); !_ok_ { err = errors.New("mapidmin error"); return }; _v.Mapidmin = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["mapidmax"].(float64); !_ok_ { err = errors.New("mapidmax error"); return }; _v.Mapidmax = int32(_tempNum_) } + return +}