From 92b3767478de5768d05e76eda23110c2ca733aa2 Mon Sep 17 00:00:00 2001 From: chenweijian <820961417@qq.com> Date: Tue, 13 Jun 2023 15:15:55 +0800 Subject: [PATCH] =?UTF-8?q?cp=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _const/common/const_def.go | 9 +++++++++ myerr/comerr/bizCode.go | 2 ++ txop/msg/msg.go | 22 ++++++++++++++++++++++ 3 files changed, 33 insertions(+) diff --git a/_const/common/const_def.go b/_const/common/const_def.go index ad4718a..7d35b49 100644 --- a/_const/common/const_def.go +++ b/_const/common/const_def.go @@ -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 diff --git a/myerr/comerr/bizCode.go b/myerr/comerr/bizCode.go index 7045d75..59bb7c2 100644 --- a/myerr/comerr/bizCode.go +++ b/myerr/comerr/bizCode.go @@ -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{}) ) diff --git a/txop/msg/msg.go b/txop/msg/msg.go index ca9d00f..e48cd22 100644 --- a/txop/msg/msg.go +++ b/txop/msg/msg.go @@ -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 +} -- 2.22.0