Commit 9b8ef2b1 authored by chenweijian's avatar chenweijian

错误toast翻译

parent 0869e797
package res_m package res_m
import ( import (
"fmt"
"git.hilo.cn/hilo-common/_const/common" "git.hilo.cn/hilo-common/_const/common"
"git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/myerr" "git.hilo.cn/hilo-common/myerr"
...@@ -40,20 +39,3 @@ func GetResMultiTextBy(model *domain.Model, msgId uint, Language mysql.Str) (*Re ...@@ -40,20 +39,3 @@ func GetResMultiTextBy(model *domain.Model, msgId uint, Language mysql.Str) (*Re
} }
return &r, nil return &r, nil
} }
func GetErrByLanguage(model *domain.Model, msgId common.MsgIdType, lang string, myErr *myerr.BusinessError, args ...interface{}) *myerr.BusinessError {
var msg string
if len(args) > 0 {
msg = fmt.Sprintf(myErr.GetMsg(), args...)
} else {
msg = myErr.GetMsg()
}
if resMul, _ := GetResMultiTextBy(model, msgId, lang); resMul != nil {
if len(args) > 0 {
msg = fmt.Sprintf(resMul.Content, args...)
} else {
msg = resMul.Content
}
}
return myerr.NewBusinessCodeNoCheck(myErr.GetCode(), msg, myerr.BusinessData{})
}
package msg package msg
import ( import (
"fmt"
"git.hilo.cn/hilo-common/_const/common"
"git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/internal/enum/msg_e" "git.hilo.cn/hilo-common/internal/enum/msg_e"
"git.hilo.cn/hilo-common/internal/model/msg_m" "git.hilo.cn/hilo-common/internal/model/msg_m"
"git.hilo.cn/hilo-common/internal/model/res_m"
"git.hilo.cn/hilo-common/internal/model/user_m" "git.hilo.cn/hilo-common/internal/model/user_m"
"git.hilo.cn/hilo-common/myerr"
"git.hilo.cn/hilo-common/resource/mysql" "git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/utils" "git.hilo.cn/hilo-common/utils"
) )
...@@ -36,3 +40,21 @@ func SendLittleAssistantMsg(model *domain.Model, userId mysql.ID, t msg_e.MsgUse ...@@ -36,3 +40,21 @@ func SendLittleAssistantMsg(model *domain.Model, userId mysql.ID, t msg_e.MsgUse
} }
return nil return nil
} }
// 错误toast翻译
func GetErrByLanguage(model *domain.Model, msgId common.MsgIdType, lang string, myErr *myerr.BusinessError, args ...interface{}) *myerr.BusinessError {
var msg string
if len(args) > 0 {
msg = fmt.Sprintf(myErr.GetMsg(), args...)
} else {
msg = myErr.GetMsg()
}
if resMul, _ := res_m.GetResMultiTextBy(model, msgId, lang); resMul != nil {
if len(args) > 0 {
msg = fmt.Sprintf(resMul.Content, args...)
} else {
msg = resMul.Content
}
}
return myerr.NewBusinessCodeNoCheck(myErr.GetCode(), msg, myerr.BusinessData{})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment