linestory errdata
This commit is contained in:
parent
015c649c04
commit
06b5855745
@ -17,8 +17,6 @@ func (this *apiComp) Chapter(session comm.IUserSession, req *pb.LinestoryChapter
|
|||||||
TaskChapter: taskMap,
|
TaskChapter: taskMap,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), LinestorySubTypeChapter, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), LinestorySubTypeChapter, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,7 @@ func (this *apiComp) Maintask(session comm.IUserSession, req *pb.LinestoryMainta
|
|||||||
List: list,
|
List: list,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := session.SendMsg(string(this.module.GetType()), LinestorySubTypeMaintask, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), LinestorySubTypeMaintask, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,8 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive
|
|||||||
if conf == nil {
|
if conf == nil {
|
||||||
this.module.Error("配置未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId})
|
this.module.Error("配置未找到", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId})
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_ConfigNoFound,
|
Code: pb.ErrorCode_ConfigNoFound,
|
||||||
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
Title: pb.ErrorCode_ConfigNoFound.ToString(),
|
||||||
Message: err.Error(),
|
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -39,7 +38,12 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive
|
|||||||
if err := this.module.modelLinestory.receive(uid, req.ChapterId); err != nil {
|
if err := this.module.modelLinestory.receive(uid, req.ChapterId); err != nil {
|
||||||
var customErr = new(comm.CustomError)
|
var customErr = new(comm.CustomError)
|
||||||
if errors.As(err, &customErr) {
|
if errors.As(err, &customErr) {
|
||||||
code = customErr.Code
|
code := customErr.Code
|
||||||
|
errdata = &pb.ErrorData{
|
||||||
|
Code: code,
|
||||||
|
Title: code.ToString(),
|
||||||
|
Message: err.Error(),
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
errdata = &pb.ErrorData{
|
errdata = &pb.ErrorData{
|
||||||
Code: pb.ErrorCode_DBError,
|
Code: pb.ErrorCode_DBError,
|
||||||
@ -47,7 +51,7 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive
|
|||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.module.Error("章节奖励领取失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId}, log.Field{Key: "code", Value: code})
|
this.module.Error("章节奖励领取失败", log.Field{Key: "uid", Value: uid}, log.Field{Key: "chapterId", Value: req.ChapterId})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +67,6 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.LinestoryReceive
|
|||||||
ChapterId: req.ChapterId,
|
ChapterId: req.ChapterId,
|
||||||
UserAssets: utils.ConvertReward(conf.Reward...),
|
UserAssets: utils.ConvertReward(conf.Reward...),
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.module.GetType()), LinestorySubTypeReceive, rsp); err != nil {
|
session.SendMsg(string(this.module.GetType()), LinestorySubTypeReceive, rsp)
|
||||||
code = pb.ErrorCode_SystemError
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user