diff --git a/comm/const.go b/comm/const.go index f1cde8be9..0d95dc788 100644 --- a/comm/const.go +++ b/comm/const.go @@ -541,14 +541,21 @@ const ( type ChatSystemType int8 const ( - ///定时公告 - TimedNotice ChatSystemType = 1 - ///用户登录通告 - UserLoginNotice ChatSystemType = 2 - ///装备强化公告 - EquipmentUpgradeNotice ChatSystemType = 3 - ///爬塔通关公告 - PagodaPassNotice ChatSystemType = 4 + ChatSystem1 ChatSystemType = 1 ///定时公告 + ChatSystem2 ChatSystemType = 2 ///登录公告 + ChatSystem3 ChatSystemType = 3 ///装备升级公告 + ChatSystem4 ChatSystemType = 4 ///爬塔公告 + ChatSystem5 ChatSystemType = 5 ///停机维护公告 + ChatSystem10 ChatSystemType = 6 ///通关了赛季塔 【玩家名称】通关了赛季塔50层! + ChatSystem11 ChatSystemType = 7 ///英雄升级 【玩家名称】已将【英雄名称】培养至60级! + ChatSystem12 ChatSystemType = 8 ///英雄升星 【玩家名称】已将【英雄名称】培养至6星! + ChatSystem13 ChatSystemType = 9 ///英雄技能培养 【玩家名称】已将【英雄名称】技能培养至满级! + ChatSystem14 ChatSystemType = 10 ///英雄共鸣 【玩家名称】已将【英雄名称】共鸣至满级! + ChatSystem15 ChatSystemType = 11 ///英雄觉醒 【玩家名称】已将【英雄名称】觉醒至满级! + ChatSystem16 ChatSystemType = 12 ///玩家升级 【玩家名称】达到了60级! + ChatSystem17 ChatSystemType = 13 ///英雄招募 【玩家名称】在招募中获得了【英雄名称】! + ChatSystem18 ChatSystemType = 14 ///维京远征 【玩家名称】通关了火焰泰坦难度16! + ChatSystem24 ChatSystemType = 15 ///狩猎 【玩家名称】通关了巨型猩猩难度8! ) // 巨兽列车 diff --git a/comm/imodule.go b/comm/imodule.go index 7d570d645..5a6229c19 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -195,9 +195,9 @@ type ( //推送消息到用户 SendUserChat(msg *pb.DBChat) (code pb.ErrorCode) //广播系统消息 - SendSysChatToWorld(ctype ChatSystemType, appenddata interface{}, value int32, agrs ...string) (code pb.ErrorCode) + SendSysChatToWorld(ctype ChatSystemType, appenddata interface{}, value0, value1 int32, agrs ...string) (code pb.ErrorCode) //广播系统消息 - SendSysChatToUser(session IUserSession, ctype ChatSystemType, value int32, agrs ...interface{}) (code pb.ErrorCode) + SendSysChatToUser(session IUserSession, ctype ChatSystemType, value0, value1 int32, agrs ...string) (code pb.ErrorCode) } //战斗系统 diff --git a/modules/chat/configure.go b/modules/chat/configure.go index 2518e81de..977f301d6 100644 --- a/modules/chat/configure.go +++ b/modules/chat/configure.go @@ -147,13 +147,13 @@ func (this *configureComp) GetChannelReadRecordNum() (max int32, err error) { } ///获取校验聊天系统推送 -func (this *configureComp) GetCheckChatSystem(ctype int32, value int32) (sitem *cfg.GameChatSystemData, ok bool) { +func (this *configureComp) GetCheckChatSystem(ctype int32, value0 int32, value1 int32) (sitem *cfg.GameChatSystemData, ok bool) { this.lock.RLock() vs, ok := this.chatsystem[ctype] this.lock.RUnlock() if ok { for _, v := range vs { - if v.Data == value { + if v.Data == value0 && v.Data2 == value1 { return v, true } } diff --git a/modules/chat/module.go b/modules/chat/module.go index b7c0d592f..e0c409ad9 100644 --- a/modules/chat/module.go +++ b/modules/chat/module.go @@ -2,7 +2,6 @@ package chat import ( "context" - "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" @@ -217,12 +216,12 @@ func (this *Chat) SendUserChat(msg *pb.DBChat) (code pb.ErrorCode) { } //广播系统消息 -func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata interface{}, value int32, agrs ...string) (code pb.ErrorCode) { +func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata interface{}, value0 int32, value1 int32, agrs ...string) (code pb.ErrorCode) { var ( jsonStr []byte err error ) - if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value); ok { + if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value0, value1); ok { msg := &pb.DBChat{ Channel: pb.ChatChannel_System, Ctype: pb.ChatType_Text, @@ -233,7 +232,7 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter AppendInt: int64(st.Key), AppendStrs: agrs, } - if ctype == comm.EquipmentUpgradeNotice { //装备分享 + if ctype == comm.ChatSystem3 { //装备分享 msg.Ctype = pb.ChatType_Share if appenddata != nil { if jsonStr, err = json.Marshal(appenddata); err != nil { @@ -274,12 +273,12 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter } //广播系统消息 -func (this *Chat) SendSysChatToUser(session comm.IUserSession, ctype comm.ChatSystemType, value int32, agrs ...interface{}) (code pb.ErrorCode) { - if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value); ok { +func (this *Chat) SendSysChatToUser(session comm.IUserSession, ctype comm.ChatSystemType, value0, value1 int32, agrs ...string) (code pb.ErrorCode) { + if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value0, value1); ok { msg := &pb.DBChat{ - Channel: pb.ChatChannel_System, - Ctime: time.Now().Unix(), - Content: fmt.Sprintf(st.Text, agrs...), + Channel: pb.ChatChannel_System, + Ctime: time.Now().Unix(), + AppendInt: int64(st.Key), } session.SendMsg(string(this.GetType()), "message", &pb.ChatMessagePush{Chat: msg}) } diff --git a/modules/equipment/api_upgrade.go b/modules/equipment/api_upgrade.go index 6a5f70ec8..f00949912 100644 --- a/modules/equipment/api_upgrade.go +++ b/modules/equipment/api_upgrade.go @@ -189,7 +189,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { // var color *cfg.GameGameColorData // if color, err = this.module.configure.GetColor(conf.Color); err == nil { - this.module.chat.SendSysChatToWorld(comm.EquipmentUpgradeNotice, equipment, equipment.Lv, user.Name, conf.Id) + this.module.chat.SendSysChatToWorld(comm.ChatSystem5, equipment, equipment.Lv, 0, user.Name, conf.Id) // } else { // this.module.Errorf("GetColor err:%s", err.Error()) // } diff --git a/modules/pagoda/api_challengeover.go b/modules/pagoda/api_challengeover.go index d023af708..264876d34 100644 --- a/modules/pagoda/api_challengeover.go +++ b/modules/pagoda/api_challengeover.go @@ -90,7 +90,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda}) if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { - this.chat.SendSysChatToWorld(comm.EquipmentUpgradeNotice, nil, pagoda.PagodaId, user.Name) + this.chat.SendSysChatToWorld(comm.ChatSystem4, nil, pagoda.PagodaId, 0, user.Name) } else { this.module.Errorf("no found userdata uid:%s", session.GetUserId()) } diff --git a/modules/timer/chat.go b/modules/timer/chat.go index 331f8ea61..105fc9db7 100644 --- a/modules/timer/chat.go +++ b/modules/timer/chat.go @@ -55,7 +55,7 @@ func (this *ChatComp) Start() (err error) { confs := v.(*cfg.GameChatSystem) for _, v1 := range confs.GetDataMap() { - if v1.Type == int32(comm.TimedNotice) { //处理定时任务 + if v1.Type == int32(comm.ChatSystem1) { //处理定时任务 weekStr := "" for _, w := range v1.Week { weekStr += fmt.Sprintf("%d,", w) diff --git a/modules/user/api_login.go b/modules/user/api_login.go index b67b79957..52fa79c28 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -151,7 +151,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod // 检查特权 并发送每日邮件 this.module.ModulePrivilege.QueryPrivilege(session) //推送登录公告 - this.chat.SendSysChatToUser(session, comm.UserLoginNotice, 0) + this.chat.SendSysChatToUser(session, comm.ChatSystem2, 0, 0) mail := &pb.DBMailData{ ObjId: primitive.NewObjectID().Hex(), Uid: user.Uid,