Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
bfd49fb493
@ -54,7 +54,10 @@ var (
|
|||||||
string(comm.ModuleReputation),
|
string(comm.ModuleReputation),
|
||||||
string(comm.ModuleOldtimes),
|
string(comm.ModuleOldtimes),
|
||||||
},
|
},
|
||||||
"gm": {common.MF(comm.ModuleGM, "cmd")},
|
"gm": {
|
||||||
|
common.MF(comm.ModuleGM, "cmd"),
|
||||||
|
common.MF(comm.ModuleGM, "gi"),
|
||||||
|
},
|
||||||
"sys": {
|
"sys": {
|
||||||
common.MF(comm.ModuleSys, "funclist"),
|
common.MF(comm.ModuleSys, "funclist"),
|
||||||
},
|
},
|
||||||
@ -150,6 +153,7 @@ var (
|
|||||||
},
|
},
|
||||||
"worldtask": {
|
"worldtask": {
|
||||||
common.MF(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine),
|
common.MF(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine),
|
||||||
|
common.MF(comm.ModuleWorldtask, "check"),
|
||||||
},
|
},
|
||||||
"smithy": {
|
"smithy": {
|
||||||
common.MF(comm.ModuleSmithy, "customer"),
|
common.MF(comm.ModuleSmithy, "customer"),
|
||||||
@ -183,6 +187,13 @@ var (
|
|||||||
Rsp: &pb.GMCmdResp{},
|
Rsp: &pb.GMCmdResp{},
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
},
|
},
|
||||||
|
common.MF(comm.ModuleGM, "gi"): {
|
||||||
|
NavLabel: "实例配置",
|
||||||
|
Desc: "全局实例配置",
|
||||||
|
MainType: string(comm.ModuleGM),
|
||||||
|
SubType: "gi",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
"reddot": {
|
"reddot": {
|
||||||
NavLabel: "红点",
|
NavLabel: "红点",
|
||||||
MainType: string(comm.ModuleReddot),
|
MainType: string(comm.ModuleReddot),
|
||||||
@ -795,6 +806,13 @@ var (
|
|||||||
SubType: worldtask.WorldtaskSubtypeMine,
|
SubType: worldtask.WorldtaskSubtypeMine,
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
},
|
},
|
||||||
|
common.MF(comm.ModuleWorldtask, "check"): {
|
||||||
|
NavLabel: "模拟",
|
||||||
|
Desc: "世界任务自动执行模拟",
|
||||||
|
MainType: string(comm.ModuleWorldtask),
|
||||||
|
SubType: "check",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
// smithy
|
// smithy
|
||||||
string(comm.ModuleSmithy): {
|
string(comm.ModuleSmithy): {
|
||||||
NavLabel: "铁匠铺",
|
NavLabel: "铁匠铺",
|
||||||
|
@ -19,4 +19,14 @@ var (
|
|||||||
Rsp: &pb.AcademyReceiveResp{},
|
Rsp: &pb.AcademyReceiveResp{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//worldtask
|
||||||
|
WorldtaskCase = map[string]*model.TestCase{
|
||||||
|
common.MF(comm.ModuleWorldtask, "accept"): {
|
||||||
|
NavLabel: "接取任务",
|
||||||
|
MainType: string(comm.ModuleWorldtask),
|
||||||
|
SubType: "accept",
|
||||||
|
Enabled: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
@ -13,4 +13,5 @@ type TestCase struct {
|
|||||||
Enabled bool //是否启用
|
Enabled bool //是否启用
|
||||||
// View MyCaseView //视图
|
// View MyCaseView //视图
|
||||||
Print func(rsp proto.Message) string //定义打印
|
Print func(rsp proto.Message) string //定义打印
|
||||||
|
Sort int32 //顺序号
|
||||||
}
|
}
|
@ -99,6 +99,7 @@ func (a *appTester) LazyInit(service service.PttService, obs observer.Observer)
|
|||||||
formCard,
|
formCard,
|
||||||
resPanel,
|
resPanel,
|
||||||
)
|
)
|
||||||
|
panel.Offset = 0.8
|
||||||
content.Objects = append(content.Objects, panel)
|
content.Objects = append(content.Objects, panel)
|
||||||
} else {
|
} else {
|
||||||
logrus.WithFields(logrus.Fields{"mainType": t.MainType, "subType": t.SubType}).Warn("no view")
|
logrus.WithFields(logrus.Fields{"mainType": t.MainType, "subType": t.SubType}).Warn("no view")
|
||||||
|
@ -2,10 +2,10 @@ package ui
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"go_dreamfactory/cmd/v2/lib/common"
|
"go_dreamfactory/cmd/v2/lib/common"
|
||||||
"go_dreamfactory/cmd/v2/ui/views"
|
|
||||||
"go_dreamfactory/cmd/v2/model"
|
"go_dreamfactory/cmd/v2/model"
|
||||||
"go_dreamfactory/cmd/v2/service"
|
"go_dreamfactory/cmd/v2/service"
|
||||||
"go_dreamfactory/cmd/v2/service/observer"
|
"go_dreamfactory/cmd/v2/service/observer"
|
||||||
|
formview "go_dreamfactory/cmd/v2/ui/views"
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/modules/friend"
|
"go_dreamfactory/modules/friend"
|
||||||
"go_dreamfactory/modules/growtask"
|
"go_dreamfactory/modules/growtask"
|
||||||
@ -33,6 +33,7 @@ var (
|
|||||||
ViewRegister = map[string]MyCaseView{
|
ViewRegister = map[string]MyCaseView{
|
||||||
// gm
|
// gm
|
||||||
common.MF(comm.ModuleGM, "cmd"): &formview.BingoView{},
|
common.MF(comm.ModuleGM, "cmd"): &formview.BingoView{},
|
||||||
|
common.MF(comm.ModuleGM, "gi"): &formview.GlobalConfView{},
|
||||||
// reddot
|
// reddot
|
||||||
common.MF(comm.ModuleReddot, "get"): &formview.ReddotView{},
|
common.MF(comm.ModuleReddot, "get"): &formview.ReddotView{},
|
||||||
//sys
|
//sys
|
||||||
@ -113,6 +114,7 @@ var (
|
|||||||
common.MF(comm.ModuleGrowtask, growtask.GrowtaskSubTypeList): &formview.GrowtaskListView{},
|
common.MF(comm.ModuleGrowtask, growtask.GrowtaskSubTypeList): &formview.GrowtaskListView{},
|
||||||
//worldtask
|
//worldtask
|
||||||
common.MF(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine): &formview.WorldtaskMineView{},
|
common.MF(comm.ModuleWorldtask, worldtask.WorldtaskSubtypeMine): &formview.WorldtaskMineView{},
|
||||||
|
common.MF(comm.ModuleWorldtask, "check"): &formview.CheckWorldtaskView{},
|
||||||
//smithy
|
//smithy
|
||||||
common.MF(comm.ModuleSmithy, "customer"): &formview.SmithyView{},
|
common.MF(comm.ModuleSmithy, "customer"): &formview.SmithyView{},
|
||||||
//武馆派遣
|
//武馆派遣
|
||||||
|
@ -245,7 +245,8 @@ func (f *folderList) initItem(dir string) {
|
|||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
if file.IsDir() {
|
if file.IsDir() {
|
||||||
if file.Name() == ".vscode" {
|
if file.Name() == ".vscode"||
|
||||||
|
file.Name() == ".svn" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fm := common.Item{
|
fm := common.Item{
|
||||||
|
67
cmd/v2/ui/views/checkworldtask.go
Normal file
67
cmd/v2/ui/views/checkworldtask.go
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
package formview
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/cmd/v2/lib/common"
|
||||||
|
"go_dreamfactory/cmd/v2/model"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/theme"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 世界任务检查
|
||||||
|
type CheckWorldtaskView struct {
|
||||||
|
BaseformView
|
||||||
|
taskList *common.ItemList //世界任务执行过程列表
|
||||||
|
}
|
||||||
|
|
||||||
|
// - 检查世界任务状态
|
||||||
|
// 1. 输入任务ID 查询 任务状态
|
||||||
|
// 2. 查询所有任务执行结果
|
||||||
|
|
||||||
|
// - 模拟世界任务流程
|
||||||
|
// 1.根据配置自动执行所有流程
|
||||||
|
// 2.输出每个任务执行过程(文件)
|
||||||
|
// 3.如果有异常,输出执行错误原因
|
||||||
|
func (view *CheckWorldtaskView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||||
|
//taskId entry
|
||||||
|
// taskId:= widget.NewEntry()
|
||||||
|
|
||||||
|
//输出每个任务执行过程(文件)
|
||||||
|
path := widget.NewEntry()
|
||||||
|
jsonPathEntry := widget.NewEntry()
|
||||||
|
des := widget.NewEntry()
|
||||||
|
mockForm := widget.NewForm(
|
||||||
|
widget.NewFormItem("任务类型", des),
|
||||||
|
widget.NewFormItem("Json配置", jsonPathEntry),
|
||||||
|
widget.NewFormItem("结果目录", path),
|
||||||
|
)
|
||||||
|
|
||||||
|
view.taskList = common.NewItemList()
|
||||||
|
|
||||||
|
view.taskList.ItemList = view.taskList.CreateList()
|
||||||
|
|
||||||
|
helpBtn := widget.NewButtonWithIcon("", theme.HelpIcon(), func() {})
|
||||||
|
mockBtn := widget.NewButton("模拟执行", func() {
|
||||||
|
commCfg := &common.Config{
|
||||||
|
Path: jsonPathEntry.Text,
|
||||||
|
}
|
||||||
|
// 读取配置
|
||||||
|
if tb, err := cfg.NewTables(commCfg.Loader); err == nil {
|
||||||
|
tb.WorldTask.GetDataList()
|
||||||
|
}
|
||||||
|
// 读取协议
|
||||||
|
// 设置协议参数
|
||||||
|
// 输出结果
|
||||||
|
})
|
||||||
|
top := container.NewHBox()
|
||||||
|
bottom := container.NewHBox(helpBtn, mockBtn)
|
||||||
|
c := container.NewBorder(top, nil, nil, nil, view.taskList.ItemList)
|
||||||
|
layout := container.NewVSplit(
|
||||||
|
container.NewBorder(nil, bottom, nil, nil, container.NewGridWithColumns(2, mockForm)), c)
|
||||||
|
layout.Offset = 0.2
|
||||||
|
return layout
|
||||||
|
}
|
59
cmd/v2/ui/views/globalview.go
Normal file
59
cmd/v2/ui/views/globalview.go
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
package formview
|
||||||
|
|
||||||
|
import (
|
||||||
|
os_storage "go_dreamfactory/cmd/v2/lib/storage"
|
||||||
|
"go_dreamfactory/cmd/v2/model"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
)
|
||||||
|
|
||||||
|
// 全局实例配置
|
||||||
|
// redisDb mongoDb
|
||||||
|
|
||||||
|
type GlobalConfView struct {
|
||||||
|
BaseformView
|
||||||
|
storage os_storage.Storage
|
||||||
|
conf *os_storage.Config
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *GlobalConfView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||||
|
// load
|
||||||
|
this.storage, _ = os_storage.NewOSStorage()
|
||||||
|
var err error
|
||||||
|
this.conf, err = this.storage.LoadConfig()
|
||||||
|
if err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
return &fyne.Container{}
|
||||||
|
}
|
||||||
|
//redis form
|
||||||
|
redisForm := widget.NewForm()
|
||||||
|
//mongo form
|
||||||
|
mongoUrl := widget.NewEntry()
|
||||||
|
user := widget.NewEntry()
|
||||||
|
passd := widget.NewEntry()
|
||||||
|
mongoDatabase := widget.NewEntry()
|
||||||
|
mongoForm := widget.NewForm(
|
||||||
|
widget.NewFormItem("Addr", mongoUrl),
|
||||||
|
widget.NewFormItem("User", user),
|
||||||
|
widget.NewFormItem("Pass", passd),
|
||||||
|
widget.NewFormItem("DBName", mongoDatabase),
|
||||||
|
)
|
||||||
|
|
||||||
|
if this.conf.ServiceDBInfo != nil {
|
||||||
|
user.Text = this.conf.MgoDB.Name
|
||||||
|
passd.Text = this.conf.MgoDB.Password
|
||||||
|
mongoUrl.Text = this.conf.MgoDB.Host
|
||||||
|
mongoDatabase.Text = this.conf.MgoDB.Database
|
||||||
|
}
|
||||||
|
|
||||||
|
bottomBtn := widget.NewButton("保存", func() {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
layout := container.NewGridWithRows(2, redisForm, mongoForm)
|
||||||
|
c := container.NewBorder(nil, bottomBtn, nil, nil, layout)
|
||||||
|
return c
|
||||||
|
}
|
@ -33,6 +33,7 @@ const abortIndex int8 = math.MaxInt8 >> 1
|
|||||||
|
|
||||||
func newContext(log log.ILogger, engine *Engine, params *Params, skippedNodes *[]skippedNode) *Context {
|
func newContext(log log.ILogger, engine *Engine, params *Params, skippedNodes *[]skippedNode) *Context {
|
||||||
return &Context{
|
return &Context{
|
||||||
|
Log: log,
|
||||||
engine: engine,
|
engine: engine,
|
||||||
params: params,
|
params: params,
|
||||||
skippedNodes: skippedNodes,
|
skippedNodes: skippedNodes,
|
||||||
@ -102,8 +103,8 @@ func (this *Context) Handler() HandlerFunc {
|
|||||||
FullPath 返回匹配的路由完整路径。 对于未找到的路线
|
FullPath 返回匹配的路由完整路径。 对于未找到的路线
|
||||||
返回一个空字符串。
|
返回一个空字符串。
|
||||||
*/
|
*/
|
||||||
func (c *Context) FullPath() string {
|
func (this *Context) FullPath() string {
|
||||||
return c.fullPath
|
return this.fullPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Context) Next() {
|
func (this *Context) Next() {
|
||||||
@ -216,8 +217,8 @@ func (this *Context) GetUint(key string) (ui uint) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Context) GetUInt32(key string) (i uint32) {
|
func (this *Context) GetUInt32(key string) (i uint32) {
|
||||||
if val, ok := c.Get(key); ok && val != nil {
|
if val, ok := this.Get(key); ok && val != nil {
|
||||||
i, _ = val.(uint32)
|
i, _ = val.(uint32)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -491,7 +491,7 @@ func (this *Engine) prepareTrustedCIDRs() ([]*net.IPNet, error) {
|
|||||||
func (this *Engine) allocateContext() *Context {
|
func (this *Engine) allocateContext() *Context {
|
||||||
v := make(Params, 0, this.maxParams)
|
v := make(Params, 0, this.maxParams)
|
||||||
skippedNodes := make([]skippedNode, 0, this.maxSections)
|
skippedNodes := make([]skippedNode, 0, this.maxSections)
|
||||||
return &Context{Log: this.log, engine: this, params: &v, skippedNodes: &skippedNodes}
|
return newContext(this.log, this, &v, &skippedNodes) //& Context{Log: this.log, engine: this, params: &v, skippedNodes: &skippedNodes}
|
||||||
}
|
}
|
||||||
|
|
||||||
//日志接口-------------------------------------------------------------
|
//日志接口-------------------------------------------------------------
|
||||||
|
@ -176,12 +176,12 @@ func (this *Agent) decodeUserData(msg *pb.UserMessage) (code pb.ErrorCode, err e
|
|||||||
this.gateway.Errorf("base64 decode err %v", err)
|
this.gateway.Errorf("base64 decode err %v", err)
|
||||||
return pb.ErrorCode_DecodeError, nil
|
return pb.ErrorCode_DecodeError, nil
|
||||||
}
|
}
|
||||||
now := time.Now().Unix()
|
now := configure.Now().Unix()
|
||||||
jsonRet := gjson.Parse(string(dec))
|
jsonRet := gjson.Parse(string(dec))
|
||||||
timestamp := jsonRet.Get("timestamp").Int()
|
timestamp := jsonRet.Get("timestamp").Int()
|
||||||
//秘钥30秒失效
|
//秘钥30秒失效
|
||||||
if now-time.Unix(timestamp, 0).Unix() > 30 {
|
if now-time.Unix(timestamp, 0).Unix() > 30 {
|
||||||
this.gateway.Errorf("last timestamp:%v more than 30s", timestamp)
|
this.gateway.Errorf("now:%v last timestamp:%v more than 30s", now, timestamp)
|
||||||
return pb.ErrorCode_TimestampTimeout, fmt.Errorf("sec key expire")
|
return pb.ErrorCode_TimestampTimeout, fmt.Errorf("sec key expire")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,19 +35,19 @@ type Hero struct {
|
|||||||
chat comm.IChat
|
chat comm.IChat
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块名
|
// 模块名
|
||||||
func (this *Hero) GetType() core.M_Modules {
|
func (this *Hero) GetType() core.M_Modules {
|
||||||
return comm.ModuleHero
|
return comm.ModuleHero
|
||||||
}
|
}
|
||||||
|
|
||||||
//模块初始化接口 注册用户创建角色事件
|
// 模块初始化接口 注册用户创建角色事件
|
||||||
func (this *Hero) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
func (this *Hero) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||||
err = this.ModuleBase.Init(service, module, options)
|
err = this.ModuleBase.Init(service, module, options)
|
||||||
this.service = service
|
this.service = service
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//装备组件
|
// 装备组件
|
||||||
func (this *Hero) OnInstallComp() {
|
func (this *Hero) OnInstallComp() {
|
||||||
this.ModuleBase.OnInstallComp()
|
this.ModuleBase.OnInstallComp()
|
||||||
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||||
@ -77,7 +77,7 @@ func (this *Hero) Start() (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建单个叠加英雄
|
// 创建单个叠加英雄
|
||||||
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, code pb.ErrorCode) {
|
func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string, num int32) (hero *pb.DBHero, bFirst bool, atno []*pb.UserAtno, code pb.ErrorCode) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
@ -112,7 +112,7 @@ func (this *Hero) createRepeatHero(session comm.IUserSession, heroCfgId string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取英雄
|
// 获取英雄
|
||||||
func (this *Hero) GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode) {
|
func (this *Hero) GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode) {
|
||||||
hero := this.modelHero.getOneHero(uid, heroId)
|
hero := this.modelHero.getOneHero(uid, heroId)
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
@ -121,7 +121,7 @@ func (this *Hero) GetHeroByObjID(uid, heroId string) (*pb.DBHero, pb.ErrorCode)
|
|||||||
return hero, pb.ErrorCode_Success
|
return hero, pb.ErrorCode_Success
|
||||||
}
|
}
|
||||||
|
|
||||||
//佩戴装备
|
// 佩戴装备
|
||||||
func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
|
func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, equip []*pb.DB_Equipment) (code pb.ErrorCode) {
|
||||||
|
|
||||||
if hero == nil {
|
if hero == nil {
|
||||||
@ -177,12 +177,12 @@ func (this *Hero) SendRdTask(session comm.IUserSession) {
|
|||||||
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
go this.ModuleRtask.TriggerTask(session.GetUserId(), szTask...)
|
||||||
}
|
}
|
||||||
|
|
||||||
//英雄列表
|
// 英雄列表
|
||||||
func (this *Hero) GetHeroList(uid string) []*pb.DBHero {
|
func (this *Hero) GetHeroList(uid string) []*pb.DBHero {
|
||||||
return this.modelHero.getHeroList(uid)
|
return this.modelHero.getHeroList(uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
//查询英雄数量
|
// 查询英雄数量
|
||||||
func (this *Hero) QueryHeroAmount(uId string, heroCfgId string) (amount uint32) {
|
func (this *Hero) QueryHeroAmount(uId string, heroCfgId string) (amount uint32) {
|
||||||
heroes := this.GetHeroList(uId)
|
heroes := this.GetHeroList(uId)
|
||||||
for _, v := range heroes {
|
for _, v := range heroes {
|
||||||
@ -257,7 +257,7 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//Event-------------------------------------------------------------------------------------------------玩家离线
|
// Event-------------------------------------------------------------------------------------------------玩家离线
|
||||||
func (this *Hero) EventUserOffline(uid, sessionid string) {
|
func (this *Hero) EventUserOffline(uid, sessionid string) {
|
||||||
this.modelHero.RemoveUserHeroInfo(uid)
|
this.modelHero.RemoveUserHeroInfo(uid)
|
||||||
}
|
}
|
||||||
@ -635,7 +635,7 @@ func (this *Hero) GetTujianHeroNum(uid string) int32 {
|
|||||||
return int32(len(this.modelHero.getHeroList(uid)))
|
return int32(len(this.modelHero.getHeroList(uid)))
|
||||||
}
|
}
|
||||||
|
|
||||||
////拥有觉醒至A级的B星英雄N个
|
// //拥有觉醒至A级的B星英雄N个
|
||||||
func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32 {
|
func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32 {
|
||||||
tmp := make([]*pb.DBHero, 0)
|
tmp := make([]*pb.DBHero, 0)
|
||||||
for _, v := range this.modelHero.getHeroList(uid) {
|
for _, v := range this.modelHero.getHeroList(uid) {
|
||||||
@ -911,7 +911,7 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid []string
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//DrawCard_ContinuousRestriction_Camp
|
// DrawCard_ContinuousRestriction_Camp
|
||||||
func (this *Hero) DrawCardContinuousRestrictionCamp(cardId string, race map[int32]int32, sz []int32, data []*cfg.GameDrawCardData) (card string) {
|
func (this *Hero) DrawCardContinuousRestrictionCamp(cardId string, race map[int32]int32, sz []int32, data []*cfg.GameDrawCardData) (card string) {
|
||||||
card = cardId
|
card = cardId
|
||||||
cfgDraw := this.ModuleTools.GetGlobalConf() // 读取抽卡配置文件
|
cfgDraw := this.ModuleTools.GetGlobalConf() // 读取抽卡配置文件
|
||||||
|
@ -270,7 +270,7 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondHandle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 处理触发的任务
|
// 处理触发的任务
|
||||||
func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) {
|
func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (condIds []int32, code pb.ErrorCode) {
|
||||||
uid := session.GetUserId()
|
uid := session.GetUserId()
|
||||||
|
|
||||||
var handles []*rtaskCondHandle
|
var handles []*rtaskCondHandle
|
||||||
@ -284,7 +284,7 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType com
|
|||||||
string(comm.Rpc_ModuleRtaskSendTask),
|
string(comm.Rpc_ModuleRtaskSendTask),
|
||||||
pb.RPCRTaskReq{Uid: uid, TaskType: int32(rtaskType), Param: params},
|
pb.RPCRTaskReq{Uid: uid, TaskType: int32(rtaskType), Param: params},
|
||||||
nil); err != nil {
|
nil); err != nil {
|
||||||
this.Errorln(err)
|
log.Errorln(err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -305,48 +305,8 @@ func (this *ModuleRtask) processOneTask(session comm.IUserSession, rtaskType com
|
|||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
condIds = append(condIds, conf.Id)
|
||||||
}
|
}
|
||||||
|
|
||||||
//任务完成则推送
|
|
||||||
if code = this.CheckCondi(uid, conf.Id); code == pb.ErrorCode_Success {
|
|
||||||
module, err := this.service.GetModule(comm.ModuleWorldtask)
|
|
||||||
if err == nil {
|
|
||||||
if worldtask, ok := module.(comm.IWorldtask); ok {
|
|
||||||
if err := worldtask.TaskCondFinishNotify(session, conf.Id); err != nil {
|
|
||||||
log.Error("任务条件达成通知",
|
|
||||||
log.Field{Key: "uid", Value: uid},
|
|
||||||
log.Field{Key: "condId", Value: conf.Id},
|
|
||||||
log.Field{Key: "err", Value: err.Error()},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
userModule, err := this.service.GetModule(comm.ModuleUser)
|
|
||||||
if err == nil {
|
|
||||||
// 公会
|
|
||||||
if user, ok := userModule.(comm.IUser); ok {
|
|
||||||
ex, err := user.GetUserExpand(uid)
|
|
||||||
if err == nil && ex.SociatyId != "" {
|
|
||||||
sociatyModule, err := this.service.GetModule(comm.ModuleSociaty)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if sociaty, ok := sociatyModule.(comm.ISociaty); ok {
|
|
||||||
if err2 := sociaty.TaskcondNotify(uid, ex.SociatyId, conf.Id); err2 != nil {
|
|
||||||
log.Error("公会任务条件达成通知",
|
|
||||||
log.Field{Key: "uid", Value: uid},
|
|
||||||
log.Field{Key: "sociatyId", Value: ex.SociatyId},
|
|
||||||
log.Field{Key: "condId", Value: conf.Id},
|
|
||||||
log.Field{Key: "err", Value: err2.Error()},
|
|
||||||
)
|
|
||||||
}
|
|
||||||
this.processOneTask(session, comm.Rtype156, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -371,6 +331,7 @@ func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam)
|
|||||||
record.Id = primitive.NewObjectID().Hex()
|
record.Id = primitive.NewObjectID().Hex()
|
||||||
record.Ctime = configure.Now().Unix()
|
record.Ctime = configure.Now().Unix()
|
||||||
if err := this.modelRtaskRecord.Add(uid, record); err != nil {
|
if err := this.modelRtaskRecord.Add(uid, record); err != nil {
|
||||||
|
log.Errorln(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -378,26 +339,75 @@ func (this *ModuleRtask) TriggerTask(uid string, taskParams ...*comm.TaskParam)
|
|||||||
|
|
||||||
this.modelRtaskRecord.record = record
|
this.modelRtaskRecord.record = record
|
||||||
|
|
||||||
|
var (
|
||||||
|
condIds []int32
|
||||||
|
)
|
||||||
for _, tp := range taskParams {
|
for _, tp := range taskParams {
|
||||||
// this.Debug("任务触发",
|
this.Debug("任务触发",
|
||||||
// log.Field{Key: "uid", Value: uid},
|
log.Field{Key: "uid", Value: uid},
|
||||||
// log.Field{Key: "type", Value: tp.TT},
|
log.Field{Key: "type", Value: tp.TT},
|
||||||
// log.Field{Key: "params", Value: tp.Params})
|
log.Field{Key: "params", Value: tp.Params})
|
||||||
|
|
||||||
if code := this.processOneTask(session, tp.TT, tp.Params...); code != pb.ErrorCode_Success {
|
ids, code := this.processOneTask(session, tp.TT, tp.Params...)
|
||||||
|
if code != pb.ErrorCode_Success {
|
||||||
// this.Error("任务处理", log.Field{Key: "uid", Value: uid}, log.Field{Key: "code", Value: code})
|
// this.Error("任务处理", log.Field{Key: "uid", Value: uid}, log.Field{Key: "code", Value: code})
|
||||||
}
|
}
|
||||||
|
|
||||||
session.Push()
|
condIds = append(condIds, ids...)
|
||||||
|
|
||||||
|
this.Debug("已处理的任务", log.Field{Key: "condIds", Value: ids})
|
||||||
comm.PuttaskParam(tp)
|
comm.PuttaskParam(tp)
|
||||||
}
|
}
|
||||||
|
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
"vals": record.Vals,
|
"vals": this.modelRtaskRecord.record.Vals,
|
||||||
}
|
}
|
||||||
|
|
||||||
this.modelRtaskRecord.Change(uid, update)
|
this.modelRtaskRecord.Change(uid, update)
|
||||||
|
|
||||||
|
for _, condId := range condIds {
|
||||||
|
//任务完成则推送
|
||||||
|
if code := this.CheckCondi(uid, condId); code == pb.ErrorCode_Success {
|
||||||
|
module, err := this.service.GetModule(comm.ModuleWorldtask)
|
||||||
|
if err == nil {
|
||||||
|
if worldtask, ok := module.(comm.IWorldtask); ok {
|
||||||
|
if err := worldtask.TaskCondFinishNotify(session, condId); err != nil {
|
||||||
|
log.Error("任务条件达成通知",
|
||||||
|
log.Field{Key: "uid", Value: uid},
|
||||||
|
log.Field{Key: "condId", Value: condId},
|
||||||
|
log.Field{Key: "err", Value: err.Error()},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userModule, err := this.service.GetModule(comm.ModuleUser)
|
||||||
|
if err == nil {
|
||||||
|
// 公会
|
||||||
|
if user, ok := userModule.(comm.IUser); ok {
|
||||||
|
ex, err := user.GetUserExpand(uid)
|
||||||
|
if err == nil && ex.SociatyId != "" {
|
||||||
|
sociatyModule, err := this.service.GetModule(comm.ModuleSociaty)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if sociaty, ok := sociatyModule.(comm.ISociaty); ok {
|
||||||
|
if err2 := sociaty.TaskcondNotify(uid, ex.SociatyId, condId); err2 != nil {
|
||||||
|
log.Error("公会任务条件达成通知",
|
||||||
|
log.Field{Key: "uid", Value: uid},
|
||||||
|
log.Field{Key: "sociatyId", Value: ex.SociatyId},
|
||||||
|
log.Field{Key: "condId", Value: condId},
|
||||||
|
log.Field{Key: "err", Value: err2.Error()},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
this.processOneTask(session, comm.Rtype156, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
session.Push()
|
||||||
this.PutUserSession(session)
|
this.PutUserSession(session)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -477,7 +487,7 @@ func (this *ModuleRtask) Rpc_ModuleRtaskSendTask(ctx context.Context, args *pb.R
|
|||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
this.processOneTask(session, comm.TaskType(args.TaskType), args.Param...)
|
this.processOneTask(session, comm.TaskType(args.TaskType), args.Param...)
|
||||||
session.Push()
|
// session.Push()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"go_dreamfactory/utils"
|
"go_dreamfactory/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 公会解散
|
// 公会解散/取消解散
|
||||||
|
|
||||||
func (this *apiComp) DismissCheck(session comm.IUserSession, req *pb.SociatyDismissReq) (code pb.ErrorCode) {
|
func (this *apiComp) DismissCheck(session comm.IUserSession, req *pb.SociatyDismissReq) (code pb.ErrorCode) {
|
||||||
if req.Dismiss > 1 {
|
if req.Dismiss > 1 {
|
||||||
|
@ -22,7 +22,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.SociatySearchReq)
|
|||||||
|
|
||||||
rsp := &pb.SociatySearchResp{}
|
rsp := &pb.SociatySearchResp{}
|
||||||
sociaty := this.module.modelSociaty.findByName(req.Name)
|
sociaty := this.module.modelSociaty.findByName(req.Name)
|
||||||
if sociaty != nil {
|
if sociaty != nil && sociaty.Id != "" {
|
||||||
rsp.List = append(rsp.List, sociaty)
|
rsp.List = append(rsp.List, sociaty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user