diff --git a/bin/json/game_dispatch_all.json b/bin/json/game_dispatch_all.json deleted file mode 100644 index 9ada55054..000000000 --- a/bin/json/game_dispatch_all.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "id": 101, - "quantity": 1 - }, - { - "id": 102, - "quantity": 12 - }, - { - "id": 103, - "quantity": 1000 - }, - { - "id": 104, - "quantity": 6 - }, - { - "id": 105, - "quantity": 6 - }, - { - "id": 106, - "quantity": 10012 - }, - { - "id": 107, - "quantity": 20 - }, - { - "id": 108, - "quantity": 2 - } -] \ No newline at end of file diff --git a/bin/json/game_dispatch_reward.json b/bin/json/game_dispatch_reward.json deleted file mode 100644 index 03865c91c..000000000 --- a/bin/json/game_dispatch_reward.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "id": 1, - "num": [ - 1, - 2, - 3 - ], - "reward": [ - { - "a": "attr", - "t": "gold", - "n": 999 - }, - { - "a": "attr", - "t": "gold", - "n": 9999 - }, - { - "a": "attr", - "t": "gold", - "n": 99999 - } - ], - "day": 7 - } -] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index ddad16cd1..4bc6d8de0 100644 --- a/comm/const.go +++ b/comm/const.go @@ -34,53 +34,55 @@ const ( // 模块名定义处 const ( - ModuleSys core.M_Modules = "sys" //系统 - ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块 - ModuleWeb core.M_Modules = "web" //后台模块 - ModuleUser core.M_Modules = "user" //用户模块 - ModulePack core.M_Modules = "pack" //背包模块 - ModuleMail core.M_Modules = "mail" //邮件模块 - ModuleFriend core.M_Modules = "friend" //好友模块 - ModuleMgoLog core.M_Modules = "mgolog" //日志模块 - ModuleEquipment core.M_Modules = "equipment" //装备模块 - ModuleHero core.M_Modules = "hero" //英雄模块 - ModuleForum core.M_Modules = "forum" //论坛模块 - ModuleItems core.M_Modules = "items" //道具模块 - ModuleShop core.M_Modules = "shop" //商店模块 - ModuleTask core.M_Modules = "task" //任务模块 - ModuleMainline core.M_Modules = "mainline" //主线模块 - ModuleNotify core.M_Modules = "notify" //公告模块 - ModuleChat core.M_Modules = "chat" //聊天模块 - ModuleGM core.M_Modules = "gm" //gm模块 - ModulePagoda core.M_Modules = "pagoda" //魔塔模块 - ModuleMartialhall core.M_Modules = "martialhall" //武馆模块 - ModuleGourmet core.M_Modules = "gourmet" //美食馆 - ModuleRtask core.M_Modules = "rtask" //随机任务 - ModuleSmithy core.M_Modules = "smithy" //铁匠铺 - ModuleTimer core.M_Modules = "timer" //定时任务模块 - ModuleViking core.M_Modules = "viking" //维京远征 - ModuleMoonfantasy core.M_Modules = "moonfantasy" //月之秘境模块 - ModuleHunting core.M_Modules = "hunting" //狩猎 - ModuleLinestory core.M_Modules = "linestory" //支线剧情 - ModuleBattle core.M_Modules = "battle" //战斗 - ModuleLibrary core.M_Modules = "library" //藏书馆 - ModuleArena core.M_Modules = "arena" //竞技场 - ModuleTroll core.M_Modules = "troll" //巨怪商队 - ModuleHoroscope core.M_Modules = "horoscope" //星座图 - ModuleSociaty core.M_Modules = "sociaty" //公会 - ModulePay core.M_Modules = "pay" //支付 - ModuleAcademy core.M_Modules = "academy" //联盟学院 - ModulePrivilege core.M_Modules = "privilege" //特权 - ModuleGrowtask core.M_Modules = "growtask" //成长任务 - ModuleWorldtask core.M_Modules = "worldtask" //世界任务 - ModuleReddot core.M_Modules = "reddot" //红点 - ModuleCombat core.M_Modules = "combat" //关卡编辑 - ModuleEnchant core.M_Modules = "enchant" //附魔 - ModuleAutoBattle core.M_Modules = "autobattle" //自动战斗 - ModuleMline core.M_Modules = "mline" //主线模块 - ModulePvp core.M_Modules = "pvp" //实时pvp - ModulePractice core.M_Modules = "practice" //熊猫武馆 练功系统 - ModuleFitness core.M_Modules = "fitness" //熊猫武馆 每日一健 + ModuleSys core.M_Modules = "sys" //系统 + ModuleGate core.M_Modules = "gateway" //gate模块 网关服务模块 + ModuleWeb core.M_Modules = "web" //后台模块 + ModuleUser core.M_Modules = "user" //用户模块 + ModulePack core.M_Modules = "pack" //背包模块 + ModuleMail core.M_Modules = "mail" //邮件模块 + ModuleFriend core.M_Modules = "friend" //好友模块 + ModuleMgoLog core.M_Modules = "mgolog" //日志模块 + ModuleEquipment core.M_Modules = "equipment" //装备模块 + ModuleHero core.M_Modules = "hero" //英雄模块 + ModuleForum core.M_Modules = "forum" //论坛模块 + ModuleItems core.M_Modules = "items" //道具模块 + ModuleShop core.M_Modules = "shop" //商店模块 + ModuleTask core.M_Modules = "task" //任务模块 + ModuleMainline core.M_Modules = "mainline" //主线模块 + ModuleNotify core.M_Modules = "notify" //公告模块 + ModuleChat core.M_Modules = "chat" //聊天模块 + ModuleGM core.M_Modules = "gm" //gm模块 + ModulePagoda core.M_Modules = "pagoda" //魔塔模块 + ModuleMartialhall core.M_Modules = "martialhall" //武馆模块 + ModuleGourmet core.M_Modules = "gourmet" //美食馆 + ModuleRtask core.M_Modules = "rtask" //随机任务 + ModuleSmithy core.M_Modules = "smithy" //铁匠铺 + ModuleTimer core.M_Modules = "timer" //定时任务模块 + ModuleViking core.M_Modules = "viking" //维京远征 + ModuleMoonfantasy core.M_Modules = "moonfantasy" //月之秘境模块 + ModuleHunting core.M_Modules = "hunting" //狩猎 + ModuleLinestory core.M_Modules = "linestory" //支线剧情 + ModuleBattle core.M_Modules = "battle" //战斗 + ModuleLibrary core.M_Modules = "library" //藏书馆 + ModuleArena core.M_Modules = "arena" //竞技场 + ModuleTroll core.M_Modules = "troll" //巨怪商队 + ModuleHoroscope core.M_Modules = "horoscope" //星座图 + ModuleSociaty core.M_Modules = "sociaty" //公会 + ModulePay core.M_Modules = "pay" //支付 + ModuleAcademy core.M_Modules = "academy" //联盟学院 + ModulePrivilege core.M_Modules = "privilege" //特权 + ModuleGrowtask core.M_Modules = "growtask" //成长任务 + ModuleWorldtask core.M_Modules = "worldtask" //世界任务 + ModuleReddot core.M_Modules = "reddot" //红点 + ModuleCombat core.M_Modules = "combat" //关卡编辑 + ModuleEnchant core.M_Modules = "enchant" //附魔 + ModuleAutoBattle core.M_Modules = "autobattle" //自动战斗 + ModuleMline core.M_Modules = "mline" //主线模块 + ModulePvp core.M_Modules = "pvp" //实时pvp + ModulePandaTakekan core.M_Modules = "pandatakekan" //熊猫武馆 + ModuleDispatch core.M_Modules = "dispatch" //武馆派遣 + ModulePractice core.M_Modules = "practice" //熊猫武馆 练功系统 + ModuleFitness core.M_Modules = "fitness" //熊猫武馆 每日一健 ) // 数据表名定义处 @@ -233,6 +235,8 @@ const ( ///熊猫物管部 TablePandata = "pandata" + // 熊猫武馆派遣 + TableDispatch = "dispatch" ) // RPC服务接口定义处 diff --git a/modules/dispatch/api.go b/modules/dispatch/api.go new file mode 100644 index 000000000..c4cc19b86 --- /dev/null +++ b/modules/dispatch/api.go @@ -0,0 +1,17 @@ +package dispatch + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type apiComp struct { + modules.MCompGate + module *Dispatch +} + +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.(*Dispatch) + return +} \ No newline at end of file diff --git a/modules/dispatch/model_dispatch.go b/modules/dispatch/model_dispatch.go new file mode 100644 index 000000000..347acabc4 --- /dev/null +++ b/modules/dispatch/model_dispatch.go @@ -0,0 +1,28 @@ +package dispatch + +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 modelDispatch struct { + modules.MCompModel + module *Dispatch + service core.IService +} + +func (this *modelDispatch) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompModel.Init(service, module, comp, options) + this.TableName = comm.TableDispatch + this.module = module.(*Dispatch) + this.service = service + this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{ + Keys: bsonx.Doc{{Key: "_id", Value: bsonx.Int32(1)}}, + }) + + return +} diff --git a/modules/dispatch/module.go b/modules/dispatch/module.go new file mode 100644 index 000000000..3ab56bfb5 --- /dev/null +++ b/modules/dispatch/module.go @@ -0,0 +1,27 @@ +package dispatch + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +// 派遣 +type Dispatch struct { + modules.ModuleBase + api *apiComp +} + +func NewModule() core.IModule { + return &Dispatch{} +} + +func (this *Dispatch) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error){ + err = this.ModuleBase.Init(service, module, options) + return +} + + +func (this *Dispatch) GetType() core.M_Modules { + return comm.ModuleDispatch +} diff --git a/services/worker/main.go b/services/worker/main.go index 810177926..168949c73 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/modules/battle" "go_dreamfactory/modules/chat" "go_dreamfactory/modules/combat" + "go_dreamfactory/modules/dispatch" "go_dreamfactory/modules/enchant" "go_dreamfactory/modules/equipment" "go_dreamfactory/modules/forum" @@ -112,6 +113,7 @@ func main() { enchant.NewModule(), mline.NewModule(), pvp.NewModule(), + dispatch.NewModule(), ) } diff --git a/sys/configure/structs/Game.Dispatch_All.go b/sys/configure/structs/Game.Dispatch_All.go deleted file mode 100644 index c09f6442c..000000000 --- a/sys/configure/structs/Game.Dispatch_All.go +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 GameDispatch_All struct { - _dataMap map[int32]*GameDispatch_AllData - _dataList []*GameDispatch_AllData -} - -func NewGameDispatch_All(_buf []map[string]interface{}) (*GameDispatch_All, error) { - _dataList := make([]*GameDispatch_AllData, 0, len(_buf)) - dataMap := make(map[int32]*GameDispatch_AllData) - for _, _ele_ := range _buf { - if _v, err2 := DeserializeGameDispatch_AllData(_ele_); err2 != nil { - return nil, err2 - } else { - _dataList = append(_dataList, _v) - dataMap[_v.Id] = _v - } - } - return &GameDispatch_All{_dataList:_dataList, _dataMap:dataMap}, nil -} - -func (table *GameDispatch_All) GetDataMap() map[int32]*GameDispatch_AllData { - return table._dataMap -} - -func (table *GameDispatch_All) GetDataList() []*GameDispatch_AllData { - return table._dataList -} - -func (table *GameDispatch_All) Get(key int32) *GameDispatch_AllData { - return table._dataMap[key] -} - - diff --git a/sys/configure/structs/Game.Dispatch_AllData.go b/sys/configure/structs/Game.Dispatch_AllData.go deleted file mode 100644 index f7dc896c4..000000000 --- a/sys/configure/structs/Game.Dispatch_AllData.go +++ /dev/null @@ -1,37 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 GameDispatch_AllData struct { - Id int32 - Quantity float32 -} - -const TypeId_GameDispatch_AllData = 1167514754 - -func (*GameDispatch_AllData) GetTypeId() int32 { - return 1167514754 -} - -func (_v *GameDispatch_AllData)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["quantity"].(float64); !_ok_ { err = errors.New("quantity error"); return }; _v.Quantity = float32(_tempNum_) } - return -} - -func DeserializeGameDispatch_AllData(_buf map[string]interface{}) (*GameDispatch_AllData, error) { - v := &GameDispatch_AllData{} - if err := v.Deserialize(_buf); err == nil { - return v, nil - } else { - return nil, err - } -} diff --git a/sys/configure/structs/Game.Dispatch_Reward.go b/sys/configure/structs/Game.Dispatch_Reward.go deleted file mode 100644 index ff1ae14b5..000000000 --- a/sys/configure/structs/Game.Dispatch_Reward.go +++ /dev/null @@ -1,42 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 GameDispatch_Reward struct { - _dataMap map[int32]*GameDispatch_RewardData - _dataList []*GameDispatch_RewardData -} - -func NewGameDispatch_Reward(_buf []map[string]interface{}) (*GameDispatch_Reward, error) { - _dataList := make([]*GameDispatch_RewardData, 0, len(_buf)) - dataMap := make(map[int32]*GameDispatch_RewardData) - for _, _ele_ := range _buf { - if _v, err2 := DeserializeGameDispatch_RewardData(_ele_); err2 != nil { - return nil, err2 - } else { - _dataList = append(_dataList, _v) - dataMap[_v.Id] = _v - } - } - return &GameDispatch_Reward{_dataList:_dataList, _dataMap:dataMap}, nil -} - -func (table *GameDispatch_Reward) GetDataMap() map[int32]*GameDispatch_RewardData { - return table._dataMap -} - -func (table *GameDispatch_Reward) GetDataList() []*GameDispatch_RewardData { - return table._dataList -} - -func (table *GameDispatch_Reward) Get(key int32) *GameDispatch_RewardData { - return table._dataMap[key] -} - - diff --git a/sys/configure/structs/Game.Dispatch_RewardData.go b/sys/configure/structs/Game.Dispatch_RewardData.go deleted file mode 100644 index fa0809315..000000000 --- a/sys/configure/structs/Game.Dispatch_RewardData.go +++ /dev/null @@ -1,67 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 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 GameDispatch_RewardData struct { - Id int32 - Num []int32 - Reward []*Gameatn - Day int32 -} - -const TypeId_GameDispatch_RewardData = -356577150 - -func (*GameDispatch_RewardData) GetTypeId() int32 { - return -356577150 -} - -func (_v *GameDispatch_RewardData)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 _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["num"].([]interface{}); !_ok_ { err = errors.New("num error"); return } - - _v.Num = 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.Num = append(_v.Num, _list_v_) - } - } - - { - var _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return } - - _v.Reward = 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.Reward = append(_v.Reward, _list_v_) - } - } - - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["day"].(float64); !_ok_ { err = errors.New("day error"); return }; _v.Day = int32(_tempNum_) } - return -} - -func DeserializeGameDispatch_RewardData(_buf map[string]interface{}) (*GameDispatch_RewardData, error) { - v := &GameDispatch_RewardData{} - if err := v.Deserialize(_buf); err == nil { - return v, nil - } else { - return nil, err - } -}