上传聊天系统公告
This commit is contained in:
parent
6d38ab1255
commit
f697811733
@ -541,14 +541,21 @@ const (
|
|||||||
type ChatSystemType int8
|
type ChatSystemType int8
|
||||||
|
|
||||||
const (
|
const (
|
||||||
///定时公告
|
ChatSystem1 ChatSystemType = 1 ///定时公告
|
||||||
TimedNotice ChatSystemType = 1
|
ChatSystem2 ChatSystemType = 2 ///登录公告
|
||||||
///用户登录通告
|
ChatSystem3 ChatSystemType = 3 ///装备升级公告
|
||||||
UserLoginNotice ChatSystemType = 2
|
ChatSystem4 ChatSystemType = 4 ///爬塔公告
|
||||||
///装备强化公告
|
ChatSystem5 ChatSystemType = 5 ///停机维护公告
|
||||||
EquipmentUpgradeNotice ChatSystemType = 3
|
ChatSystem10 ChatSystemType = 6 ///通关了赛季塔 【玩家名称】通关了赛季塔50层!
|
||||||
///爬塔通关公告
|
ChatSystem11 ChatSystemType = 7 ///英雄升级 【玩家名称】已将【英雄名称】培养至60级!
|
||||||
PagodaPassNotice ChatSystemType = 4
|
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!
|
||||||
)
|
)
|
||||||
|
|
||||||
// 巨兽列车
|
// 巨兽列车
|
||||||
|
@ -195,9 +195,9 @@ type (
|
|||||||
//推送消息到用户
|
//推送消息到用户
|
||||||
SendUserChat(msg *pb.DBChat) (code pb.ErrorCode)
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
//战斗系统
|
//战斗系统
|
||||||
|
@ -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()
|
this.lock.RLock()
|
||||||
vs, ok := this.chatsystem[ctype]
|
vs, ok := this.chatsystem[ctype]
|
||||||
this.lock.RUnlock()
|
this.lock.RUnlock()
|
||||||
if ok {
|
if ok {
|
||||||
for _, v := range vs {
|
for _, v := range vs {
|
||||||
if v.Data == value {
|
if v.Data == value0 && v.Data2 == value1 {
|
||||||
return v, true
|
return v, true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package chat
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"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 (
|
var (
|
||||||
jsonStr []byte
|
jsonStr []byte
|
||||||
err error
|
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{
|
msg := &pb.DBChat{
|
||||||
Channel: pb.ChatChannel_System,
|
Channel: pb.ChatChannel_System,
|
||||||
Ctype: pb.ChatType_Text,
|
Ctype: pb.ChatType_Text,
|
||||||
@ -233,7 +232,7 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter
|
|||||||
AppendInt: int64(st.Key),
|
AppendInt: int64(st.Key),
|
||||||
AppendStrs: agrs,
|
AppendStrs: agrs,
|
||||||
}
|
}
|
||||||
if ctype == comm.EquipmentUpgradeNotice { //装备分享
|
if ctype == comm.ChatSystem3 { //装备分享
|
||||||
msg.Ctype = pb.ChatType_Share
|
msg.Ctype = pb.ChatType_Share
|
||||||
if appenddata != nil {
|
if appenddata != nil {
|
||||||
if jsonStr, err = json.Marshal(appenddata); err != 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) {
|
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), value); ok {
|
if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value0, value1); ok {
|
||||||
msg := &pb.DBChat{
|
msg := &pb.DBChat{
|
||||||
Channel: pb.ChatChannel_System,
|
Channel: pb.ChatChannel_System,
|
||||||
Ctime: time.Now().Unix(),
|
Ctime: time.Now().Unix(),
|
||||||
Content: fmt.Sprintf(st.Text, agrs...),
|
AppendInt: int64(st.Key),
|
||||||
}
|
}
|
||||||
session.SendMsg(string(this.GetType()), "message", &pb.ChatMessagePush{Chat: msg})
|
session.SendMsg(string(this.GetType()), "message", &pb.ChatMessagePush{Chat: msg})
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
|
|||||||
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
||||||
// var color *cfg.GameGameColorData
|
// var color *cfg.GameGameColorData
|
||||||
// if color, err = this.module.configure.GetColor(conf.Color); err == nil {
|
// 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 {
|
// } else {
|
||||||
// this.module.Errorf("GetColor err:%s", err.Error())
|
// this.module.Errorf("GetColor err:%s", err.Error())
|
||||||
// }
|
// }
|
||||||
|
@ -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})
|
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
||||||
|
|
||||||
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
|
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 {
|
} else {
|
||||||
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ func (this *ChatComp) Start() (err error) {
|
|||||||
confs := v.(*cfg.GameChatSystem)
|
confs := v.(*cfg.GameChatSystem)
|
||||||
|
|
||||||
for _, v1 := range confs.GetDataMap() {
|
for _, v1 := range confs.GetDataMap() {
|
||||||
if v1.Type == int32(comm.TimedNotice) { //处理定时任务
|
if v1.Type == int32(comm.ChatSystem1) { //处理定时任务
|
||||||
weekStr := ""
|
weekStr := ""
|
||||||
for _, w := range v1.Week {
|
for _, w := range v1.Week {
|
||||||
weekStr += fmt.Sprintf("%d,", w)
|
weekStr += fmt.Sprintf("%d,", w)
|
||||||
|
@ -151,7 +151,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
|
|||||||
// 检查特权 并发送每日邮件
|
// 检查特权 并发送每日邮件
|
||||||
this.module.ModulePrivilege.QueryPrivilege(session)
|
this.module.ModulePrivilege.QueryPrivilege(session)
|
||||||
//推送登录公告
|
//推送登录公告
|
||||||
this.chat.SendSysChatToUser(session, comm.UserLoginNotice, 0)
|
this.chat.SendSysChatToUser(session, comm.ChatSystem2, 0, 0)
|
||||||
mail := &pb.DBMailData{
|
mail := &pb.DBMailData{
|
||||||
ObjId: primitive.NewObjectID().Hex(),
|
ObjId: primitive.NewObjectID().Hex(),
|
||||||
Uid: user.Uid,
|
Uid: user.Uid,
|
||||||
|
Loading…
Reference in New Issue
Block a user