diff --git a/common/constDef.go b/common/constDef.go index 056571567f41cf4028f97117715ab91536a7167b..8c318aa035f5aa1d51ff619502983ba56236d778 100644 --- a/common/constDef.go +++ b/common/constDef.go @@ -108,6 +108,8 @@ const ( MSG_ID_NEED_JOIN_FAMILY MsgIdType = 168 // 请加入代理的家族后进行购买 MSG_ID_SET_FAMILY_NAMEPL MsgIdType = 169 // 等级不够不能修改家族铭牌 MSG_ID_CHARGE_NO_AREA MsgIdType = 181 // 充值(代理转账,用户给代理充值),失败,不是本区域用户 + MSG_ID_BAN_MIC_NOBLE_5 MsgIdType = 188 //无法禁言VIP5和vip6 + MSG_ID_KICK_NOBLE_5 MsgIdType = 189 //无法踢出VIP5和vip6 ADD_GROUP_FAILED AddGroupResultType = 0 ADD_GROUP_DONE AddGroupResultType = 1 diff --git a/domain/model/group_m/mic.go b/domain/model/group_m/mic.go index 9df7f114c4e8cc979e0728279ec7de5f6c91a13b..be4576eda2f7423eb282b7eba802ca7c51d8153e 100644 --- a/domain/model/group_m/mic.go +++ b/domain/model/group_m/mic.go @@ -14,7 +14,9 @@ import ( "gorm.io/gorm" "hilo-group/_const/enum/group_e" "hilo-group/_const/redis_key" + "hilo-group/common" "hilo-group/domain/model/noble_m" + "hilo-group/domain/model/res_m" "hilo-group/domain/model/user_m" "hilo-group/myerr" "hilo-group/myerr/bizerr" @@ -562,7 +564,7 @@ func (micUser *MicUser) SpeechOpen(userId uint64, externalId string) error { //禁麦, 管理人 同 自己能禁麦(特别注意:产品说,无论是否式管理人开启禁麦,自己同管理人都能关闭禁麦) //规则:1:自己禁麦 2:管理人禁麦 -func (micUser *MicUser) SpeechClose(userId uint64, externalId string) error { +func (micUser *MicUser) SpeechClose(userId uint64, externalId, lang string) error { if micUser == nil { return bizerr.GroupMicNoUser } else { @@ -588,7 +590,8 @@ func (micUser *MicUser) SpeechClose(userId uint64, externalId string) error { if flag, err := noble_m.CheckNobleLevel(micUser.model.Db, micUser.UserId, 5); err != nil { return err } else if flag { - return bizerr.NobleNoMicSpeechCloseLevel5 + return myerr.WrapErr(res_m.GetErrByLanguage(micUser.model.Db, common.MSG_ID_BAN_MIC_NOBLE_5, lang, bizerr.NobleNoMicSpeechCloseOverLevel5)) + //return bizerr.NobleNoMicSpeechCloseLevel5 } micUser.Forbid = true } diff --git a/domain/service/group_mic_s/group_mic.go b/domain/service/group_mic_s/group_mic.go index ed150b6670269a9dec900b99b056fedc6b18c0fe..646e76a8f88e8f4d5c440c976d79e80579356a70 100644 --- a/domain/service/group_mic_s/group_mic.go +++ b/domain/service/group_mic_s/group_mic.go @@ -214,13 +214,13 @@ func (s *GroupMicService) GroupMicSpeechOpen(userId uint64, externalId string, g } //关闭麦 -func (s *GroupMicService) GroupMicSpeechClose(userId uint64, externalId string, groupUuid string, i int) error { +func (s *GroupMicService) GroupMicSpeechClose(userId uint64, externalId string, groupUuid, lang string, i int) error { model := domain.CreateModelContext(s.svc.MyContext) micUser, err := group_m.GetMicUser(model, groupUuid, i) if err != nil { return err } - return micUser.SpeechClose(userId, externalId) + return micUser.SpeechClose(userId, externalId, lang) } //麦上的人群发消息 diff --git a/domain/service/group_s/group_op.go b/domain/service/group_s/group_op.go index 119ce6bcb3dfa63f0ba56121362b34c6368989b6..7a2d3dcf273cf3e92421f1e844634516118ee1e0 100644 --- a/domain/service/group_s/group_op.go +++ b/domain/service/group_s/group_op.go @@ -18,12 +18,14 @@ import ( "gorm.io/gorm" "hilo-group/_const/enum/group_e" "hilo-group/_const/redis_key" + "hilo-group/common" "hilo-group/cv/property_cv" "hilo-group/domain/cache/group_c" "hilo-group/domain/cache/tim_c" "hilo-group/domain/event/group_ev" "hilo-group/domain/model/group_m" "hilo-group/domain/model/noble_m" + "hilo-group/domain/model/res_m" "hilo-group/domain/model/user_m" "hilo-group/domain/service/signal_s" "hilo-group/myerr" @@ -386,7 +388,7 @@ func (s *GroupService) GroupLeave(userId uint64, externalId string, groupId stri } //踢人 -func (s *GroupService) GroupKick(groupUuid string, userId uint64, userExternalId string, userNick string, avatar string, beKickUserId uint64, beKickExternalId string, beKickUserNick string, beKickUserAvatar string) error { +func (s *GroupService) GroupKick(groupUuid string, userId uint64, userExternalId string, userNick string, avatar string, beKickUserId uint64, beKickExternalId string, beKickUserNick string, beKickUserAvatar, lang string) error { return s.svc.Transactional(func() error { model := domain.CreateModel(s.svc.CtxAndDb) //木有model层给我,直接server怼了 @@ -410,7 +412,8 @@ func (s *GroupService) GroupKick(groupUuid string, userId uint64, userExternalId if flag, err := noble_m.CheckNobleLevel(model.Db, beKickUserId, 5); err != nil { return err } else if flag { - return bizerr.NobleNoKickLevel5 + return myerr.WrapErr(res_m.GetErrByLanguage(model.Db, common.MSG_ID_KICK_NOBLE_5, lang, bizerr.NobleNoKickOverLevel5)) + //return bizerr.NobleNoKickLevel5 } } //踢人10分钟 diff --git a/myerr/bizerr/bizCode.go b/myerr/bizerr/bizCode.go index d13f840cbc3f9c42848d2ca47a8434e8cd64c05b..752b8c43156e9d28284f76264d4823ba0f7c3073 100644 --- a/myerr/bizerr/bizCode.go +++ b/myerr/bizerr/bizCode.go @@ -100,8 +100,10 @@ var ( TaskHasAward = myerr.NewBusinessCode(19001, "task has award", myerr.BusinessData{}) //贵族 - NobleNoMicSpeechCloseLevel5 = myerr.NewBusinessCode(21001, "Can't mute the King", myerr.BusinessData{}) //无法禁言贵族5 - NobleNoKickLevel5 = myerr.NewBusinessCode(21002, "Can't kick the King", myerr.BusinessData{}) //无法禁言贵族5 + NobleNoMicSpeechCloseLevel5 = myerr.NewBusinessCode(21001, "Can't mute the King", myerr.BusinessData{}) //无法禁言贵族5 + NobleNoKickLevel5 = myerr.NewBusinessCode(21002, "Can't kick the King", myerr.BusinessData{}) //无法禁言贵族5 + NobleNoMicSpeechCloseOverLevel5 = myerr.NewBusinessCode(21003, "Unable to mute VIP5 and VIP6", myerr.BusinessData{}) //无法禁言贵族5、6 + NobleNoKickOverLevel5 = myerr.NewBusinessCode(21004, "Unable to kick out VIP5 and VIP6", myerr.BusinessData{}) //无法踢出贵族5、6 // 超级管理人 OfficialStaffLimit = myerr.NewBusinessCode(22001, "Operation failed", myerr.BusinessData{}) diff --git a/route/group_r/group_mic.go b/route/group_r/group_mic.go index 0d8d6bf7ddbef94c44982d0c4533408321b5354f..a1c999d2caa075fd8a10976432e228134498dd57 100644 --- a/route/group_r/group_mic.go +++ b/route/group_r/group_mic.go @@ -832,13 +832,18 @@ func GroupMicSpeechClose(c *gin.Context) (*mycontext.MyContext, error) { return myContext, err } + _, lang, err := req.GetUserIdLang(c, myContext) + if err != nil { + return myContext, err + } + model := domain.CreateModelContext(myContext) groupUuid, err = group_m.ToImGroupId(model, groupUuid) if err != nil { return myContext, err } - if err := group_mic_s.NewGroupPowerService(myContext).GroupMicSpeechClose(userId, externalId, groupUuid, i); err != nil { + if err := group_mic_s.NewGroupPowerService(myContext).GroupMicSpeechClose(userId, externalId, groupUuid, lang, i); err != nil { return myContext, err } resp.ResponseOk(c, nil) diff --git a/route/group_r/group_op.go b/route/group_r/group_op.go index 923208ce47d1607eb6d0f2c1a168dc536639c3f3..4e9b656950d5134fbd32ee79350ee41391af3f09 100644 --- a/route/group_r/group_op.go +++ b/route/group_r/group_op.go @@ -1959,7 +1959,7 @@ func GroupKick(c *gin.Context) (*mycontext.MyContext, error) { } //beKickUserId, err := toUserId(beKickExternalId) - if err := group_s.NewGroupService(myContext).GroupKick(groupId, userId, externalId, nick, avatar, beKickUser.ID, beKickUser.ExternalId, beKickUser.Nick, beKickUser.Avatar); err != nil { + if err := group_s.NewGroupService(myContext).GroupKick(groupId, userId, externalId, nick, avatar, beKickUser.ID, beKickUser.ExternalId, beKickUser.Nick, beKickUser.Avatar, lang); err != nil { return myContext, err } resp.ResponseOk(c, nil)