chore: seed migration objects batch 5
This commit is contained in:
@@ -8,6 +8,7 @@ package sysin
|
||||
import (
|
||||
"context"
|
||||
"hotgo/internal/model/input/form"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
@@ -17,7 +18,9 @@ import (
|
||||
type ImUserListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
UserId string `json:"userId" dc:"后台展示编号"`
|
||||
GroupId int64 `json:"groupId" dc:"用户策略分组ID"`
|
||||
Keyword string `json:"keyword" dc:"用户名、昵称、手机号或编号"`
|
||||
Nickname string `json:"nickname" dc:"昵称"`
|
||||
AuthName string `json:"authName" dc:"登录标识"`
|
||||
State *int `json:"state" dc:"账号状态"`
|
||||
@@ -26,8 +29,11 @@ type ImUserListInp struct {
|
||||
}
|
||||
|
||||
func (in *ImUserListInp) Filter(ctx context.Context) (err error) {
|
||||
if in.TenantId <= 0 {
|
||||
return gerror.New("请选择租户")
|
||||
in.Keyword = strings.TrimSpace(in.Keyword)
|
||||
if in.UserId != "" {
|
||||
if _, err = ParseOptionalInt64(in.UserId); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -35,7 +41,10 @@ func (in *ImUserListInp) Filter(ctx context.Context) (err error) {
|
||||
type ImUserListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
DisplayNo int `json:"displayNo" dc:"后台展示编号"`
|
||||
UserId string `json:"userId" dc:"用户ID"`
|
||||
Username string `json:"username" dc:"登录账号"`
|
||||
Phone string `json:"phone" dc:"手机号"`
|
||||
Nickname string `json:"nickname" dc:"昵称"`
|
||||
PublicAccount string `json:"publicAccount" dc:"公开账号"`
|
||||
Gender string `json:"gender" dc:"性别"`
|
||||
@@ -49,24 +58,140 @@ type ImUserListModel struct {
|
||||
UserAgent string `json:"userAgent" dc:"客户端"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
|
||||
AvatarFileId string `json:"avatarFileId" dc:"头像文件ID"`
|
||||
Avatar string `json:"avatar" dc:"头像地址"`
|
||||
PolicyGroupId int64 `json:"policyGroupId" dc:"用户策略分组ID"`
|
||||
PolicyGroupName string `json:"policyGroupName" dc:"用户策略分组名称"`
|
||||
RegisterType string `json:"registerType" dc:"注册方式"`
|
||||
}
|
||||
|
||||
type ImUserCreateInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Username string `json:"username" dc:"用户名"`
|
||||
Nickname string `json:"nickname" v:"required#昵称不能为空" dc:"昵称"`
|
||||
Phone string `json:"phone" dc:"手机号"`
|
||||
Password string `json:"password" v:"required#密码不能为空" dc:"密码"`
|
||||
GroupId int64 `json:"groupId" dc:"用户策略分组ID"`
|
||||
}
|
||||
|
||||
func (in *ImUserCreateInp) Filter(ctx context.Context) error {
|
||||
in.Username = strings.ToLower(strings.TrimSpace(in.Username))
|
||||
in.Nickname = strings.TrimSpace(in.Nickname)
|
||||
in.Phone = strings.TrimSpace(in.Phone)
|
||||
if in.Nickname == "" {
|
||||
return gerror.New("昵称不能为空")
|
||||
}
|
||||
if len([]rune(in.Password)) < 3 || len([]byte(in.Password)) > 72 {
|
||||
return gerror.New("密码长度需为3至72字节")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserCreateModel struct {
|
||||
DisplayNo int `json:"displayNo" dc:"后台展示编号"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
Username string `json:"username" dc:"用户名"`
|
||||
Nickname string `json:"nickname" dc:"昵称"`
|
||||
Phone string `json:"phone" dc:"手机号"`
|
||||
}
|
||||
|
||||
type ImUserBatchCreateInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
Count int `json:"count" v:"required|min:1|max:100#创建数量不能为空|创建数量最少为1|单次最多创建100个用户" dc:"创建数量"`
|
||||
Password string `json:"password" v:"required#默认密码不能为空" dc:"默认密码"`
|
||||
NicknamePrefix string `json:"nicknamePrefix" dc:"昵称前缀"`
|
||||
GroupId int64 `json:"groupId" dc:"用户策略分组ID"`
|
||||
}
|
||||
|
||||
func (in *ImUserBatchCreateInp) Filter(ctx context.Context) error {
|
||||
in.NicknamePrefix = strings.TrimSpace(in.NicknamePrefix)
|
||||
if in.Count < 1 || in.Count > 100 {
|
||||
return gerror.New("单次创建数量需为1至100")
|
||||
}
|
||||
if len([]rune(in.Password)) < 3 || len([]byte(in.Password)) > 72 {
|
||||
return gerror.New("密码长度需为3至72字节")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserBatchItemModel struct {
|
||||
Row int `json:"row" dc:"行号"`
|
||||
DisplayNo int `json:"displayNo" dc:"后台展示编号"`
|
||||
Username string `json:"username" dc:"用户名"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
Success bool `json:"success" dc:"是否成功"`
|
||||
Reason string `json:"reason" dc:"失败原因"`
|
||||
}
|
||||
|
||||
type ImUserBatchCreateModel struct {
|
||||
SuccessCount int `json:"successCount" dc:"成功数量"`
|
||||
FailedCount int `json:"failedCount" dc:"失败数量"`
|
||||
Items []*ImUserBatchItemModel `json:"items" dc:"处理明细"`
|
||||
}
|
||||
|
||||
type ImUserImportInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
GroupId int64 `json:"groupId" dc:"默认用户策略分组ID"`
|
||||
Rows []*ImUserCreateInp `json:"rows" dc:"导入用户"`
|
||||
}
|
||||
|
||||
// ImUserViewInp 获取指定IM用户信息
|
||||
type ImUserViewInp struct {
|
||||
TenantId int64 `json:"tenantId" v:"required#租户ID不能为空" dc:"租户ID"`
|
||||
UserId int64 `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId string `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 {
|
||||
if _, err = ParseOptionalInt64(in.UserId); err != nil {
|
||||
return gerror.New("用户ID不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImUserPasswordResetInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId string `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
||||
NewPassword string `json:"newPassword" v:"required#新密码不能为空" dc:"新密码"`
|
||||
}
|
||||
|
||||
func (in *ImUserPasswordResetInp) Filter(ctx context.Context) error {
|
||||
if _, err := ParseOptionalInt64(in.UserId); err != nil {
|
||||
return err
|
||||
}
|
||||
if len([]rune(in.NewPassword)) < 3 {
|
||||
return gerror.New("新密码长度不能少于3位")
|
||||
}
|
||||
if len([]byte(in.NewPassword)) > 72 {
|
||||
return gerror.New("新密码长度不能超过72字节")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserRevokeSessionsInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId string `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
||||
}
|
||||
|
||||
func (in *ImUserRevokeSessionsInp) Filter(ctx context.Context) error {
|
||||
if _, err := ParseOptionalInt64(in.UserId); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserStatusInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId string `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
||||
State int `json:"state" dc:"账号状态"`
|
||||
}
|
||||
|
||||
func (in *ImUserStatusInp) Filter(ctx context.Context) error {
|
||||
if _, err := ParseOptionalInt64(in.UserId); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserViewModel struct {
|
||||
ImUserListModel
|
||||
Signature string `json:"signature" dc:"个性签名"`
|
||||
@@ -74,19 +199,36 @@ type ImUserViewModel struct {
|
||||
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 ImUserDeviceListInp struct {
|
||||
form.PageReq
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId string `json:"userId" v:"required#用户ID不能为空" dc:"用户ID"`
|
||||
}
|
||||
|
||||
func (in *ImUserDeviceListInp) Filter(ctx context.Context) (err error) {
|
||||
if _, err = ParseOptionalInt64(in.UserId); err != nil {
|
||||
return gerror.New("用户ID不能为空")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ImUserDeviceListModel struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
TenantName string `json:"tenantName" dc:"租户名称"`
|
||||
UserId int64 `json:"userId" dc:"用户ID"`
|
||||
DeviceId string `json:"deviceId" dc:"设备ID"`
|
||||
Platform string `json:"platform" dc:"平台"`
|
||||
Lang string `json:"lang" dc:"语言"`
|
||||
LastSeen *gtime.Time `json:"lastSeen" dc:"最后活跃时间"`
|
||||
PushProvider string `json:"pushProvider" dc:"Push服务商"`
|
||||
PushPlatform string `json:"pushPlatform" dc:"Push平台"`
|
||||
PushAppVersion string `json:"pushAppVersion" dc:"App版本"`
|
||||
PushTokenConfigured bool `json:"pushTokenConfigured" dc:"是否配置Push Token"`
|
||||
PushUpdatedAt *gtime.Time `json:"pushUpdatedAt" dc:"Push更新时间"`
|
||||
}
|
||||
|
||||
type ImUserGovernanceInp struct {
|
||||
@@ -105,12 +247,39 @@ func (in *ImUserGovernanceInp) Filter(ctx context.Context) (err error) {
|
||||
if in.UserId <= 0 {
|
||||
return gerror.New("用户ID不能为空")
|
||||
}
|
||||
if in.ActorUserId <= 0 {
|
||||
return gerror.New("操作IM用户ID不能为空")
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserAdjustGroupInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId int64 `json:"userId" v:"required|min:1#用户ID不能为空|用户ID不合法" dc:"用户ID"`
|
||||
GroupId int64 `json:"groupId" v:"required|min:1#用户分组不能为空|用户分组不合法" dc:"用户策略分组ID"`
|
||||
}
|
||||
|
||||
func (in *ImUserAdjustGroupInp) Filter(ctx context.Context) error {
|
||||
if in.UserId <= 0 || in.GroupId <= 0 {
|
||||
return gerror.New("用户和用户分组不能为空")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserIPWhitelistInp struct {
|
||||
TenantId int64 `json:"tenantId" dc:"租户ID"`
|
||||
UserId int64 `json:"userId" v:"required|min:1#用户ID不能为空|用户ID不合法" dc:"用户ID"`
|
||||
IPList []string `json:"ipList" dc:"IP或CIDR列表"`
|
||||
}
|
||||
|
||||
func (in *ImUserIPWhitelistInp) Filter(ctx context.Context) error {
|
||||
if in.UserId <= 0 {
|
||||
return gerror.New("用户ID不能为空")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserIPWhitelistModel struct {
|
||||
IPList []string `json:"ipList" dc:"IP或CIDR列表"`
|
||||
}
|
||||
|
||||
func (in *ImUserGovernanceInp) FilterDevice(ctx context.Context) (err error) {
|
||||
if err = in.Filter(ctx); err != nil {
|
||||
return err
|
||||
@@ -120,3 +289,13 @@ func (in *ImUserGovernanceInp) FilterDevice(ctx context.Context) (err error) {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ImUserCommandModel struct {
|
||||
CommandID string `json:"commandId" dc:"命令ID"`
|
||||
EventID string `json:"eventId" dc:"Kafka事件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:"幂等键"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user