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
92b37674
Commit
92b37674
authored
Jun 13, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cp翻译
parent
ae017461
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
0 deletions
+33
-0
const_def.go
_const/common/const_def.go
+9
-0
bizCode.go
myerr/comerr/bizCode.go
+2
-0
msg.go
txop/msg/msg.go
+22
-0
No files found.
_const/common/const_def.go
View file @
92b37674
...
...
@@ -119,6 +119,15 @@ const (
MSG_ID_SEND_GIFT_TO_NO_ONE
MsgIdType
=
229
// 送礼给没人
MSG_ID_TRAN_GEM
MsgIdType
=
231
// 转移宝石(粉钻)
MSG_ID_BUY_GEM
MsgIdType
=
232
// 买宝石(粉钻)
MSG_ID_ALREADY_HAS_CP
MsgIdType
=
243
// 对方已有CP了
MSG_ID_INVITE_CP
MsgIdType
=
244
// 你想要和我成为CP吗
MSG_ID_WANT_BE_YOUR_CP
MsgIdType
=
245
// 我想成为你的CP
MSG_ID_EXPIRES_AFTER_24_H
MsgIdType
=
246
// 24小时后自动失效
MSG_ID_WANT_UNBIND_CP
MsgIdType
=
247
// 我想解绑CP
MSG_ID_BIND_CP_SUCCEED
MsgIdType
=
248
// 绑定成功-我们已经是CP了
MSG_ID_SEND_CP_GIFT
MsgIdType
=
249
// 发放cp礼物
MSG_ID_REJECTED_CP_INVITE
MsgIdType
=
250
// %s已拒绝CP邀请
MSG_ID_UNBIND_CP_SUCCEED
MsgIdType
=
251
// 解绑cp成功
ADD_GROUP_FAILED
AddGroupResultType
=
0
ADD_GROUP_DONE
AddGroupResultType
=
1
...
...
myerr/comerr/bizCode.go
View file @
92b37674
...
...
@@ -19,4 +19,6 @@ var (
DiamondNoEnough
=
myerr
.
NewBusinessCode
(
4000
,
"Insufficient diamonds"
,
myerr
.
BusinessData
{})
DiamondFrequency
=
myerr
.
NewBusinessCode
(
4001
,
"Diamond operation frequency too high"
,
myerr
.
BusinessData
{})
DiamondAccountFrozen
=
myerr
.
NewBusinessCode
(
4004
,
"Diamond Account Frozen"
,
myerr
.
BusinessData
{})
AlreadyHasCp
=
myerr
.
NewBusinessCode
(
90001
,
"The opponent already has CP"
,
myerr
.
BusinessData
{})
)
txop/msg/msg.go
View file @
92b37674
...
...
@@ -11,6 +11,7 @@ import (
"git.hilo.cn/hilo-common/myerr"
"git.hilo.cn/hilo-common/resource/mysql"
"git.hilo.cn/hilo-common/utils"
"gorm.io/gorm"
)
// 发送小助手消息
...
...
@@ -58,3 +59,24 @@ func GetErrByLanguage(model *domain.Model, msgId common.MsgIdType, lang string,
}
return
myerr
.
NewBusinessCodeNoCheck
(
myErr
.
GetCode
(),
msg
,
myerr
.
BusinessData
{})
}
func
GetResMultiTextBy
(
model
*
domain
.
Model
,
msgId
uint
,
Language
mysql
.
Str
)
(
string
,
error
)
{
r
:=
res_m
.
ResMultiText
{}
if
err
:=
model
.
DB
()
.
Where
(
&
res_m
.
ResMultiText
{
MsgId
:
msgId
,
Language
:
Language
,
})
.
First
(
&
r
)
.
Error
;
err
!=
nil
{
if
err
==
gorm
.
ErrRecordNotFound
{
if
err
:=
model
.
DB
()
.
Where
(
&
res_m
.
ResMultiText
{
MsgId
:
msgId
,
Language
:
common
.
DEFAULT_LANG
,
})
.
First
(
&
r
)
.
Error
;
err
!=
nil
{
return
""
,
myerr
.
WrapErr
(
err
)
}
}
else
{
return
""
,
myerr
.
WrapErr
(
err
)
}
}
return
r
.
Content
,
nil
}
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