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