diff --git a/bin/json/game_caravanreward.json b/bin/json/game_caravanreward.json index 23ab5787d..dc87432e0 100644 --- a/bin/json/game_caravanreward.json +++ b/bin/json/game_caravanreward.json @@ -1,6 +1,8 @@ [ { - "key": 1000, + "key": 1, + "moneystart": -1, + "moneyend": 10000, "reward": [ { "a": "attr", @@ -10,7 +12,9 @@ ] }, { - "key": 2000, + "key": 2, + "moneystart": 10000, + "moneyend": 20000, "reward": [ { "a": "attr", @@ -20,7 +24,9 @@ ] }, { - "key": 3000, + "key": 3, + "moneystart": 20000, + "moneyend": 30000, "reward": [ { "a": "attr", @@ -30,7 +36,9 @@ ] }, { - "key": 4000, + "key": 4, + "moneystart": 30000, + "moneyend": 50000, "reward": [ { "a": "attr", @@ -40,7 +48,9 @@ ] }, { - "key": 5000, + "key": 5, + "moneystart": 50000, + "moneyend": -1, "reward": [ { "a": "attr", @@ -48,15 +58,5 @@ "n": 9999 } ] - }, - { - "key": 0, - "reward": [ - { - "a": "attr", - "t": "gold", - "n": 10 - } - ] } ] \ No newline at end of file diff --git a/bin/json/game_worldtask.json b/bin/json/game_worldtask.json index 286b76abc..c5c63b534 100644 --- a/bin/json/game_worldtask.json +++ b/bin/json/game_worldtask.json @@ -158,7 +158,7 @@ }, { "key": 20030, - "opencond": "heroic_teaching", + "opencond": "", "lock": 1, "lockend": 999, "ontxe": 20020, diff --git a/comm/imodule.go b/comm/imodule.go index 5fc8736e7..e70598963 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -536,4 +536,8 @@ type ( //英雄升级 HeroUpLv(uid string, heroid string, lv int32) } + // 世界任务 + IWtask interface { + IOpenCmdNotice + } ) diff --git a/comm/usersession.go b/comm/usersession.go index 6d6b7955c..c97d7a5dd 100644 --- a/comm/usersession.go +++ b/comm/usersession.go @@ -33,7 +33,7 @@ type UserSession struct { msgqueue []*pb.UserMessage } -//重置 +// 重置 func (this *UserSession) SetSession(ip, sessionId, stag, sid, uid string) { this.IP = ip this.SessionId = sessionId @@ -43,7 +43,7 @@ func (this *UserSession) SetSession(ip, sessionId, stag, sid, uid string) { this.msgqueue = this.msgqueue[:0] } -//重置 +// 重置 func (this *UserSession) Reset() { this.IP = "" this.SessionId = "" @@ -52,39 +52,39 @@ func (this *UserSession) Reset() { this.msgqueue = this.msgqueue[:0] } -//获取用户的会话id +// 获取用户的会话id func (this *UserSession) GetSessionId() string { return this.SessionId } -//获取用户的uid +// 获取用户的uid func (this *UserSession) GetUserId() string { return this.UserId } -//获取用户的远程ip地址 +// 获取用户的远程ip地址 func (this *UserSession) GetIP() string { return this.IP } -//会话所在集群 +// 会话所在集群 func (this *UserSession) GetServiecTag() string { return this.ServiceTag } -//用户当先所在网关服务 +// 用户当先所在网关服务 func (this *UserSession) GetGatewayServiceId() string { return this.GatewayServiceId } -//是否登录 +// 是否登录 func (this *UserSession) IsLogin() bool { return this.UserId != "" } -///绑定uid 登录后操作 -///uid 用户id -///wokerId 用户绑定worker服务id +// /绑定uid 登录后操作 +// /uid 用户id +// /wokerId 用户绑定worker服务id func (this *UserSession) Bind(uid string, wokerId string) (err error) { reply := &pb.RPCMessageReply{} if err = this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentBind), &pb.AgentBuildReq{ @@ -99,7 +99,7 @@ func (this *UserSession) Bind(uid string, wokerId string) (err error) { return } -//解绑uid 注销和切换账号是处理 +// 解绑uid 注销和切换账号是处理 func (this *UserSession) UnBind() (err error) { reply := &pb.RPCMessageReply{} if err = this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentUnBind), &pb.AgentUnBuildReq{ @@ -112,7 +112,7 @@ func (this *UserSession) UnBind() (err error) { return } -//向用户发送消息 +// 向用户发送消息 func (this *UserSession) SendMsg(mainType, subType string, msg proto.Message) (err error) { // log.Debugf("SendMsg to UserId:[%s] Data: %v", this.UserId, msg) data, _ := anypb.New(msg) @@ -124,7 +124,7 @@ func (this *UserSession) SendMsg(mainType, subType string, msg proto.Message) (e return } -//关闭用户连接对象 +// 关闭用户连接对象 func (this *UserSession) Close() (err error) { reply := &pb.RPCMessageReply{} if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentSendMsg), &pb.AgentCloseeReq{ @@ -135,14 +135,14 @@ func (this *UserSession) Close() (err error) { return } -//清空消息队列 +// 清空消息队列 func (this *UserSession) Polls() []*pb.UserMessage { msgs := this.msgqueue this.msgqueue = this.msgqueue[:0] return msgs } -//推送消息到用户 +// 推送消息到用户 func (this *UserSession) Push() (err error) { // reply := &pb.RPCMessageReply{} if len(this.msgqueue) > 0 { @@ -157,7 +157,13 @@ func (this *UserSession) Push() (err error) { return } -//打印日志需要 +// 克隆 +func (this *UserSession) Clone() (clone *UserSession) { + + return +} + +// 打印日志需要 func (this *UserSession) ToString() string { return fmt.Sprintf("SessionId:%s UserId:%s GatewayServiceId:%s", this.SessionId, this.UserId, this.GatewayServiceId) } diff --git a/modules/sys/api_activate.go b/modules/sys/api_activate.go index ae5b9bbc7..a7b0cb4d6 100644 --- a/modules/sys/api_activate.go +++ b/modules/sys/api_activate.go @@ -48,6 +48,7 @@ func (this *apiComp) FuncActivate(session comm.IUserSession, req *pb.SysFuncActi return } + go this.module.wtask.OpenCmdNotice(session.GetUserId(), req.Cid) //手动激活通知模块 for _, m := range opencfg.Notify { i, err := this.service.GetModule(core.M_Modules(m)) diff --git a/modules/sys/api_getlist.go b/modules/sys/api_getlist.go index 20f50b71b..4fc0f55d2 100644 --- a/modules/sys/api_getlist.go +++ b/modules/sys/api_getlist.go @@ -13,6 +13,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi var ( bChange bool + change []string = make([]string, 0) ) rsp := &pb.SysFuncGetListResp{} rsp.Cond = make(map[string]int32, 0) @@ -34,6 +35,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi list.Cond[id] = 1 //设置激活 } else { list.Cond[id] = 2 //自动激活 + change = append(change, id) } bChange = true } @@ -50,6 +52,7 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi list.Cond[id] = 1 //设置激活 } else { list.Cond[id] = 2 //自动激活 + change = append(change, id) } bChange = true } @@ -64,6 +67,9 @@ func (this *apiComp) FuncGetList(session comm.IUserSession, req *pb.SysFuncGetLi "cond": list.Cond, }) } + if len(change) > 0 { + go this.module.wtask.OpenCmdNotice(session.GetUserId(), change...) + } session.SendMsg(string(this.module.GetType()), "funcgetlist", rsp) return } diff --git a/modules/sys/module.go b/modules/sys/module.go index 913094ae0..d539bd688 100644 --- a/modules/sys/module.go +++ b/modules/sys/module.go @@ -16,6 +16,7 @@ var _ comm.ISys = (*ModuleSys)(nil) type ModuleSys struct { modules.ModuleBase + wtask comm.IWtask api *apiComp configure *configureComp service base.IRPCXService @@ -33,7 +34,7 @@ func (this *ModuleSys) OnInstallComp() { this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } -//模块初始化 +// 模块初始化 func (this *ModuleSys) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) this.service = service.(base.IRPCXService) @@ -43,6 +44,11 @@ func (this *ModuleSys) Init(service core.IService, module core.IModule, options func (this *ModuleSys) Start() (err error) { err = this.ModuleBase.Start() + var module core.IModule + if module, err = this.service.GetModule(comm.ModuleSys); err != nil { + return + } + this.wtask = module.(comm.IWtask) this.service.RegisterFunctionName(string(comm.Rpc_OpendCond), this.OpenCond) return } diff --git a/modules/worldtask/module.go b/modules/worldtask/module.go index fcc8a4b2a..4b287c850 100644 --- a/modules/worldtask/module.go +++ b/modules/worldtask/module.go @@ -5,7 +5,6 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/event" "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules" "go_dreamfactory/pb" @@ -48,7 +47,7 @@ func (this *Worldtask) GetType() core.M_Modules { func (this *Worldtask) Start() (err error) { err = this.ModuleBase.Start() - event.Register(comm.EventBuriedComplete, this.TCondFinishNotify) + // event.Register(comm.EventBuriedComplete, this.TCondFinishNotify) return } diff --git a/modules/wtask/module.go b/modules/wtask/module.go index b35296d0c..71774cda7 100644 --- a/modules/wtask/module.go +++ b/modules/wtask/module.go @@ -146,7 +146,7 @@ func (this *WTask) BuriedsNotify(uid string, condis []*pb.ConIProgress) { this.PutUserSession(session) }() //发送进度变化消息 - session.SendMsg(string(this.GetType()), "accepttaskchange", &pb.WTaskAcceptChangePush{Accepts: detailstasks}) + session.SendMsg(string(this.GetType()), "acceptchange", &pb.WTaskAcceptChangePush{Accepts: detailstasks}) } // 功能开启 diff --git a/sys/configure/structs/Game.CaravanRewardData.go b/sys/configure/structs/Game.CaravanRewardData.go index fb5b56e7f..823614bda 100644 --- a/sys/configure/structs/Game.CaravanRewardData.go +++ b/sys/configure/structs/Game.CaravanRewardData.go @@ -12,6 +12,8 @@ import "errors" type GameCaravanRewardData struct { Key int32 + Moneystart int32 + Moneyend int32 Reward []*Gameatn } @@ -23,6 +25,8 @@ func (*GameCaravanRewardData) GetTypeId() int32 { func (_v *GameCaravanRewardData)Deserialize(_buf map[string]interface{}) (err error) { { 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["moneystart"].(float64); !_ok_ { err = errors.New("moneystart error"); return }; _v.Moneystart = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["moneyend"].(float64); !_ok_ { err = errors.New("moneyend error"); return }; _v.Moneyend = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool