diff --git a/lego/sys/redis/cluster/core.go b/lego/sys/redis/cluster/core.go index 110a17ae6..6f2dd2b8a 100644 --- a/lego/sys/redis/cluster/core.go +++ b/lego/sys/redis/cluster/core.go @@ -8,7 +8,7 @@ import ( "github.com/go-redis/redis/v8" ) -func NewSys(RedisUrl []string, RedisPassword string, poolSize int, timeOut time.Duration, +func NewSys(RedisUrl []string, RedisPassword string, poolSize, minConns int, timeOut time.Duration, codec core.ICodec, ) (sys *Redis, err error) { var ( @@ -18,6 +18,7 @@ func NewSys(RedisUrl []string, RedisPassword string, poolSize int, timeOut time. Addrs: RedisUrl, Password: RedisPassword, PoolSize: poolSize, + MinIdleConns: minConns, DialTimeout: timeOut, ReadTimeout: timeOut, WriteTimeout: timeOut, diff --git a/lego/sys/redis/options.go b/lego/sys/redis/options.go index a02917982..008b31577 100644 --- a/lego/sys/redis/options.go +++ b/lego/sys/redis/options.go @@ -23,6 +23,7 @@ type Options struct { Redis_Cluster_Addr []string Redis_Cluster_Password string PoolSize int + MinConns int TimeOut time.Duration Codec core.ICodec } @@ -82,7 +83,8 @@ func newOptions(config map[string]interface{}, opts ...Option) Options { Redis_Single_DB: 1, Redis_Cluster_Addr: []string{"127.0.0.1:6379"}, Redis_Cluster_Password: "", - PoolSize: 200, + PoolSize: 64, + MinConns: 32, TimeOut: time.Second * 3, } if config != nil { @@ -101,7 +103,8 @@ func newOptionsByOption(opts ...Option) Options { Redis_Single_DB: 1, Redis_Cluster_Addr: []string{"127.0.0.1:6379"}, Redis_Cluster_Password: "", - PoolSize: 200, + PoolSize: 64, + MinConns: 32, TimeOut: time.Second * 3, } for _, o := range opts { diff --git a/lego/sys/redis/redis.go b/lego/sys/redis/redis.go index f09b074c1..cebfa56f2 100644 --- a/lego/sys/redis/redis.go +++ b/lego/sys/redis/redis.go @@ -31,6 +31,7 @@ func (this *Redis) init() (err error) { this.options.Redis_Single_Password, this.options.Redis_Single_DB, this.options.PoolSize, + this.options.MinConns, this.options.TimeOut, this, ) @@ -39,6 +40,7 @@ func (this *Redis) init() (err error) { this.options.Redis_Cluster_Addr, this.options.Redis_Cluster_Password, this.options.PoolSize, + this.options.MinConns, this.options.TimeOut, this, ) diff --git a/lego/sys/redis/single/core.go b/lego/sys/redis/single/core.go index d90bf22fd..53a70ffe6 100644 --- a/lego/sys/redis/single/core.go +++ b/lego/sys/redis/single/core.go @@ -8,7 +8,7 @@ import ( "github.com/go-redis/redis/v8" ) -func NewSys(RedisUrl, RedisPassword string, RedisDB int, poolSize int, timeOut time.Duration, +func NewSys(RedisUrl, RedisPassword string, RedisDB int, poolSize, minConns int, timeOut time.Duration, codec core.ICodec, ) (sys *Redis, err error) { var ( @@ -19,6 +19,7 @@ func NewSys(RedisUrl, RedisPassword string, RedisDB int, poolSize int, timeOut t Password: RedisPassword, DB: RedisDB, PoolSize: poolSize, + MinIdleConns: minConns, DialTimeout: timeOut, WriteTimeout: timeOut, ReadTimeout: timeOut, diff --git a/modules/dragon/configure_comp.go b/modules/dragon/configure_comp.go index c3ceed694..e6b5dd6f9 100644 --- a/modules/dragon/configure_comp.go +++ b/modules/dragon/configure_comp.go @@ -68,7 +68,7 @@ func (this *configureComp) LoadDragonPlay() { this.play = make(map[string]*cfg.GameDragonPlayData) if _configure, ok := v.(*cfg.GameDragonPlay); ok { for _, v := range _configure.GetDataList() { - this.play[v.Id+"-"+strconv.Itoa(int(v.Grow))+"-"+strconv.Itoa(int(v.Type))] = v + this.play[v.Id+"-"+strconv.Itoa(int(v.Type))+"-"+strconv.Itoa(int(v.Interact))] = v } return } diff --git a/sys/configure/structs/Game.GameId.go b/sys/configure/structs/Game.GameId.go new file mode 100644 index 000000000..1e4acdb5f --- /dev/null +++ b/sys/configure/structs/Game.GameId.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 GameGameId struct { + _dataMap map[int32]*GameGameIdData + _dataList []*GameGameIdData +} + +func NewGameGameId(_buf []map[string]interface{}) (*GameGameId, error) { + _dataList := make([]*GameGameIdData, 0, len(_buf)) + dataMap := make(map[int32]*GameGameIdData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameGameIdData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &GameGameId{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameGameId) GetDataMap() map[int32]*GameGameIdData { + return table._dataMap +} + +func (table *GameGameId) GetDataList() []*GameGameIdData { + return table._dataList +} + +func (table *GameGameId) Get(key int32) *GameGameIdData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.GameIdData.go b/sys/configure/structs/Game.GameIdData.go new file mode 100644 index 000000000..84f26e7d6 --- /dev/null +++ b/sys/configure/structs/Game.GameIdData.go @@ -0,0 +1,37 @@ +//------------------------------------------------------------------------------ +// +// 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 GameGameIdData struct { + Id int32 + Type int32 +} + +const TypeId_GameGameIdData = 1662075251 + +func (*GameGameIdData) GetTypeId() int32 { + return 1662075251 +} + +func (_v *GameGameIdData)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; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } + return +} + +func DeserializeGameGameIdData(_buf map[string]interface{}) (*GameGameIdData, error) { + v := &GameGameIdData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.GameKlotski.go b/sys/configure/structs/Game.GameKlotski.go new file mode 100644 index 000000000..daf8f4ea4 --- /dev/null +++ b/sys/configure/structs/Game.GameKlotski.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 GameGameKlotski struct { + _dataMap map[int32]*GameGameKlotskiData + _dataList []*GameGameKlotskiData +} + +func NewGameGameKlotski(_buf []map[string]interface{}) (*GameGameKlotski, error) { + _dataList := make([]*GameGameKlotskiData, 0, len(_buf)) + dataMap := make(map[int32]*GameGameKlotskiData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameGameKlotskiData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &GameGameKlotski{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameGameKlotski) GetDataMap() map[int32]*GameGameKlotskiData { + return table._dataMap +} + +func (table *GameGameKlotski) GetDataList() []*GameGameKlotskiData { + return table._dataList +} + +func (table *GameGameKlotski) Get(key int32) *GameGameKlotskiData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.GameKlotskiData.go b/sys/configure/structs/Game.GameKlotskiData.go new file mode 100644 index 000000000..7fdd03b1f --- /dev/null +++ b/sys/configure/structs/Game.GameKlotskiData.go @@ -0,0 +1,56 @@ +//------------------------------------------------------------------------------ +// +// 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 GameGameKlotskiData struct { + Id int32 + Chequer *Gamekv + Start int32 + Blockstype []*Gamekv + Finish int32 +} + +const TypeId_GameGameKlotskiData = -634857145 + +func (*GameGameKlotskiData) GetTypeId() int32 { + return -634857145 +} + +func (_v *GameGameKlotskiData)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; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["chequer"].(map[string]interface{}); !_ok_ { err = errors.New("chequer error"); return }; if _v.Chequer, err = DeserializeGamekv(_x_); err != nil { return } } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["start"].(float64); !_ok_ { err = errors.New("start error"); return }; _v.Start = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["blockstype"].([]interface{}); !_ok_ { err = errors.New("blockstype error"); return } + + _v.Blockstype = make([]*Gamekv, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ *Gamekv + { 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 = DeserializeGamekv(_x_); err != nil { return } } + _v.Blockstype = append(_v.Blockstype, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["finish"].(float64); !_ok_ { err = errors.New("finish error"); return }; _v.Finish = int32(_tempNum_) } + return +} + +func DeserializeGameGameKlotskiData(_buf map[string]interface{}) (*GameGameKlotskiData, error) { + v := &GameGameKlotskiData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.MainStageData.go b/sys/configure/structs/Game.MainStageData.go index 6a7b909dd..749aa5261 100644 --- a/sys/configure/structs/Game.MainStageData.go +++ b/sys/configure/structs/Game.MainStageData.go @@ -17,6 +17,7 @@ type GameMainStageData struct { PreviousGroupId []int32 Previoustage int32 Episodetype int32 + StageParam int32 Venturemodelspeed float32 Venturemodelscale float32 MoveType int32 @@ -85,6 +86,7 @@ func (_v *GameMainStageData)Deserialize(_buf map[string]interface{}) (err error) { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["previoustage"].(float64); !_ok_ { err = errors.New("previoustage error"); return }; _v.Previoustage = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Episodetype"].(float64); !_ok_ { err = errors.New("Episodetype error"); return }; _v.Episodetype = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["stage_param"].(float64); !_ok_ { err = errors.New("stage_param error"); return }; _v.StageParam = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["venturemodelspeed"].(float64); !_ok_ { err = errors.New("venturemodelspeed error"); return }; _v.Venturemodelspeed = float32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["venturemodelscale"].(float64); !_ok_ { err = errors.New("venturemodelscale error"); return }; _v.Venturemodelscale = float32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["move_type"].(float64); !_ok_ { err = errors.New("move_type error"); return }; _v.MoveType = int32(_tempNum_) } diff --git a/sys/configure/structs/Tables.go b/sys/configure/structs/Tables.go index f273eb76a..1060ed3a9 100644 --- a/sys/configure/structs/Tables.go +++ b/sys/configure/structs/Tables.go @@ -258,6 +258,8 @@ type Tables struct { Qualifying *GameQualifying DragonPlay *GameDragonPlay DragonPlot *GameDragonPlot + GameId *GameGameId + GameKlotski *GameGameKlotski } func NewTables(loader JsonLoader) (*Tables, error) { @@ -1747,5 +1749,17 @@ func NewTables(loader JsonLoader) (*Tables, error) { if tables.DragonPlot, err = NewGameDragonPlot(buf) ; err != nil { return nil, err } + if buf, err = loader("game_gameid") ; err != nil { + return nil, err + } + if tables.GameId, err = NewGameGameId(buf) ; err != nil { + return nil, err + } + if buf, err = loader("game_gameklotski") ; err != nil { + return nil, err + } + if tables.GameKlotski, err = NewGameGameKlotski(buf) ; err != nil { + return nil, err + } return tables, nil }