瀏覽代碼

update

master
DengBiao 1 年之前
父節點
當前提交
8639b9c7b4
共有 1 個檔案被更改,包括 7 行新增2 行删除
  1. +7
    -2
      internal/logic/app/group_app.go

+ 7
- 2
internal/logic/app/group_app.go 查看文件

@@ -207,8 +207,13 @@ func (*groupApp) SetGroupMemberBanned(ctx context.Context, optId, groupId int64,
}

//2、更新 `group_user` 的 status 状态
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}})
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}})
} 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}})
}

//3、发送推送消息
for _, u := range userIds {
err = group.PushGroupMemberBanned(ctx, optId, u, isAllMemberBanned)


Loading…
取消
儲存