Commit 0a7221e9 authored by chenweijian's avatar chenweijian

错误弹窗

parent 85a34f78
......@@ -160,6 +160,8 @@ type BusinessData struct {
Timestamp int64 `json:"timestamp"`
//官网充值地址
CheckOutUrl string `json:"checkOutUrl"`
Title string `json:"title"`
Detail string `json:"detail"`
}
func NewBusiness(err *BusinessError) *BusinessError {
......
......@@ -60,6 +60,26 @@ func GetErrByLanguage(model *domain.Model, msgId common.MsgIdType, lang string,
return myerr.NewBusinessCodeNoCheck(myErr.GetCode(), msg, myerr.BusinessData{})
}
// 生成弹窗错误
func NewAlertErrByLanguage(model *domain.Model, msgId1, msgId2 common.MsgIdType, lang string, args1 []interface{}, args2 []interface{}) *myerr.BusinessError {
var title, content string
if resMul, _ := res_m.GetResMultiTextBy(model, msgId1, lang); resMul != nil {
if len(args1) > 0 {
title = fmt.Sprintf(resMul.Content, args1...)
} else {
title = resMul.Content
}
}
if resMul, _ := res_m.GetResMultiTextBy(model, msgId2, lang); resMul != nil {
if len(args1) > 0 {
content = fmt.Sprintf(resMul.Content, args2...)
} else {
content = resMul.Content
}
}
return myerr.NewBusinessCodeNoCheck(1020, "", myerr.BusinessData{Title: title, Detail: content})
}
func GetResMultiTextBy(model *domain.Model, msgId uint, Language mysql.Str) (string, error) {
r := res_m.ResMultiText{}
if err := model.DB().Where(&res_m.ResMultiText{
......
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