fix: 完善IM用户状态与分组展示

This commit is contained in:
richjohnrambo
2026-09-08 22:16:51 +08:00
parent 7d54bf785a
commit 99307f1c98
4 changed files with 76 additions and 19 deletions
+10 -3
View File
@@ -12,6 +12,7 @@ import (
func init() {
dict.RegisterEnums("ImUserStateOptions", "IM用户状态选项", ImUserStateOptions)
dict.RegisterEnums("ImUserListStateOptions", "IM用户列表状态选项", ImUserListStateOptions)
dict.RegisterEnums("ImUserRegisterTypeOptions", "IM用户注册方式选项", ImUserRegisterTypeOptions)
}
@@ -35,8 +36,14 @@ const (
)
var ImUserStateOptions = []*model.Option{
dict.GenSuccessOption(ImUserStateOk, "正常"),
dict.GenErrorOption(ImUserStateSuspended, "已停用"),
dict.GenDefaultOption(ImUserStateDeleted, "已删除"),
dict.GenSuccessOption(ImUserStateOk, "启用"),
dict.GenErrorOption(ImUserStateSuspended, "封禁"),
dict.GenDefaultOption(ImUserStateDeleted, "已注销"),
dict.GenWarningOption(ImUserStateUndefined, "未定义"),
}
var ImUserListStateOptions = []*model.Option{
dict.GenSuccessOption(ImUserStateOk, "启用"),
dict.GenErrorOption(ImUserStateSuspended, "封禁"),
dict.GenDefaultOption(ImUserStateDeleted, "已注销"),
}
@@ -0,0 +1,46 @@
-- Initialize assignable policy groups for every active IM tenant.
-- Safe to rerun: tenant_id + group_code is unique.
SET NAMES utf8mb4;
USE `hotgo`;
INSERT INTO `im_user_policy_groups`
(`tenant_id`, `group_code`, `group_name`, `priority`, `status`, `policy_json`, `ip_whitelist`, `ip_blacklist`, `version`, `remark`, `created_by`, `updated_by`)
SELECT
`id`, 'default_standard', '默认用户组', 100, 1,
JSON_OBJECT(
'allow_add_friend', TRUE, 'allow_join_group', TRUE, 'max_friend_count', 5000,
'allow_upload_file', TRUE, 'direct_add_friend', FALSE, 'allow_create_group', TRUE,
'allow_group_message', TRUE, 'allow_private_message', TRUE,
'allow_qrcode_add_friend', TRUE, 'allow_group_member_profile', TRUE,
'hide_profile_when_friend_disabled', TRUE
), JSON_ARRAY(), JSON_ARRAY(), 1, '系统初始化:默认用户权限', 0, 0
FROM `im_tenant` WHERE `state` = 1
ON DUPLICATE KEY UPDATE `group_name` = VALUES(`group_name`), `status` = 1, `updated_at` = CURRENT_TIMESTAMP(3);
INSERT INTO `im_user_policy_groups`
(`tenant_id`, `group_code`, `group_name`, `priority`, `status`, `policy_json`, `ip_whitelist`, `ip_blacklist`, `version`, `remark`, `created_by`, `updated_by`)
SELECT
`id`, 'default_trusted', '可信用户组', 90, 1,
JSON_OBJECT(
'allow_add_friend', TRUE, 'allow_join_group', TRUE, 'max_friend_count', 10000,
'allow_upload_file', TRUE, 'direct_add_friend', TRUE, 'allow_create_group', TRUE,
'allow_group_message', TRUE, 'allow_private_message', TRUE,
'allow_qrcode_add_friend', TRUE, 'allow_group_member_profile', TRUE,
'hide_profile_when_friend_disabled', TRUE
), JSON_ARRAY(), JSON_ARRAY(), 1, '系统初始化:可信用户权限', 0, 0
FROM `im_tenant` WHERE `state` = 1
ON DUPLICATE KEY UPDATE `group_name` = VALUES(`group_name`), `status` = 1, `updated_at` = CURRENT_TIMESTAMP(3);
INSERT INTO `im_user_policy_groups`
(`tenant_id`, `group_code`, `group_name`, `priority`, `status`, `policy_json`, `ip_whitelist`, `ip_blacklist`, `version`, `remark`, `created_by`, `updated_by`)
SELECT
`id`, 'default_guest', '访客用户组', 60, 1,
JSON_OBJECT(
'allow_add_friend', FALSE, 'allow_join_group', TRUE, 'max_friend_count', 0,
'allow_upload_file', FALSE, 'direct_add_friend', FALSE, 'allow_create_group', FALSE,
'allow_group_message', TRUE, 'allow_private_message', TRUE,
'allow_qrcode_add_friend', FALSE, 'allow_group_member_profile', FALSE,
'hide_profile_when_friend_disabled', TRUE
), JSON_ARRAY(), JSON_ARRAY(), 1, '系统初始化:访客用户权限', 0, 0
FROM `im_tenant` WHERE `state` = 1
ON DUPLICATE KEY UPDATE `group_name` = VALUES(`group_name`), `status` = 1, `updated_at` = CURRENT_TIMESTAMP(3);