diff --git a/_const/common/const_def.go b/_const/common/const_def.go index ad4718a4e1d179eb15da8cd8fbc7cf65f5cfbd67..7d35b49da39bdded544e1e855dbf8171be98414e 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 7045d75bb0dedea8847d79e699e13eac7dfd6c7f..59bb7c2f1dc09d99a42089f067e93cf1d246f63f 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 ca9d00f01039f9ff6c0aac16bed9888d5ed74171..e48cd224950df5583865667c3a6f731b1fe87e40 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 +}