123 lines
4.5 KiB
Go
123 lines
4.5 KiB
Go
// Package sysin
|
|
// @Link https://github.com/bufanyun/hotgo
|
|
// @Copyright Copyright (c) 2026 HotGo
|
|
// @Author Ms <133814250@qq.com>
|
|
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
|
package sysin
|
|
|
|
import (
|
|
"context"
|
|
"hotgo/internal/model/input/form"
|
|
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
)
|
|
|
|
// ImUserListInp 获取IM用户列表
|
|
type ImUserListInp struct {
|
|
form.PageReq
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
Nickname string `json:"nickname" dc:"昵称"`
|
|
AuthName string `json:"authName" dc:"登录标识"`
|
|
State *int `json:"state" dc:"账号状态"`
|
|
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
LastSeen []*gtime.Time `json:"lastSeen" dc:"最后在线时间"`
|
|
}
|
|
|
|
func (in *ImUserListInp) Filter(ctx context.Context) (err error) {
|
|
if in.TenantId <= 0 {
|
|
return gerror.New("请选择租户")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImUserListModel struct {
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
TenantName string `json:"tenantName" dc:"租户名称"`
|
|
UserId int64 `json:"userId" dc:"用户ID"`
|
|
Nickname string `json:"nickname" dc:"昵称"`
|
|
PublicAccount string `json:"publicAccount" dc:"公开账号"`
|
|
Gender string `json:"gender" dc:"性别"`
|
|
Region string `json:"region" dc:"地区"`
|
|
State int `json:"state" dc:"账号状态"`
|
|
AuthVersion int `json:"authVersion" dc:"认证版本"`
|
|
PasswordUpdatedAt *gtime.Time `json:"passwordUpdatedAt" dc:"密码更新时间"`
|
|
AuthNames string `json:"authNames" dc:"登录标识"`
|
|
Credentials string `json:"credentials" dc:"凭证"`
|
|
LastSeen *gtime.Time `json:"lastSeen" dc:"最后在线时间"`
|
|
UserAgent string `json:"userAgent" dc:"客户端"`
|
|
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
|
}
|
|
|
|
// ImUserViewInp 获取指定IM用户信息
|
|
type ImUserViewInp struct {
|
|
TenantId int64 `json:"tenantId" v:"required#租户ID不能为空" dc:"租户ID"`
|
|
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
|
}
|
|
|
|
func (in *ImUserViewInp) Filter(ctx context.Context) (err error) {
|
|
if in.TenantId <= 0 {
|
|
return gerror.New("请选择租户")
|
|
}
|
|
if in.UserId <= 0 {
|
|
return gerror.New("用户ID不能为空")
|
|
}
|
|
return
|
|
}
|
|
|
|
type ImUserViewModel struct {
|
|
ImUserListModel
|
|
Signature string `json:"signature" dc:"个性签名"`
|
|
AvatarFileId string `json:"avatarFileId" dc:"头像文件ID"`
|
|
BirthDate string `json:"birthDate" dc:"出生日期"`
|
|
ProfileJson string `json:"profileJson" dc:"Tinode Public资料"`
|
|
TrustedJson string `json:"trustedJson" dc:"Tinode Trusted资料"`
|
|
TagsJson string `json:"tagsJson" dc:"Tinode标签"`
|
|
AccessJson string `json:"accessJson" dc:"访问权限"`
|
|
ProfileVersion int `json:"profileVersion" dc:"资料版本"`
|
|
}
|
|
|
|
type ImUserCommandModel struct {
|
|
CommandID string `json:"commandId" dc:"命令ID"`
|
|
EventID string `json:"eventId" dc:"事件ID"`
|
|
Status string `json:"status" dc:"状态"`
|
|
TenantID int64 `json:"tenantId" dc:"租户ID"`
|
|
TenantCode string `json:"tenantCode" dc:"租户编码"`
|
|
EventType string `json:"eventType" dc:"事件类型"`
|
|
IdempotencyKey string `json:"idempotencyKey" dc:"幂等键"`
|
|
}
|
|
|
|
type ImUserGovernanceInp struct {
|
|
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
|
UserId int64 `json:"userId" dc:"目标用户ID"`
|
|
ActorUserId int64 `json:"actorUserId" dc:"操作IM用户ID"`
|
|
DeviceId string `json:"deviceId" dc:"设备ID"`
|
|
Reason string `json:"reason" dc:"原因"`
|
|
Hard bool `json:"hard" dc:"硬删除"`
|
|
}
|
|
|
|
func (in *ImUserGovernanceInp) Filter(ctx context.Context) (err error) {
|
|
if in.TenantId <= 0 {
|
|
return gerror.New("请选择租户")
|
|
}
|
|
if in.UserId <= 0 {
|
|
return gerror.New("用户ID不能为空")
|
|
}
|
|
if in.ActorUserId <= 0 {
|
|
return gerror.New("操作IM用户ID不能为空")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (in *ImUserGovernanceInp) FilterDevice(ctx context.Context) (err error) {
|
|
if err = in.Filter(ctx); err != nil {
|
|
return err
|
|
}
|
|
if in.DeviceId == "" {
|
|
return gerror.New("设备ID不能为空")
|
|
}
|
|
return nil
|
|
}
|