Ver código fonte

update

master
DengBiao 1 ano atrás
pai
commit
9324d8911c
2 arquivos alterados com 16 adições e 3 exclusões
  1. +3
    -3
      internal/logic/app/group_app.go
  2. +13
    -0
      internal/logic/domain/group/model/group.go

+ 3
- 3
internal/logic/app/group_app.go Ver arquivo

@@ -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、发送推送消息


+ 13
- 0
internal/logic/domain/group/model/group.go Ver arquivo

@@ -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


Carregando…
Cancelar
Salvar