更换一个包
This commit is contained in:
+4
-4
@@ -50,7 +50,7 @@ func GetPage(page, size, totalCount int64) pagination {
|
||||
|
||||
// Msg格式化响应
|
||||
func FormatMessage(ctx context.Context, w http.ResponseWriter, message string, format map[string]string, data interface{}) {
|
||||
code, msg := langx.GetTrans(message, message, format)
|
||||
code, msg := langx.GetTransFormatCtx(ctx, message, format)
|
||||
ResponseCtx(ctx, w, code, msg, data)
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ func Error(ctx context.Context, w http.ResponseWriter, err error) {
|
||||
code := op.defaultErrorCode
|
||||
msg := "请求失败"
|
||||
if err != nil {
|
||||
val, ok := err.(*langx.LangError)
|
||||
val, ok := err.(langx.LangError)
|
||||
if ok {
|
||||
if langx.GetDefaultCode() != val.Code() {
|
||||
code = val.Code()
|
||||
if langx.GetDefaultCode() != val.GetCode() {
|
||||
code = val.GetCode()
|
||||
}
|
||||
}
|
||||
msg = err.Error()
|
||||
|
||||
Reference in New Issue
Block a user