diff --git a/internal/logic/app/group_app.go b/internal/logic/app/group_app.go index e967d7a..4547fee 100644 --- a/internal/logic/app/group_app.go +++ b/internal/logic/app/group_app.go @@ -208,10 +208,10 @@ func (*groupApp) SetGroupMemberBanned(ctx context.Context, optId, groupId int64, //2、更新 `group_user` 的 status 状态 if len(userIds) == 0 { - db.DB.Model(model.GroupUser{}).Where("group_id = ?", groupId).Updates(model.GroupUser{Status: sql.NullInt32{Int32: int32(pb.GroupUserStatusType_GROUP_USER_STATUS_NORMAL), Valid: true}}) + db.DB.Model(model.GroupUser{}).Where("group_id = ?", groupId).Updates(model.GroupUserV2{Status: sql.NullInt32{Int32: int32(pb.GroupUserStatusType_GROUP_USER_STATUS_NORMAL), Valid: true}}) } else { - db.DB.Model(model.GroupUser{}).Where("user_id in (?) and group_id = ?", userIds, groupId).Updates(model.GroupUser{Status: sql.NullInt32{Int32: int32(pb.GroupUserStatusType_GROUP_USER_STATUS_Banned), Valid: true}}) - db.DB.Model(model.GroupUser{}).Where("(user_id) not in (?) and group_id = ?", userIds, groupId).Updates(model.GroupUser{Status: sql.NullInt32{Int32: int32(pb.GroupUserStatusType_GROUP_USER_STATUS_NORMAL), Valid: true}}) + db.DB.Model(model.GroupUser{}).Where("user_id in (?) and group_id = ?", userIds, groupId).Updates(model.GroupUserV2{Status: sql.NullInt32{Int32: int32(pb.GroupUserStatusType_GROUP_USER_STATUS_Banned), Valid: true}}) + db.DB.Model(model.GroupUser{}).Where("(user_id) not in (?) and group_id = ?", userIds, groupId).Updates(model.GroupUserV2{Status: sql.NullInt32{Int32: int32(pb.GroupUserStatusType_GROUP_USER_STATUS_NORMAL), Valid: true}}) } //3、发送推送消息 diff --git a/internal/logic/domain/group/model/group.go b/internal/logic/domain/group/model/group.go index 55d7fb7..7c21c71 100644 --- a/internal/logic/domain/group/model/group.go +++ b/internal/logic/domain/group/model/group.go @@ -38,6 +38,19 @@ type Group struct { } type GroupUser struct { + Id int64 // 自增主键 + GroupId int64 // 群组id + UserId int64 // 用户id + MemberType int // 群组类型 + Remarks string // 备注 + Extra string // 附加属性 + Status int // 状态 + CreateTime time.Time // 创建时间 + UpdateTime time.Time // 更新时间 + UpdateType int `gorm:"-"` // 更新类型 +} + +type GroupUserV2 struct { Id int64 // 自增主键 GroupId int64 // 群组id UserId int64 // 用户id