reputation errdata
This commit is contained in:
parent
06b5855745
commit
125f4b30f7
@ -17,7 +17,10 @@ func (this *apiComp) Getattrs(session comm.IUserSession, req *pb.ReputationTalen
|
||||
|
||||
reputation := this.module.modelReputation.getDBReputation(uid)
|
||||
if reputation == nil {
|
||||
code = pb.ErrorCode_DataNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DataNotFound,
|
||||
Title: pb.ErrorCode_DataNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,10 @@ func (this *apiComp) Reset(session comm.IUserSession, req *pb.ReputationTalentre
|
||||
uid := session.GetUserId()
|
||||
reputation := this.module.modelReputation.getDBReputation(uid)
|
||||
if reputation == nil {
|
||||
code = pb.ErrorCode_DataNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DataNotFound,
|
||||
Title: pb.ErrorCode_DataNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.ReputationUpgrad
|
||||
|
||||
reputation := this.module.modelReputation.getDBReputation(uid)
|
||||
if reputation == nil {
|
||||
code = pb.ErrorCode_DataNotFound
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_DataNotFound,
|
||||
Title: pb.ErrorCode_DataNotFound.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -43,7 +46,6 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.ReputationUpgrad
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ConfigNoFound,
|
||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||
Message: err.Error(),
|
||||
}
|
||||
return
|
||||
}
|
||||
@ -55,7 +57,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.ReputationUpgrad
|
||||
if camp != nil {
|
||||
if len(camp.Nodes) == 0 {
|
||||
//消耗
|
||||
if c := this.module.ConsumeRes(session, talentCfg.IconCos, true); c == pb.ErrorCode_Success {
|
||||
if c := this.module.ConsumeRes(session, talentCfg.IconCos, true); c == nil {
|
||||
camp.Nodes = append(camp.Nodes, &pb.TalentNode{
|
||||
Nid: req.NodeId,
|
||||
Lv: 1,
|
||||
@ -67,15 +69,21 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.ReputationUpgrad
|
||||
for _, v := range camp.Nodes {
|
||||
//判断是否满级
|
||||
if req.NodeId == v.Nid && v.Status == 2 {
|
||||
code = pb.ErrorCode_ReputationTalentFull
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReputationTalentFull,
|
||||
Title: pb.ErrorCode_ReputationTalentFull.ToString(),
|
||||
}
|
||||
return
|
||||
} else if req.NodeId == v.Nid {
|
||||
if !this.module.modelReputation.isReachPreNode(reputation, req.RaceType, talentCfg.PreNode, talentCfg.PreNodeLv) {
|
||||
code = pb.ErrorCode_ReputationNoPreNodeLv
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_ReputationNoPreNodeLv,
|
||||
Title: pb.ErrorCode_ReputationNoPreNodeLv.ToString(),
|
||||
}
|
||||
return
|
||||
}
|
||||
//消耗
|
||||
if c := this.module.ConsumeRes(session, talentCfg.IconCos, true); c == pb.ErrorCode_Success {
|
||||
if c := this.module.ConsumeRes(session, talentCfg.IconCos, true); c == nil {
|
||||
|
||||
v.Lv++
|
||||
camp.CampAttr = this.module.modelReputation.computeAttr(camp.CampAttr, talentCfg.Attribute)
|
||||
|
Loading…
Reference in New Issue
Block a user