上传战斗校验失败异常

This commit is contained in:
liwei 2023-07-11 17:50:51 +08:00
parent 8a21c0e476
commit 7b0826724e
3 changed files with 45 additions and 26 deletions

View File

@ -8,13 +8,13 @@ import (
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
) )
//参数校验 // 参数校验
func (this *apiComp) ChallengeRewardCheck(session comm.IUserSession, req *pb.ArenaChallengeRewardReq) (errdata *pb.ErrorData) { func (this *apiComp) ChallengeRewardCheck(session comm.IUserSession, req *pb.ArenaChallengeRewardReq) (errdata *pb.ErrorData) {
return return
} }
///挑战奖励领取 // /挑战奖励领取
func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaChallengeRewardReq) (errdata *pb.ErrorData) { func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaChallengeRewardReq) (errdata *pb.ErrorData) {
var ( var (
reward *cfg.GameArenaActiveRewardData reward *cfg.GameArenaActiveRewardData
@ -46,7 +46,7 @@ func (this *apiComp) ChallengeReward(session comm.IUserSession, req *pb.ArenaCha
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_BattleValidationFailed, Code: pb.ErrorCode_BattleValidationFailed,
Title: pb.ErrorCode_BattleValidationFailed.ToString(), Title: pb.ErrorCode_BattleValidationFailed.ToString(),
Message: err.Error(), Message: "CheckBattleReport check fail",
} }
return return
} }

View File

