上传跨服消息分发优化
This commit is contained in:
parent
526e32e708
commit
cf65a54b8f
@ -1,57 +1,22 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"msgid": "notify.getlist",
|
"msgid": "notify",
|
||||||
"routrules": "~/worker",
|
"routrules": "~/worker",
|
||||||
"describe": "公告获取接口"
|
"describe": "公告系统"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"msgid": "forum.getlist",
|
"msgid": "forum",
|
||||||
"routrules": "~/worker",
|
"routrules": "~/worker",
|
||||||
"describe": "论坛评论获取接口"
|
"describe": "论坛系统"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"msgid": "forum.releasecomment",
|
"msgid": "chat",
|
||||||
"routrules": "~/worker",
|
"routrules": "~/worker",
|
||||||
"describe": "论坛发布评论接口"
|
"describe": "聊天系统"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"msgid": "forum.watchhero",
|
"msgid": "moonfantasy",
|
||||||
"routrules": "~/worker",
|
"routrules": "~/worker",
|
||||||
"describe": "论坛查看目标英雄接口"
|
"describe": "月之秘境"
|
||||||
},
|
|
||||||
{
|
|
||||||
"msgid": "chat.crosschannel",
|
|
||||||
"routrules": "~/worker",
|
|
||||||
"describe": "聊天系统跨服聊天频道请求"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"msgid": "chat.chanagechannel",
|
|
||||||
"routrules": "~/worker",
|
|
||||||
"describe": "切换聊天频道"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"msgid": "chat.getlist",
|
|
||||||
"routrules": "~/worker",
|
|
||||||
"describe": "获取聊天记录"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"msgid": "chat.send",
|
|
||||||
"routrules": "~/worker",
|
|
||||||
"describe": "聊天消息发送"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"msgid": "forum.like",
|
|
||||||
"routrules": "~/worker",
|
|
||||||
"describe": "论坛点赞入口"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"msgid": "moonfantasy.trigger",
|
|
||||||
"routrules": "~/worker",
|
|
||||||
"describe": "月之秘境触发接口"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"msgid": "moonfantasy.dare",
|
|
||||||
"routrules": "~/worker",
|
|
||||||
"describe": "月之秘境参战接口"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
@ -112,7 +112,7 @@ func (this *MCompModel) GetListFields(uid string, id string, data interface{}, f
|
|||||||
|
|
||||||
//读取列表数据中单个数据
|
//读取列表数据中单个数据
|
||||||
func (this *MCompModel) GetListObj(uid string, id string, data interface{}) (err error) {
|
func (this *MCompModel) GetListObj(uid string, id string, data interface{}) (err error) {
|
||||||
return this.DBModel.GetListObj(uid, id, data)
|
return this.DBModel.GetListObj(uid, id, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
//批量读取列表中多个数据
|
//批量读取列表中多个数据
|
||||||
|
@ -240,8 +240,7 @@ func (this *Agent) messageDistribution(msg *pb.UserMessage) (err error) {
|
|||||||
req.SubType = msg.SubType
|
req.SubType = msg.SubType
|
||||||
req.Message = msg.Data
|
req.Message = msg.Data
|
||||||
|
|
||||||
msgid := strings.ToLower(fmt.Sprintf("%s.%s", msg.MainType, msg.SubType))
|
if rule, ok = this.gateway.GetMsgDistribute(req.MainType, req.SubType); ok {
|
||||||
if rule, ok = this.gateway.GetMsgDistribute(msgid); ok {
|
|
||||||
paths := strings.Split(rule, "/")
|
paths := strings.Split(rule, "/")
|
||||||
if len(paths) == 3 {
|
if len(paths) == 3 {
|
||||||
if paths[0] == "~" {
|
if paths[0] == "~" {
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package gateway
|
package gateway
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
)
|
)
|
||||||
@ -24,7 +26,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetMsgDistribute 获取消息分发规则读取配置表
|
// GetMsgDistribute 获取消息分发规则读取配置表
|
||||||
func (this *configureComp) GetMsgDistribute(msgid string) (rule string, ok bool) {
|
func (this *configureComp) GetMsgDistribute(msgmid, msguid string) (rule string, ok bool) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
v interface{}
|
v interface{}
|
||||||
@ -34,8 +36,11 @@ func (this *configureComp) GetMsgDistribute(msgid string) (rule string, ok bool)
|
|||||||
ok = false
|
ok = false
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
if item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgid]; ok {
|
if item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgmid]; ok {
|
||||||
rule = item.Routrules
|
rule = item.Routrules
|
||||||
|
} else {
|
||||||
|
msgid := strings.ToLower(fmt.Sprintf("%s.%s", msgmid, msguid))
|
||||||
|
item, ok = v.(*cfg.GameMsgdistrib).GetDataMap()[msgid]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
|
@ -29,7 +29,7 @@ type (
|
|||||||
CrossServiceTag() string
|
CrossServiceTag() string
|
||||||
Connect(a IAgent)
|
Connect(a IAgent)
|
||||||
DisConnect(a IAgent)
|
DisConnect(a IAgent)
|
||||||
GetMsgDistribute(msgid string) (rule string, ok bool)
|
GetMsgDistribute(msgmid, msguid string) (rule string, ok bool)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -102,8 +102,8 @@ func (this *Gateway) DisConnect(a IAgent) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetMsgDistribute 读取消息分发规则
|
// GetMsgDistribute 读取消息分发规则
|
||||||
func (this *Gateway) GetMsgDistribute(msgid string) (rule string, ok bool) {
|
func (this *Gateway) GetMsgDistribute(msgmid, msguid string) (rule string, ok bool) {
|
||||||
return this.configure.GetMsgDistribute(msgid)
|
return this.configure.GetMsgDistribute(msgmid, msguid)
|
||||||
}
|
}
|
||||||
|
|
||||||
//日志
|
//日志
|
||||||
|
@ -20,29 +20,29 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
|
|||||||
globalconf *cfg.GameGlobalData
|
globalconf *cfg.GameGlobalData
|
||||||
boss *cfg.GameDreamlandBoosData
|
boss *cfg.GameDreamlandBoosData
|
||||||
mdata *pb.DBMoonfantasy
|
mdata *pb.DBMoonfantasy
|
||||||
record *pb.DBBattleRecord
|
// record *pb.DBBattleRecord
|
||||||
cd pb.ErrorCode
|
cd pb.ErrorCode
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if cd == pb.ErrorCode_Success {
|
// if cd == pb.ErrorCode_Success {
|
||||||
session.SendMsg(string(this.module.GetType()), "dare", &pb.MoonfantasyBattleResp{
|
// session.SendMsg(string(this.module.GetType()), "dare", &pb.MoonfantasyBattleResp{
|
||||||
Code: cd,
|
// Code: cd,
|
||||||
Monster: mdata.Monster,
|
// Monster: mdata.Monster,
|
||||||
Info: &pb.BattleInfo{
|
// Info: &pb.BattleInfo{
|
||||||
Id: record.Id,
|
// Id: record.Id,
|
||||||
Btype: record.Btype,
|
// Btype: record.Btype,
|
||||||
Ptype: record.Ptype,
|
// Ptype: record.Ptype,
|
||||||
RedCompId: record.RedCompId,
|
// RedCompId: record.RedCompId,
|
||||||
Redflist: record.Redflist,
|
// Redflist: record.Redflist,
|
||||||
BlueCompId: record.BlueCompId,
|
// BlueCompId: record.BlueCompId,
|
||||||
Buleflist: record.Buleflist,
|
// Buleflist: record.Buleflist,
|
||||||
},
|
// },
|
||||||
})
|
// })
|
||||||
} else {
|
// } else {
|
||||||
session.SendMsg(string(this.module.GetType()), "dare", &pb.MoonfantasyBattleResp{Code: cd})
|
session.SendMsg(string(this.module.GetType()), "dare", &pb.MoonfantasyBattleResp{Code: cd})
|
||||||
}
|
// }
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ func (this *apiComp) Battle(session comm.IUserSession, req *pb.MoonfantasyBattle
|
|||||||
} else {
|
} else {
|
||||||
mdata.Record[session.GetUserId()] = 1
|
mdata.Record[session.GetUserId()] = 1
|
||||||
}
|
}
|
||||||
code, record = this.module.battle.CreatePvbBattle(session, &pb.BattlePVEReq{
|
cd, _ = this.module.battle.CreatePvbBattle(session, &pb.BattlePVEReq{
|
||||||
Ptype: pb.PlayType_moonfantasy,
|
Ptype: pb.PlayType_moonfantasy,
|
||||||
Leadpos: req.Leadpos,
|
Leadpos: req.Leadpos,
|
||||||
Teamids: req.Teamids,
|
Teamids: req.Teamids,
|
||||||
|
@ -592,7 +592,8 @@ func (this *DBModel) GetListObj(uid string, id string, data interface{}) (err er
|
|||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
pipe := this.Redis.RedisPipe(context.TODO())
|
pipe := this.Redis.RedisPipe(context.TODO())
|
||||||
dtype := reflect2.TypeOf(data).(*reflect2.UnsafeStructType)
|
// dtype := reflect2.TypeOf(data).(*reflect2.UnsafeStructType)
|
||||||
|
dtype := reflect2.TypeOf(data).(*reflect2.UnsafePtrType).Elem().(*reflect2.UnsafeStructType)
|
||||||
for c.Next(context.Background()) {
|
for c.Next(context.Background()) {
|
||||||
_id := c.Current.Lookup("_id").StringValue()
|
_id := c.Current.Lookup("_id").StringValue()
|
||||||
if _id != id {
|
if _id != id {
|
||||||
|
Loading…
Reference in New Issue
Block a user