错误采集优化

This commit is contained in:
liwei1dao 2023-05-31 17:49:01 +08:00
parent fa4b57748b
commit 1e7066a294
21 changed files with 314 additions and 59 deletions

View File

@ -30,6 +30,6 @@ func NewNotFoundConfErr(moduleName string, filename string, id interface{}) erro
} }
//执行外部模块异常 //执行外部模块异常
func NewExternalModuleErr(moduleName string, methodname string, parameter ...interface{}) error { func NewExternalModuleErr(moduleName string, methodname string, parameter interface{}) error {
return fmt.Errorf("执行外部模块错误 模块:%s ,配置文件:%s,目标数据:%v", moduleName, methodname, parameter) return fmt.Errorf("执行外部模块错误 模块:%s ,配置文件:%s,错误信息:%v", moduleName, methodname, parameter)
} }

View File

@ -22,11 +22,19 @@ func (this *apiComp) ChanageChannel(session comm.IUserSession, req *pb.ChatChana
if err, ok = this.module.modelChat.chanageChannel(session, req.ChannelId); err != nil { if err, ok = this.module.modelChat.chanageChannel(session, req.ChannelId); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if ok { if ok {
if err = this.module.modelChat.removeCrossChannelMember(session.GetUserId()); err != nil { if err = this.module.modelChat.removeCrossChannelMember(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{ this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{

View File

@ -22,6 +22,10 @@ func (this *apiComp) CrossChannel(session comm.IUserSession, req *pb.ChatCrossCh
} }
if channel, err = this.module.modelChat.addCrossChannelMember(session); err != nil { if channel, err = this.module.modelChat.addCrossChannelMember(session); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{ this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{

View File

@ -1,6 +1,7 @@
package chat package chat
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
) )
@ -29,18 +30,30 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
case pb.ChatChannel_World: case pb.ChatChannel_World:
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
break break
case pb.ChatChannel_Union: case pb.ChatChannel_Union:
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), req.UnionId, 0); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), req.UnionId, 0); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
break break
case pb.ChatChannel_Private: case pb.ChatChannel_Private:
if list, err = this.module.modelChat.queryUserMsg(session.GetUserId()); err != nil { if list, err = this.module.modelChat.queryUserMsg(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
break break
@ -48,26 +61,47 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil { if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if req.ChannelId != result.Chatchannel { if req.ChannelId != result.Chatchannel {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("req.ChannelId:%d != result.Chatchannel:%d", req.ChannelId, result.Chatchannel),
}
return return
} }
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
break break
case pb.ChatChannel_System: case pb.ChatChannel_System:
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil { if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
break break
default: default:
this.module.Errorf("不存在的聊天频道类型channel:%d ", req.Channel)
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
this.module.Errorf("getlist no support channel:%d ", req.Channel) data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("不存在的聊天频道类型 channel:%d ", req.Channel),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ChatGetListResp{Chats: list}) session.SendMsg(string(this.module.GetType()), "getlist", &pb.ChatGetListResp{Chats: list})

View File

@ -2,6 +2,7 @@ package chat
import ( import (
"context" "context"
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"go_dreamfactory/sys/wordfilter" "go_dreamfactory/sys/wordfilter"
@ -49,6 +50,10 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
if max_chat, err = this.module.configure.GetChannelRecordMax(); err != nil { if max_chat, err = this.module.configure.GetChannelRecordMax(); err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
@ -76,16 +81,6 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
go this.module.modelChat.sendChatToWorld(msg, max_chat) go this.module.modelChat.sendChatToWorld(msg, max_chat)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1) // this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype62, 1)) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype62, 1))
//随机任务
// if _, err = this.service.AcrossClusterRpcGo(
// context.Background(),
// session.GetServiecTag(),
// comm.Service_Worker,
// string(comm.Rpc_ModuleRtaskSendTask),
// pb.RPCRTaskReq{Uid: session.GetUserId(), TaskType: int32(comm.Rtype62), Param1: 1},
// nil); err != nil {
// this.module.Errorln(err)
// }
break break
case pb.ChatChannel_Union: case pb.ChatChannel_Union:
if msg.Ctype == pb.ChatType_Text { //过滤敏感词 if msg.Ctype == pb.ChatType_Text { //过滤敏感词
@ -120,8 +115,12 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype106, 1)) go this.module.ModuleBuried.TriggerBuried(session.GetUserId(), comm.GetBuriedParam(comm.Rtype106, 1))
break break
default: default:
this.module.Errorf("不存在的聊天频道类型channel:%d ", req.Channel)
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
this.module.Errorf("getlist no support channel:%d ", req.Channel) data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("不存在的聊天频道类型 channel:%d ", req.Channel),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "send", &pb.ChatSendResp{Issucc: true}) session.SendMsg(string(this.module.GetType()), "send", &pb.ChatSendResp{Issucc: true})

View File

@ -1,7 +1,7 @@
package chat package chat
import ( import (
"fmt" "go_dreamfactory/comm"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -62,13 +62,15 @@ func (this *configureComp) GetAutoIntoChannelMax() (max int32, err error) {
return return
} else { } else {
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["channel_allocation_max"]; !ok { if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["channel_allocation_max"]; !ok {
err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_allocation_max") err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_allocation_max")
// err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_allocation_max")
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
max = configure.Value max = configure.Value
if max <= 0 { if max <= 0 {
err = fmt.Errorf("cfg.GamechatChannelComData channel_allocation_max:%v", v) err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_allocation_max:0")
// err = fmt.Errorf("cfg.GamechatChannelComData channel_allocation_max:%v", v)
} }
} }
return return
@ -86,13 +88,15 @@ func (this *configureComp) GetChanageChannelMax() (max int32, err error) {
return return
} else { } else {
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["channel_switching_max"]; !ok { if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["channel_switching_max"]; !ok {
err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_switching_max") err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_switching_max")
// err = fmt.Errorf("cfg.Game_chatServerGroupData on found channel_switching_max")
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
max = configure.Value max = configure.Value
if max <= 0 { if max <= 0 {
err = fmt.Errorf("cfg.GamechatChannelComData channel_switching_max:%v", v) err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "channel_switching_max:0")
// err = fmt.Errorf("cfg.GamechatChannelComData channel_switching_max:%v", v)
} }
} }
return return
@ -110,13 +114,15 @@ func (this *configureComp) GetChannelRecordMax() (max int32, err error) {
return return
} else { } else {
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["max_chat"]; !ok { if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["max_chat"]; !ok {
err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat") // err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat")
this.module.Errorf("err:%v", err) err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "max_chat")
this.module.Errorln(err)
return return
} }
max = configure.Value max = configure.Value
if max <= 0 { if max <= 0 {
err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v) err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "max_chat:0")
// err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v)
} }
} }
return return
@ -134,13 +140,15 @@ func (this *configureComp) GetChannelReadRecordNum() (max int32, err error) {
return return
} else { } else {
if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["load_chat"]; !ok { if configure, ok = v.(*cfg.GameChatChannelCom).GetDataMap()["load_chat"]; !ok {
err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat") // err = fmt.Errorf("cfg.Game_chatServerGroupData on found max_chat")
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "load_chat")
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
max = configure.Value max = configure.Value
if max <= 0 { if max <= 0 {
err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v) // err = fmt.Errorf("cfg.GamechatChannelComData max_chat:%v", v)
err = comm.NewNotFoundConfErr(moduleName, game_chatchannelcom, "load_chat:0")
} }
} }
return return

View File

@ -16,6 +16,8 @@ import (
"google.golang.org/protobuf/types/known/anypb" "google.golang.org/protobuf/types/known/anypb"
) )
const moduleName = "聊天"
/* /*
模块名:论坛 模块名:论坛
描述:处理跨服社交论坛相关业务 描述:处理跨服社交论坛相关业务

View File

@ -1,6 +1,7 @@
package combat package combat
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -37,7 +38,12 @@ func (this *apiComp) AskPass(session comm.IUserSession, req *pb.CombatAskPassReq
} }
if level, ok = info.Level[req.Level]; !ok { if level, ok = info.Level[req.Level]; !ok {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
this.module.Errorf("no in Level:%s", req.Level) err = fmt.Errorf("没有目标关卡数据 req.Level: %d", req.Level)
this.module.Errorln(err)
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
@ -46,7 +52,7 @@ func (this *apiComp) AskPass(session comm.IUserSession, req *pb.CombatAskPassReq
code = pb.ErrorCode_ExternalModule code = pb.ErrorCode_ExternalModule
data = &pb.ErrorData{ data = &pb.ErrorData{
Title: code.ToString(), Title: code.ToString(),
Message: comm.NewExternalModuleErr("Buried", "CheckCondition", session.GetUserId(), lvconf.Maintask).Error(), Message: comm.NewExternalModuleErr("Buried", "CheckCondition", lvconf.Maintask).Error(),
} }
return return
} }

View File

@ -39,11 +39,19 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChalleng
} }
}() }()
if cd = this.ChallengeCheck(session, req); cd != pb.ErrorCode_Success { if cd = this.ChallengeCheck(session, req); cd != pb.ErrorCode_Success {
data = &pb.ErrorData{
Title: cd.ToString(),
Message: req.String(),
}
return return
} }
if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil { if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil {
cd = pb.ErrorCode_ConfigNoFound cd = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
cd, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{ cd, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{

View File

@ -1,6 +1,7 @@
package combat package combat
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -42,24 +43,45 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
if iswin { if iswin {
if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil { if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if lv, ok = info.Level[req.Level]; !ok { if lv, ok = info.Level[req.Level]; !ok {
err = fmt.Errorf("没有目标关卡数据 req.Level: %d", req.Level)
this.module.Errorln(err)
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
this.module.Errorf("no in Level:%s", req.Level) data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if lvconf, err = this.module.configure.getCombatLevel(req.Level); err != nil { if lvconf, err = this.module.configure.getCombatLevel(req.Level); err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil { if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
for _, v := range lv.Passmanster { for _, v := range lv.Passmanster {
if v == req.Manster { if v == req.Manster {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("req.Manster:%d 重复", code),
}
return return
} }
} }
@ -67,6 +89,10 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
lv.Passmanster = append(lv.Passmanster, req.Manster) lv.Passmanster = append(lv.Passmanster, req.Manster)
if err = this.module.modelCombat.updateInfo(info); err != nil { if err = this.module.modelCombat.updateInfo(info); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
@ -82,6 +108,10 @@ func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatC
lv.Progress = int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), lvconf.Debrisitemid)) lv.Progress = int32(this.module.ModuleItems.QueryItemAmount(session.GetUserId(), lvconf.Debrisitemid))
if err = this.module.modelCombat.updateInfo(info); err != nil { if err = this.module.modelCombat.updateInfo(info); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
} }

View File

@ -1,6 +1,7 @@
package equipment package equipment
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log" "go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb" "go_dreamfactory/pb"
@ -32,6 +33,10 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
} }
if conf, err = this.module.configure.getEquipenchanting(req.Itemid); err != nil { if conf, err = this.module.configure.getEquipenchanting(req.Itemid); err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
need = make([]*cfg.Gameatn, 0) need = make([]*cfg.Gameatn, 0)
@ -48,10 +53,18 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil { if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil {
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err) this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if equip.AdverbEntry[req.Index] == nil || equip.AdverbEntry[req.Index].AttrName != conf.Attrkey { if equip.AdverbEntry[req.Index] == nil || equip.AdverbEntry[req.Index].AttrName != conf.Attrkey {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
data = &pb.ErrorData{
Title: code.ToString(),
Message: req.String(),
}
return return
} }
AttrValue = rand.Int31n(conf.AttrMax-conf.AttrMini) + conf.AttrMini AttrValue = rand.Int31n(conf.AttrMax-conf.AttrMini) + conf.AttrMini
@ -64,12 +77,20 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
}); err != nil { }); err != nil {
log.Errorf("Upgrade err:%v", err) log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if equip.HeroId != "" { if equip.HeroId != "" {
equipments = make([]*pb.DB_Equipment, 8) equipments = make([]*pb.DB_Equipment, 8)
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equip.HeroId); code != pb.ErrorCode_Success { if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equip.HeroId); code != pb.ErrorCode_Success {
this.module.Errorf("Upgrade code:%d", code) this.module.Errorf("Upgrade code:%d", code)
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("英雄唯一 id:%s", equip.HeroId),
}
return return
} }
for i, v := range hero.EquipID { for i, v := range hero.EquipID {
@ -78,6 +99,10 @@ func (this *apiComp) Ench(session comm.IUserSession, req *pb.EquipmentEnchReq) (
if equipments[i], err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil { if equipments[i], err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil {
log.Errorf("Upgrade err:%v", err) log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_EquipmentOnFoundEquipment code = pb.ErrorCode_EquipmentOnFoundEquipment
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("装备唯一 id:%s", v),
}
return return
} }
} else { } else {

View File

@ -1,6 +1,7 @@
package equipment package equipment
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -35,6 +36,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
) )
if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success { if code = this.EquipCheck(session, req); code != pb.ErrorCode_Success {
data = &pb.ErrorData{
Title: code.ToString(),
Message: req.String(),
}
return return
} }
//校验数据 //校验数据
@ -43,6 +48,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
//获取英雄数据 //获取英雄数据
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), req.HeroCardId); code != pb.ErrorCode_Success { if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), req.HeroCardId); code != pb.ErrorCode_Success {
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("获取英雄数据失败:%s", req.HeroCardId),
}
return return
} }
@ -56,6 +65,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
} }
if equipments[i].HeroId != "" && hero.Id != equipments[i].HeroId { //装备已经有宿主了 if equipments[i].HeroId != "" && hero.Id != equipments[i].HeroId { //装备已经有宿主了
code = pb.ErrorCode_EquipmentIsWorn code = pb.ErrorCode_EquipmentIsWorn
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("装备已穿戴 装备id:%s 英雄id:%s", hero.Id, equipments[i].HeroId),
}
return return
} }
if minlv > equipments[i].Lv { if minlv > equipments[i].Lv {
@ -65,6 +78,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
if confs[i], err = this.module.configure.GetEquipmentConfigureById(equipments[i].CId); err != nil { if confs[i], err = this.module.configure.GetEquipmentConfigureById(equipments[i].CId); err != nil {
this.module.Errorf("Equip_Check err:%v", err) this.module.Errorf("Equip_Check err:%v", err)
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if minstr > confs[i].Star { if minstr > confs[i].Star {
@ -100,6 +117,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil { if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil {
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err) this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
equipment.HeroId = "" equipment.HeroId = ""
@ -109,6 +130,10 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil { if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), v); err != nil {
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err) this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), v, err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
equipment.HeroId = "" equipment.HeroId = ""
@ -170,40 +195,38 @@ func (this *apiComp) Equip(session comm.IUserSession, req *pb.EquipmentEquipReq)
//更新装备数据加成 //更新装备数据加成
if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code != pb.ErrorCode_Success { if code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments); code != pb.ErrorCode_Success {
this.module.Errorf("Equip ModuleHero UpdateEquipment code%v", code) this.module.Errorf("Equip ModuleHero UpdateEquipment code%v", code)
data = &pb.ErrorData{
Title: code.ToString(),
Message: comm.NewExternalModuleErr("ModuleHero", "UpdateEquipment", code).Error(),
}
return return
} }
//同步数据 //同步数据
if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil { if err = this.module.modelEquipment.UpdateByHeroId(session.GetUserId(), updatequipment...); err != nil {
this.module.Errorf("Equip err%v", err) this.module.Errorf("Equip err%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype5, equipNum, utils.ToInt32(hero.HeroID))) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype5, equipNum, utils.ToInt32(hero.HeroID)))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype5, utils.ToInt32(hero.HeroID), equipNum)
// for k, v := range equipStr {
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype41, 1, v, k))
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype41, utils.ToInt32(hero.HeroID), v, k)
// }
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype41, 1, equipNum, minstr)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype41, 1, equipNum, minstr))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, equipNum, minlv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, equipNum, minlv))
// for k, v := range equipLv {
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype42, 1, v, k))
// // this.module.ModuleRtask.SendToRtask(session, comm.Rtype42, utils.ToInt32(hero.HeroID), v, k)
// }
if hero.SuiteId != 0 { if hero.SuiteId != 0 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, hero.Suite1Star, hero.SuiteId)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, hero.Suite1Star, hero.SuiteId))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype169, hero.SuiteId)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype169, hero.SuiteId))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype49, 1, hero.Suite1Star, hero.Suite1Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
} }
if hero.SuiteExtId != 0 { if hero.SuiteExtId != 0 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, hero.Suite2Star, hero.SuiteExtId)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype46, 1, hero.Suite2Star, hero.SuiteExtId))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype98, 1, hero.Suite1Lv))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype98, 1, hero.Suite1Lv)
} }
if len(tasks) > 0 { if len(tasks) > 0 {

View File

@ -24,10 +24,18 @@ func (this *apiComp) Forg(session comm.IUserSession, req *pb.EquipmentForgReq) (
err error err error
) )
if code = this.ForgCheck(session, req); code != pb.ErrorCode_Success { if code = this.ForgCheck(session, req); code != pb.ErrorCode_Success {
data = &pb.ErrorData{
Title: code.ToString(),
Message: req.String(),
}
return return
} }
if conf, err = this.module.configure.GetEquipCompose(req.Forgid); err != nil { if conf, err = this.module.configure.GetEquipCompose(req.Forgid); err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
need = make([]*cfg.Gameatn, len(conf.Need)) need = make([]*cfg.Gameatn, len(conf.Need))

View File

@ -20,6 +20,10 @@ func (this *apiComp) Getlist(session comm.IUserSession, req *pb.EquipmentGetList
if items, err = this.module.modelEquipment.QueryUserEquipments(session.GetUserId()); err != nil { if items, err = this.module.modelEquipment.QueryUserEquipments(session.GetUserId()); err != nil {
this.module.Errorf("QueryUserPackReq err:%v", err) this.module.Errorf("QueryUserPackReq err:%v", err)
code = pb.ErrorCode_CacheReadError code = pb.ErrorCode_CacheReadError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "getlist", &pb.EquipmentGetListResp{Equipments: items}) session.SendMsg(string(this.module.GetType()), "getlist", &pb.EquipmentGetListResp{Equipments: items})

View File

@ -25,6 +25,10 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.EquipmentLockReq) (
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil { if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil {
this.module.Errorln(err) this.module.Errorln(err)
code = pb.ErrorCode_EquipmentOnFoundEquipment code = pb.ErrorCode_EquipmentOnFoundEquipment
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
equipment.Islock = req.IsLock equipment.Islock = req.IsLock
@ -33,6 +37,10 @@ func (this *apiComp) Lock(session comm.IUserSession, req *pb.EquipmentLockReq) (
}); err != nil { }); err != nil {
this.module.Errorln(err) this.module.Errorln(err)
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "lock", &pb.EquipmentLockResp{IsSucc: true, EquipmentId: req.EquipmentId, IsLock: req.IsLock}) session.SendMsg(string(this.module.GetType()), "lock", &pb.EquipmentLockResp{IsSucc: true, EquipmentId: req.EquipmentId, IsLock: req.IsLock})

View File

@ -1,6 +1,7 @@
package equipment package equipment
import ( import (
"fmt"
"go_dreamfactory/comm" "go_dreamfactory/comm"
"go_dreamfactory/pb" "go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -28,6 +29,10 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.EquipmentSellReq) (
} }
if equipments, err = this.module.modelEquipment.QueryUserEquipmentsByIds(session.GetUserId(), req.EquipIds); err != nil { if equipments, err = this.module.modelEquipment.QueryUserEquipmentsByIds(session.GetUserId(), req.EquipIds); err != nil {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
confs = make([]*cfg.GameEquipData, len(equipments)) confs = make([]*cfg.GameEquipData, len(equipments))
@ -36,15 +41,27 @@ func (this *apiComp) Sell(session comm.IUserSession, req *pb.EquipmentSellReq) (
if v.HeroId != "" || v.Islock { if v.HeroId != "" || v.Islock {
code = pb.ErrorCode_EquipmentNoCanSell code = pb.ErrorCode_EquipmentNoCanSell
this.module.Errorf("NoCanSell %v", v) this.module.Errorf("NoCanSell %v", v)
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("装备已锁定! 装备id:%s", v),
}
return return
} }
if confs[i], err = this.module.configure.GetEquipmentConfigureById(v.CId); err != nil { if confs[i], err = this.module.configure.GetEquipmentConfigureById(v.CId); err != nil {
this.module.Errorln(err) this.module.Errorln(err)
code = pb.ErrorCode_EquipmentOnFoundEquipment code = pb.ErrorCode_EquipmentOnFoundEquipment
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if confs[i].Sale == nil || len(confs[i].Sale) == 0 { if confs[i].Sale == nil || len(confs[i].Sale) == 0 {
code = pb.ErrorCode_EquipmentNoCanSell code = pb.ErrorCode_EquipmentNoCanSell
data = &pb.ErrorData{
Title: code.ToString(),
Message: fmt.Sprintf("装备出售配置为空! 装备id:%s", confs[i].Id),
}
return return
} }
sale[i] = make([]*cfg.Gameatn, len(confs[i].Sale)) sale[i] = make([]*cfg.Gameatn, len(confs[i].Sale))

View File

@ -38,22 +38,38 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0) tasks []*pb.BuriedParam = make([]*pb.BuriedParam, 0)
) )
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success { if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success {
data = &pb.ErrorData{
Title: code.ToString(),
Message: req.String(),
}
return return
} }
if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil { if equipment, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.EquipmentId); err != nil {
this.module.Errorf("Equip_Check err:%v", err) this.module.Errorf("Equip_Check err:%v", err)
code = pb.ErrorCode_EquipmentOnFoundEquipment code = pb.ErrorCode_EquipmentOnFoundEquipment
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if conf, err = this.module.configure.GetEquipmentConfigureById(equipment.CId); err != nil { if conf, err = this.module.configure.GetEquipmentConfigureById(equipment.CId); err != nil {
this.module.Errorf("Equip_Check err:%v", err) this.module.Errorf("Equip_Check err:%v", err)
code = pb.ErrorCode_EquipmentOnFoundEquipment code = pb.ErrorCode_EquipmentOnFoundEquipment
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
//找到下一个等级的相关配置 //找到下一个等级的相关配置
if intensify, err = this.module.configure.GetEquipmentIntensifyConfigureById(conf.EquipId, conf.Star, equipment.Lv); err != nil || intensify.Need == nil || len(intensify.Need) == 0 { if intensify, err = this.module.configure.GetEquipmentIntensifyConfigureById(conf.EquipId, conf.Star, equipment.Lv); err != nil || intensify.Need == nil || len(intensify.Need) == 0 {
this.module.Errorf("Equip_Check err:%v", err) this.module.Errorf("Equip_Check err:%v", err)
code = pb.ErrorCode_EquipmentLvlimitReached code = pb.ErrorCode_EquipmentLvlimitReached
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if code = this.module.ConsumeRes(session, intensify.Need, true); code != pb.ErrorCode_Success { if code = this.module.ConsumeRes(session, intensify.Need, true); code != pb.ErrorCode_Success {
@ -74,6 +90,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
}); err != nil { }); err != nil {
log.Errorf("Upgrade err:%v", err) log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
} }
@ -89,6 +109,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
}); err != nil { }); err != nil {
this.module.Errorf("Upgrade err:%v", err) this.module.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
modifyequipments = append(modifyequipments, equipment) modifyequipments = append(modifyequipments, equipment)
@ -99,12 +123,20 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
modifyequipments = append(modifyequipments, equipment) modifyequipments = append(modifyequipments, equipment)
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil { if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
this.module.Errorf("Upgrade err:%v", err) this.module.Errorf("Upgrade err:%v", err)
return return
} }
if err = this.module.modelEquipment.AddList(session.GetUserId(), equipment.Id, equipment); err != nil { if err = this.module.modelEquipment.AddList(session.GetUserId(), equipment.Id, equipment); err != nil {
this.module.Errorf("Upgrade err:%v", err) this.module.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
} else { } else {
@ -113,6 +145,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil { if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil {
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
this.module.Errorf("Upgrade err:%v", err) this.module.Errorf("Upgrade err:%v", err)
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if err = this.module.modelEquipment.ChangeList(session.GetUserId(), equipment.Id, map[string]interface{}{ if err = this.module.modelEquipment.ChangeList(session.GetUserId(), equipment.Id, map[string]interface{}{
@ -125,6 +161,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
}); err != nil { }); err != nil {
log.Errorf("Upgrade err:%v", err) log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
} }
@ -134,11 +174,17 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
if equipment.HeroId != "" { if equipment.HeroId != "" {
if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equipment.HeroId); code != pb.ErrorCode_Success { if hero, code = this.module.ModuleHero.GetHeroByObjID(session.GetUserId(), equipment.HeroId); code != pb.ErrorCode_Success {
this.module.Errorf("Upgrade code:%d", code) this.module.Errorf("Upgrade code:%d", code)
data = &pb.ErrorData{
Title: code.ToString(),
}
return return
} }
if conf.Pos >= 8 { if conf.Pos >= 8 {
code = pb.ErrorCode_ConfigurationException code = pb.ErrorCode_ConfigurationException
this.module.Errorf("Upgrade equipment Pos:%d", conf.Pos) this.module.Errorf("Upgrade equipment Pos:%d", conf.Pos)
data = &pb.ErrorData{
Title: code.ToString(),
}
return return
} }
hero.EquipID[conf.Pos] = equipment.Id //拆分后的装备是一个新的 hero.EquipID[conf.Pos] = equipment.Id //拆分后的装备是一个新的
@ -182,32 +228,21 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
} }
//随机任务触发 //随机任务触发
tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype43, equipment.Id, equipment.Lv)) tasks = append(tasks, comm.GetBuriedParam2(comm.Rtype43, equipment.Id, equipment.Lv))
// tasks = append(tasks, comm.GetBuriedParam(comm.Rtype44, 1, equipment.Lv))
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype47, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype47, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype44, equipment.Lv)
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype47, 1)
if conf.Pos == 7 { if conf.Pos == 7 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype102, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype102, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype102, 1)
} else if conf.Pos == 6 { } else if conf.Pos == 6 {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype100, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype100, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype100, 1)
} }
//聊天系统通知 //聊天系统通知
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil { 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.ChatSystem3, equipment, equipment.Lv, 0, user.Name, conf.Id) this.module.chat.SendSysChatToWorld(comm.ChatSystem3, equipment, equipment.Lv, 0, user.Name, conf.Id)
// } else {
// this.module.Errorf("GetColor err:%s", err.Error())
// }
} else { } else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId()) this.module.Errorf("no found userdata uid:%s", session.GetUserId())
} }
} else { } else {
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype96, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype96, 1))
// this.module.ModuleRtask.SendToRtask(session, comm.Rtype96, 1)
} }
tasks = append(tasks, comm.GetBuriedParam(comm.Rtype92, 1)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype92, 1))
if len(tasks) > 0 { if len(tasks) > 0 {

View File

@ -26,16 +26,28 @@ func (this *apiComp) Wash(session comm.IUserSession, req *pb.EquipmentWashReq) (
err error err error
) )
if code = this.WashCheck(session, req); code != pb.ErrorCode_Success { if code = this.WashCheck(session, req); code != pb.ErrorCode_Success {
data = &pb.ErrorData{
Title: code.ToString(),
Message: req.String(),
}
return return
} }
if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil { if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil {
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err) this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if conf, err = this.module.configure.GetEquipmentConfigureById(equip.CId); err != nil { if conf, err = this.module.configure.GetEquipmentConfigureById(equip.CId); err != nil {
this.module.Errorf("Equip_Check err:%v", err) this.module.Errorf("Equip_Check err:%v", err)
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.Color-1] gole := this.module.ModuleTools.GetGlobalConf().EquipmentConsumption[conf.Color-1]

View File

@ -23,20 +23,36 @@ func (this *apiComp) WashConfirm(session comm.IUserSession, req *pb.EquipmentWas
err error err error
) )
if code = this.WashConfirmCheck(session, req); code != pb.ErrorCode_Success { if code = this.WashConfirmCheck(session, req); code != pb.ErrorCode_Success {
data = &pb.ErrorData{
Title: code.ToString(),
Message: req.String(),
}
return return
} }
if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil { if equip, err = this.module.modelEquipment.QueryUserEquipmentsById(session.GetUserId(), req.Eid); err != nil {
this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err) this.module.Errorf("Equip reader uid:%s equipment:%s err:%v", session.GetUserId(), req.Eid, err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
if len(equip.AdverbEntry) != len(req.Pids) { if len(equip.AdverbEntry) != len(req.Pids) {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
data = &pb.ErrorData{
Title: code.ToString(),
}
return return
} }
for i, v := range equip.AdverbEntry { for i, v := range equip.AdverbEntry {
if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(req.Pids[i]); err != nil { if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(req.Pids[i]); err != nil {
code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
equip.AdverbEntry[i] = &pb.EquipmentAttributeEntry{ equip.AdverbEntry[i] = &pb.EquipmentAttributeEntry{
@ -53,6 +69,10 @@ func (this *apiComp) WashConfirm(session comm.IUserSession, req *pb.EquipmentWas
}); err != nil { }); err != nil {
log.Errorf("Upgrade err:%v", err) log.Errorf("Upgrade err:%v", err)
code = pb.ErrorCode_SystemError code = pb.ErrorCode_SystemError
data = &pb.ErrorData{
Title: code.ToString(),
Message: err.Error(),
}
return return
} }
session.SendMsg(string(this.module.GetType()), "washconfirm", &pb.EquipmentWashConfirmResp{Issucc: true}) session.SendMsg(string(this.module.GetType()), "washconfirm", &pb.EquipmentWashConfirmResp{Issucc: true})

View File

@ -2,6 +2,7 @@ package equipment
import ( import (
"fmt" "fmt"
"go_dreamfactory/comm"
"go_dreamfactory/modules" "go_dreamfactory/modules"
"go_dreamfactory/sys/configure" "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -122,9 +123,7 @@ func (this *configureComp) GetEquipmentConfigureByIds(equipmentId []string) (con
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} else { } else {
configure = make([]*cfg.GameEquipData, len(equipmentId)) configure = make([]*cfg.GameEquipData, len(equipmentId))
for i, v := range equipmentId { for i, v := range equipmentId {
if c, ok = t.(*cfg.GameEquip).GetDataMap()[v]; ok { if c, ok = t.(*cfg.GameEquip).GetDataMap()[v]; ok {
configure[i] = c configure[i] = c
@ -165,8 +164,8 @@ func (this *configureComp) GetEquipmentAttrlibraryConfigureByKey(key int32) (con
return return
} else { } else {
if configure, ok = v.(*cfg.GameEquipAttrlibraryS).GetDataMap()[key]; !ok { if configure, ok = v.(*cfg.GameEquipAttrlibraryS).GetDataMap()[key]; !ok {
err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, key)
err = fmt.Errorf("EquipmentConfigure GetEquipmentAttrlibraryConfigureByKey not found:%d ", key) // err = fmt.Errorf("EquipmentConfigure GetEquipmentAttrlibraryConfigureByKey not found:%d ", key)
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
@ -270,7 +269,8 @@ func (this *configureComp) getEquipAttribute(sid string) (result *cfg.GameEquipA
return return
} else { } else {
if result, ok = v.(*cfg.GameEquipAttribute).GetDataMap()[sid]; !ok { if result, ok = v.(*cfg.GameEquipAttribute).GetDataMap()[sid]; !ok {
err = fmt.Errorf("on found getEquipAttribute id:%s", sid) // err = fmt.Errorf("on found getEquipAttribute id:%s", sid)
err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, sid)
this.module.Errorf("err:%v", err) this.module.Errorf("err:%v", err)
return return
} }
@ -289,7 +289,8 @@ func (this *configureComp) getEquipenchanting(id string) (result *cfg.GameEquipE
return return
} else { } else {
if result, ok = v.(*cfg.GameEquipEnchanting).GetDataMap()[id]; !ok { if result, ok = v.(*cfg.GameEquipEnchanting).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found getEquipenchanting id:%s", id) err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, id)
// err = fmt.Errorf("on found getEquipenchanting id:%s", id)
return return
} }
} }
@ -307,7 +308,8 @@ func (this *configureComp) getSellcoefficient(id int32) (result *cfg.GameSellCoe
return return
} else { } else {
if result, ok = v.(*cfg.GameSellCoefficient).GetDataMap()[id]; !ok { if result, ok = v.(*cfg.GameSellCoefficient).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found getSellcoefficient id:%d", id) err = comm.NewNotFoundConfErr(moduleName, equip_attrlibrary, id)
// err = fmt.Errorf("on found getSellcoefficient id:%d", id)
return return
} }
} }

View File

@ -14,6 +14,8 @@ import (
"github.com/go-redis/redis/v8" "github.com/go-redis/redis/v8"
) )
const moduleName = "装备"
/* /*
模块名:装备 模块名:装备
描述:用户装备管理以及装备升级强化相关 描述:用户装备管理以及装备升级强化相关