上传配置未找到错误

This commit is contained in:
liwei1dao 2023-05-26 12:10:36 +08:00
parent be6df0efd0
commit fc2f667599
4 changed files with 14 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package comm package comm
import ( import (
"fmt"
"go_dreamfactory/pb" "go_dreamfactory/pb"
"github.com/pkg/errors" "github.com/pkg/errors"
@ -22,3 +23,8 @@ func NewCustomError(code pb.ErrorCode) error {
Message: code.String(), Message: code.String(),
}, "") }, "")
} }
//创建配置表错误对象
func NewNotFoundConfErr(moduleName string, filename string, id interface{}) error {
return fmt.Errorf("服务端配置未找到!模块:%s ,配置文件:%s,目标数据:%v", moduleName, filename, id)
}

View File

@ -34,6 +34,10 @@ func (this *apiComp) Receive(session comm.IUserSession, req *pb.AcademyReceiveRe
} }
if level, err = this.module.configure.getGameTeaching(req.Level); err != nil { if level, err = this.module.configure.getGameTeaching(req.Level); err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound
data = &pb.ErrorData{
Title: pb.GetErrorCodeMsg(code),
Message: err.Error(),
}
return return
} }
if req.Report.Completetask == nil || len(req.Report.Completetask) != len(level.Task) { if req.Report.Completetask == nil || len(req.Report.Completetask) != len(level.Task) {

View File

@ -2,6 +2,7 @@ package academy
import ( import (
"fmt" "fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core" "go_dreamfactory/lego/core"
"go_dreamfactory/modules" "go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs" cfg "go_dreamfactory/sys/configure/structs"
@ -37,7 +38,7 @@ func (this *configureComp) getGameTeaching(id int32) (result *cfg.GameTeachingDa
this.module.Errorln(err) this.module.Errorln(err)
} else { } else {
if result, ok = v.(*cfg.GameTeaching).GetDataMap()[id]; !ok { if result, ok = v.(*cfg.GameTeaching).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found GameMonster:%d", id) err = comm.NewNotFoundConfErr(moduleName, game_teaching, id)
this.module.Errorln(err) this.module.Errorln(err)
} }
} }

View File

@ -7,6 +7,8 @@ import (
"go_dreamfactory/modules" "go_dreamfactory/modules"
) )
const moduleName = "联盟学院"
/* /*
模块名:联盟学院 模块名:联盟学院
描述:新手训练营 描述:新手训练营