Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-common
Commits
9b8ef2b1
Commit
9b8ef2b1
authored
May 26, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
错误toast翻译
parent
0869e797
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
res_multi_text.go
internal/model/res_m/res_multi_text.go
+0
-18
msg.go
txop/msg/msg.go
+22
-0
No files found.
internal/model/res_m/res_multi_text.go
View file @
9b8ef2b1
package
res_m
import
(
"fmt"
"git.hilo.cn/hilo-common/_const/common"
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/myerr"
...
...
@@ -40,20 +39,3 @@ func GetResMultiTextBy(model *domain.Model, msgId uint, Language mysql.Str) (*Re
}
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
{})
}
txop/msg/msg.go
View file @
9b8ef2b1
package
msg
import
(
"fmt"
"git.hilo.cn/hilo-common/_const/common"
"git.hilo.cn/hilo-common/domain"
"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/res_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/utils"
)
...
...
@@ -36,3 +40,21 @@ func SendLittleAssistantMsg(model *domain.Model, userId mysql.ID, t msg_e.MsgUse
}
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
{})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment