feat: add friend add and curfew controls
This commit is contained in:
@@ -63,6 +63,7 @@ type ImUserListModel struct {
|
||||
PolicyGroupId int64 `json:"policyGroupId" dc:"用户策略分组ID"`
|
||||
PolicyGroupName string `json:"policyGroupName" dc:"用户策略分组名称"`
|
||||
RegisterType string `json:"registerType" dc:"注册方式"`
|
||||
FriendAddEnabled int `json:"friendAddEnabled" dc:"是否允许发起加好友"`
|
||||
}
|
||||
|
||||
type ImUserCreateInp struct {
|
||||
@@ -263,6 +264,27 @@ func (in *ImUserAdjustGroupInp) Filter(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserFriendAddInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId int64 `json:"userId" v:"required|min:1#用户ID不能为空|用户ID不合法" dc:"用户ID"`
|
||||
Enabled int `json:"enabled" dc:"是否允许发起加好友:1允许 0禁止"`
|
||||
Reason string `json:"reason" dc:"禁用原因"`
|
||||
}
|
||||
|
||||
func (in *ImUserFriendAddInp) Filter(ctx context.Context) error {
|
||||
in.Reason = strings.TrimSpace(in.Reason)
|
||||
if in.UserId <= 0 {
|
||||
return gerror.New("用户ID不能为空")
|
||||
}
|
||||
if in.Enabled != 0 && in.Enabled != 1 {
|
||||
return gerror.New("加好友开关不合法")
|
||||
}
|
||||
if in.Enabled == 0 && in.Reason == "" {
|
||||
in.Reason = "后台禁止该用户发起加好友"
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserIPWhitelistInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId int64 `json:"userId" v:"required|min:1#用户ID不能为空|用户ID不合法" dc:"用户ID"`
|
||||
|
||||
Reference in New Issue
Block a user