月卡
This commit is contained in:
parent
1299dd30d3
commit
e17afe00ec
44
bin/json/game_privilege.json
Normal file
44
bin/json/game_privilege.json
Normal file
@ -0,0 +1,44 @@
|
||||
[
|
||||
{
|
||||
"privilege_id": 10001,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10001",
|
||||
"text": "特权描述1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10002,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10002",
|
||||
"text": "特权描述2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10003,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10003",
|
||||
"text": "特权描述3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10004,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10004",
|
||||
"text": "特权描述4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10005,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10005",
|
||||
"text": "特权描述5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10006,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10006",
|
||||
"text": "特权描述6"
|
||||
}
|
||||
}
|
||||
]
|
50
bin/json/game_privilegecard.json
Normal file
50
bin/json/game_privilegecard.json
Normal file
@ -0,0 +1,50 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "经典月卡",
|
||||
"proid": "yueka_lv1",
|
||||
"assert_day": 30,
|
||||
"renew_day": 3,
|
||||
"day_reward": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 60
|
||||
}
|
||||
],
|
||||
"disposable_reward": {
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 300
|
||||
},
|
||||
"privilege_id": [
|
||||
10001,
|
||||
10002,
|
||||
10003
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "典藏月卡",
|
||||
"proid": "yueka_lv2",
|
||||
"assert_day": 30,
|
||||
"renew_day": 3,
|
||||
"day_reward": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 90
|
||||
}
|
||||
],
|
||||
"disposable_reward": {
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 980
|
||||
},
|
||||
"privilege_id": [
|
||||
10004,
|
||||
10005,
|
||||
10006
|
||||
]
|
||||
}
|
||||
]
|
26
modules/privilege/api.go
Normal file
26
modules/privilege/api.go
Normal file
@ -0,0 +1,26 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/modules"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
)
|
||||
|
||||
type apiComp struct {
|
||||
modules.MCompGate
|
||||
service core.IService
|
||||
module *Privilege
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
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.(*Privilege)
|
||||
this.service = service
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Start() (err error) {
|
||||
err = this.MCompGate.Start()
|
||||
return
|
||||
}
|
20
modules/privilege/api_getlist.go
Normal file
20
modules/privilege/api_getlist.go
Normal file
@ -0,0 +1,20 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"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) {
|
||||
|
||||
return
|
||||
}
|
116
modules/privilege/configure.go
Normal file
116
modules/privilege/configure.go
Normal file
@ -0,0 +1,116 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
const (
|
||||
game_shop = "game_shop.json"
|
||||
game_shopitem = "game_shopitem.json"
|
||||
)
|
||||
|
||||
///背包配置管理组件
|
||||
type configureComp struct {
|
||||
modules.MCompConfigure
|
||||
module *Privilege
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompConfigure.Init(service, module, comp, options)
|
||||
this.module = module.(*Privilege)
|
||||
this.LoadConfigure(game_shop, cfg.NewGameShop)
|
||||
this.LoadConfigure(game_shopitem, cfg.NewGameShopitem)
|
||||
return
|
||||
}
|
||||
|
||||
//获取装备配置数据
|
||||
func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shop); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
if configure, ok = v.(*cfg.GameShop).GetDataMap()[id]; !ok {
|
||||
err = fmt.Errorf("ShopConfigure not found:%d ", id)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取商品
|
||||
func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameShopitemData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopitem); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
if result, ok = v.(*cfg.GameShopitem).GetDataMap()[key]; !ok {
|
||||
err = fmt.Errorf("ShopConfigure not found:%d ", key)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取商品组
|
||||
func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb.DBUser) (result []*cfg.GameShopitemData, err error) {
|
||||
result = make([]*cfg.GameShopitemData, 0, 10)
|
||||
var (
|
||||
v interface{}
|
||||
table *cfg.GameShopitem
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopitem); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
table = v.(*cfg.GameShopitem)
|
||||
for _, v := range table.GetDataMap() {
|
||||
if v.Id == groupid &&
|
||||
user.Lv >= v.Lvmin &&
|
||||
user.Lv <= v.Lvmax &&
|
||||
user.Vip >= v.Vip {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取商品
|
||||
func (this *configureComp) GetShopItemsConfigureByIds(keys ...int32) (result []*cfg.GameShopitemData, err error) {
|
||||
result = make([]*cfg.GameShopitemData, 0, len(keys))
|
||||
var (
|
||||
v interface{}
|
||||
table *cfg.GameShopitem
|
||||
item *cfg.GameShopitemData
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopitem); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
table = v.(*cfg.GameShopitem)
|
||||
for _, v := range keys {
|
||||
if item, ok = table.GetDataMap()[v]; ok {
|
||||
result = append(result, item)
|
||||
} else {
|
||||
this.module.Errorf("no found GetShopItemsConfigureByIds:%d", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
28
modules/privilege/model_privilege.go
Normal file
28
modules/privilege/model_privilege.go
Normal file
@ -0,0 +1,28 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
///论坛 数据组件
|
||||
type modelShopComp struct {
|
||||
modules.MCompModel
|
||||
module *Privilege
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
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.(*Privilege)
|
||||
this.TableName = comm.TableShop
|
||||
//创建uid索引
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
44
modules/privilege/module.go
Normal file
44
modules/privilege/module.go
Normal file
@ -0,0 +1,44 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/sys/db"
|
||||
)
|
||||
|
||||
func NewModule() core.IModule {
|
||||
m := new(Privilege)
|
||||
return m
|
||||
}
|
||||
|
||||
type Privilege struct {
|
||||
modules.ModuleBase
|
||||
api_comp *apiComp
|
||||
configure *configureComp
|
||||
modelShop *modelShopComp
|
||||
}
|
||||
|
||||
//模块名
|
||||
func (this *Privilege) GetType() core.M_Modules {
|
||||
return comm.ModuleShop
|
||||
}
|
||||
|
||||
//模块初始化接口 注册用户创建角色事件
|
||||
func (this *Privilege) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
return
|
||||
}
|
||||
|
||||
//装备组件
|
||||
func (this *Privilege) 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)
|
||||
}
|
||||
|
||||
//Event------------------------------------------------------------------------------------------------------------
|
||||
func (this *Privilege) EventUserOffline(session comm.IUserSession) {
|
||||
this.modelShop.DelByUId(session.GetUserId(), db.SetDBMgoLog(false))
|
||||
}
|
93
modules/privilege/module_test.go
Normal file
93
modules/privilege/module_test.go
Normal file
@ -0,0 +1,93 @@
|
||||
package privilege_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego"
|
||||
"go_dreamfactory/lego/base/rpcx"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules/equipment"
|
||||
"go_dreamfactory/modules/hero"
|
||||
"go_dreamfactory/modules/items"
|
||||
"go_dreamfactory/modules/shop"
|
||||
"go_dreamfactory/modules/user"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/services"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/sys/db"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
)
|
||||
|
||||
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 := 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"], configure.SetConfigPath("F:/work/go/go_dreamfactory/bin/json")); 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,
|
||||
hero.NewModule(),
|
||||
user.NewModule(),
|
||||
items.NewModule(),
|
||||
equipment.NewModule(),
|
||||
)
|
||||
}()
|
||||
time.Sleep(time.Second * 3)
|
||||
defer os.Exit(m.Run())
|
||||
}
|
||||
|
||||
//测试api_getlist
|
||||
func Test_Module_APIGetList(t *testing.T) {
|
||||
data, _ := ptypes.MarshalAny(&pb.ShopGetListReq{SType: pb.ShopType_GoldShop, IsManualRefresh: false})
|
||||
reply := &pb.RPCMessageReply{}
|
||||
s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "shop", SubType: "getlist", Message: data}, reply)
|
||||
log.Debugf("reply:%v", reply)
|
||||
}
|
||||
|
||||
//测试api_buy
|
||||
func Test_Module_APIBuy(t *testing.T) {
|
||||
data, _ := ptypes.MarshalAny(&pb.ShopBuyReq{GoodsId: 7})
|
||||
reply := &pb.RPCMessageReply{}
|
||||
s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "shop", SubType: "buy", Message: data}, reply)
|
||||
log.Debugf("reply:%v", reply)
|
||||
}
|
42
sys/configure/structs/Game.Privilege.go
Normal file
42
sys/configure/structs/Game.Privilege.go
Normal file
@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
type GamePrivilege struct {
|
||||
_dataMap map[int32]*GamePrivilegeData
|
||||
_dataList []*GamePrivilegeData
|
||||
}
|
||||
|
||||
func NewGamePrivilege(_buf []map[string]interface{}) (*GamePrivilege, error) {
|
||||
_dataList := make([]*GamePrivilegeData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamePrivilegeData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamePrivilegeData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.PrivilegeId] = _v
|
||||
}
|
||||
}
|
||||
return &GamePrivilege{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamePrivilege) GetDataMap() map[int32]*GamePrivilegeData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GamePrivilege) GetDataList() []*GamePrivilegeData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamePrivilege) Get(key int32) *GamePrivilegeData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
42
sys/configure/structs/Game.PrivilegeCard.go
Normal file
42
sys/configure/structs/Game.PrivilegeCard.go
Normal file
@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
type GamePrivilegeCard struct {
|
||||
_dataMap map[int32]*GamePrivilegeCardData
|
||||
_dataList []*GamePrivilegeCardData
|
||||
}
|
||||
|
||||
func NewGamePrivilegeCard(_buf []map[string]interface{}) (*GamePrivilegeCard, error) {
|
||||
_dataList := make([]*GamePrivilegeCardData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamePrivilegeCardData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamePrivilegeCardData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Id] = _v
|
||||
}
|
||||
}
|
||||
return &GamePrivilegeCard{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) GetDataMap() map[int32]*GamePrivilegeCardData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) GetDataList() []*GamePrivilegeCardData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) Get(key int32) *GamePrivilegeCardData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
75
sys/configure/structs/Game.PrivilegeCardData.go
Normal file
75
sys/configure/structs/Game.PrivilegeCardData.go
Normal file
@ -0,0 +1,75 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type GamePrivilegeCardData struct {
|
||||
Id int32
|
||||
Name string
|
||||
Proid string
|
||||
AssertDay int32
|
||||
RenewDay int32
|
||||
DayReward []*Gameatn
|
||||
DisposableReward *Gameatn
|
||||
PrivilegeId []int32
|
||||
}
|
||||
|
||||
const TypeId_GamePrivilegeCardData = 1735553455
|
||||
|
||||
func (*GamePrivilegeCardData) GetTypeId() int32 {
|
||||
return 1735553455
|
||||
}
|
||||
|
||||
func (_v *GamePrivilegeCardData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
|
||||
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
|
||||
{ var _ok_ bool; if _v.Proid, _ok_ = _buf["proid"].(string); !_ok_ { err = errors.New("proid error"); return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["assert_day"].(float64); !_ok_ { err = errors.New("assert_day error"); return }; _v.AssertDay = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["renew_day"].(float64); !_ok_ { err = errors.New("renew_day error"); return }; _v.RenewDay = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["day_reward"].([]interface{}); !_ok_ { err = errors.New("day_reward error"); return }
|
||||
|
||||
_v.DayReward = make([]*Gameatn, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ *Gameatn
|
||||
{ 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 = DeserializeGameatn(_x_); err != nil { return } }
|
||||
_v.DayReward = append(_v.DayReward, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["disposable_reward"].(map[string]interface{}); !_ok_ { err = errors.New("disposable_reward error"); return }; if _v.DisposableReward, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["privilege_id"].([]interface{}); !_ok_ { err = errors.New("privilege_id error"); return }
|
||||
|
||||
_v.PrivilegeId = 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.PrivilegeId = append(_v.PrivilegeId, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGamePrivilegeCardData(_buf map[string]interface{}) (*GamePrivilegeCardData, error) {
|
||||
v := &GamePrivilegeCardData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
37
sys/configure/structs/Game.PrivilegeData.go
Normal file
37
sys/configure/structs/Game.PrivilegeData.go
Normal file
@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type GamePrivilegeData struct {
|
||||
PrivilegeId int32
|
||||
PrivilegeDescribe string
|
||||
}
|
||||
|
||||
const TypeId_GamePrivilegeData = 40320255
|
||||
|
||||
func (*GamePrivilegeData) GetTypeId() int32 {
|
||||
return 40320255
|
||||
}
|
||||
|
||||
func (_v *GamePrivilegeData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["privilege_id"].(float64); !_ok_ { err = errors.New("privilege_id error"); return }; _v.PrivilegeId = int32(_tempNum_) }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["privilege_describe"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.PrivilegeDescribe error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.PrivilegeDescribe, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGamePrivilegeData(_buf map[string]interface{}) (*GamePrivilegeData, error) {
|
||||
v := &GamePrivilegeData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
@ -120,6 +120,8 @@ type Tables struct {
|
||||
TrollTrain *GameTrollTrain
|
||||
TrollLv *GameTrollLv
|
||||
TrollCoefficient *GameTrollCoefficient
|
||||
PrivilegeCard *GamePrivilegeCard
|
||||
Privilege *GamePrivilege
|
||||
}
|
||||
|
||||
func NewTables(loader JsonLoader) (*Tables, error) {
|
||||
@ -781,5 +783,17 @@ func NewTables(loader JsonLoader) (*Tables, error) {
|
||||
if tables.TrollCoefficient, err = NewGameTrollCoefficient(buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_privilegecard"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.PrivilegeCard, err = NewGamePrivilegeCard(buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_privilege"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.Privilege, err = NewGamePrivilege(buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return tables, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user