@ -39,17 +39,17 @@ type Chat struct {
modelChat *modelChatComp modelChat *modelChatComp
} }
//重构模块配置对象 // 重构模块配置对象
func (this *Chat) NewOptions() (options core.IModuleOptions) { func (this *Chat) NewOptions() (options core.IModuleOptions) {
return new(Options) return new(Options)
} }
//模块名 // 模块名
func (this *Chat) GetType() core.M_Modules { func (this *Chat) GetType() core.M_Modules {
return comm.ModuleChat return comm.ModuleChat
} }
//模块初始化接口 注册用户创建角色事件 // 模块初始化接口 注册用户创建角色事件
func (this *Chat) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { func (this *Chat) 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)
@ -73,7 +73,7 @@ func (this *Chat) Start() (err error) {
return return
} }
//装备组件 // 装备组件
func (this *Chat) OnInstallComp() { func (this *Chat) OnInstallComp() {
this.ModuleBase.OnInstallComp() this.ModuleBase.OnInstallComp()
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp) this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
@ -81,15 +81,15 @@ func (this *Chat) OnInstallComp() {
this.configure = this.RegisterComp(new(configureComp)).(*configureComp) this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
} }
//Event------------------------------------------------------------------------------------------------------------ // Event------------------------------------------------------------------------------------------------------------
func (this *Chat) EventUserOffline(uid, sessionid string) { func (this *Chat) EventUserOffline(uid, sessionid string) {
if err := this.modelChat.removeCrossChannelMember(uid); err != nil { if err := this.modelChat.removeCrossChannelMember(uid); err != nil {
this.Error("EventUserOffline", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()}) this.Error("EventUserOffline", log.Field{Key: "uid", Value: uid}, log.Field{Key: "err", Value: err.Error()})
} }
} }
//RPC-------------------------------------------------------------------------------------------------------------- // RPC--------------------------------------------------------------------------------------------------------------
//推送聊天消息 // 推送聊天消息
func (this *Chat) Rpc_ModuleChatPushChat(ctx context.Context, args *pb.DBChat, reply *pb.EmptyResp) (err error) { func (this *Chat) Rpc_ModuleChatPushChat(ctx context.Context, args *pb.DBChat, reply *pb.EmptyResp) (err error) {
var ( var (
max_chat int32 max_chat int32
@ -133,8 +133,8 @@ func (this *Chat) Rpc_ModuleChatPushChat(ctx context.Context, args *pb.DBChat, r
return return
} }
//对外接口---------------------------------------------------------------------------------------------------------- // 对外接口----------------------------------------------------------------------------------------------------------
//向世界频道发送聊天消息 // 向世界频道发送聊天消息
func (this *Chat) SendWorldChat(msg *pb.DBChat) (errdata *pb.ErrorData) { func (this *Chat) SendWorldChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
var ( var (
max_chat int32 max_chat int32
@ -173,7 +173,7 @@ func (this *Chat) SendWorldChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
return return
} }
//向工会发送聊天消息 // 向工会发送聊天消息
func (this *Chat) SendUnionChat(msg *pb.DBChat) (errdata *pb.ErrorData) { func (this *Chat) SendUnionChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
var ( var (
max_chat int32 max_chat int32
@ -212,7 +212,7 @@ func (this *Chat) SendUnionChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
return return
} }
//向个人发送聊天消息 // 向个人发送聊天消息
func (this *Chat) SendUserChat(msg *pb.DBChat) (errdata *pb.ErrorData) { func (this *Chat) SendUserChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
var ( var (
err error err error
@ -246,7 +246,7 @@ func (this *Chat) SendUserChat(msg *pb.DBChat) (errdata *pb.ErrorData) {
return return
} }
//广播系统消息 // 广播系统消息
func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata interface{}, value0 int32, value1 int32, agrs ...string) (errdata *pb.ErrorData) { func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata interface{}, value0 int32, value1 int32, agrs ...string) (errdata *pb.ErrorData) {
var ( var (
jsonStr []byte jsonStr []byte
@ -263,7 +263,9 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter
AppendInt: int64(st.Key), AppendInt: int64(st.Key),
AppendStrs: agrs, AppendStrs: agrs,
} }
if ctype == comm.ChatSystem3 { //装备分享
switch ctype {
case 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 {
@ -280,6 +282,23 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter
msg.AppendStr = string(jsonStr) msg.AppendStr = string(jsonStr)
} }
} }
case comm.ChatSystem7, comm.ChatSystem8, comm.ChatSystem9, comm.ChatSystem10, comm.ChatSystem11:
msg.Ctype = pb.ChatType_Share
if appenddata != nil {
if jsonStr, err = json.Marshal(appenddata); err != nil {
this.Errorf("err:%v", err)
} else {
data := map[string]interface{}{
agrs[1]: map[string]interface{}{
"key": agrs[1],
"appendStr": string(jsonStr),
"itemType": pb.ChatType_HeroShare,
},
}
jsonStr, _ = json.Marshal(data)
msg.AppendStr = string(jsonStr)
}
}
} }
if this.IsCross() { if this.IsCross() {
@ -307,7 +326,7 @@ func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, appenddata inter
return return
} }
//广播系统消息 // 广播系统消息
func (this *Chat) SendSysChatToUser(session comm.IUserSession, ctype comm.ChatSystemType, value0, value1 int32, agrs ...string) (errdata *pb.ErrorData) { func (this *Chat) SendSysChatToUser(session comm.IUserSession, ctype comm.ChatSystemType, value0, value1 int32, agrs ...string) (errdata *pb.ErrorData) {
if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value0, value1); ok { if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value0, value1); ok {
msg := &pb.DBChat{ msg := &pb.DBChat{
@ -320,8 +339,8 @@ func (this *Chat) SendSysChatToUser(session comm.IUserSession, ctype comm.ChatSy
return return
} }
//Push-------------------------------------------------------------------------------------------------------------- // Push--------------------------------------------------------------------------------------------------------------
//推送消息到世界 // 推送消息到世界
func (this *Chat) pushChatToWorld(msg *pb.DBChat) (err error) { func (this *Chat) pushChatToWorld(msg *pb.DBChat) (err error) {
data, _ := anypb.New(&pb.ChatMessagePush{Chat: msg}) data, _ := anypb.New(&pb.ChatMessagePush{Chat: msg})
if err = this.service.AcrossClusterBroadcast(context.Background(), msg.Stag, comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{ if err = this.service.AcrossClusterBroadcast(context.Background(), msg.Stag, comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{
@ -334,7 +353,7 @@ func (this *Chat) pushChatToWorld(msg *pb.DBChat) (err error) {
return return
} }
//推送消息到工会 // 推送消息到工会
func (this *Chat) pushChatToUnion(msg *pb.DBChat) (err error) { func (this *Chat) pushChatToUnion(msg *pb.DBChat) (err error) {
if members := this.sociaty.MembersBySociatyId(msg.UnionId); members != nil { if members := this.sociaty.MembersBySociatyId(msg.UnionId); members != nil {
users := make([]string, 0, len(members)) users := make([]string, 0, len(members))
@ -348,7 +367,7 @@ func (this *Chat) pushChatToUnion(msg *pb.DBChat) (err error) {
return return
} }
//推送私聊消息 // 推送私聊消息
func (this *Chat) pushChatToPrivate(msg *pb.DBChat) (err error) { func (this *Chat) pushChatToPrivate(msg *pb.DBChat) (err error) {
var ( var (
session comm.IUserSession session comm.IUserSession
@ -369,7 +388,7 @@ func (this *Chat) pushChatToPrivate(msg *pb.DBChat) (err error) {
return return
} }
//推送跨服频道消息 // 推送跨服频道消息
func (this *Chat) pushChatToCross(msg *pb.DBChat) (err error) { func (this *Chat) pushChatToCross(msg *pb.DBChat) (err error) {
var ( var (
users []*pb.CacheUser users []*pb.CacheUser
@ -383,7 +402,7 @@ func (this *Chat) pushChatToCross(msg *pb.DBChat) (err error) {
return return
} }
//推送系统消息 // 推送系统消息
func (this *Chat) pushChatToSystem(msg *pb.DBChat) (err error) { func (this *Chat) pushChatToSystem(msg *pb.DBChat) (err error) {
data, _ := anypb.New(&pb.ChatMessagePush{Chat: msg}) data, _ := anypb.New(&pb.ChatMessagePush{Chat: msg})
if err = this.service.ClusterBroadcast(context.Background(), comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{ if err = this.service.ClusterBroadcast(context.Background(), comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{

View File

@ -7,7 +7,7 @@ import (
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
) )
//参数校验 // 参数校验
func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.HeroStrengthenUplvReq) (errdata *pb.ErrorData) { func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.HeroStrengthenUplvReq) (errdata *pb.ErrorData) {
if req.HeroObjID == "" || len(req.Item) == 0 { if req.HeroObjID == "" || len(req.Item) == 0 {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
@ -20,7 +20,7 @@ func (this *apiComp) StrengthenUplvCheck(session comm.IUserSession, req *pb.Hero
return return
} }
/// 英雄升级 // / 英雄升级
func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStrengthenUplvReq) (errdata *pb.ErrorData) { func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStrengthenUplvReq) (errdata *pb.ErrorData) {
var ( var (
@ -96,7 +96,7 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren
//英雄升级 【玩家名称】已将【英雄名称】培养至60级 //英雄升级 【玩家名称】已将【英雄名称】培养至60级
if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { if user := this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.chat.SendSysChatToWorld(comm.ChatSystem7, nil, _hero.Lv, 0, user.Name, _hero.HeroID) this.chat.SendSysChatToWorld(comm.ChatSystem7, _hero, _hero.Lv, 0, user.Name, _hero.HeroID)
} else { } else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId()) this.module.Errorf("no found userdata uid:%s", session.GetUserId())
} }