chore: seed migration objects batch 5

This commit is contained in:
dev
2026-10-18 13:37:24 +08:00
parent 53c9c0afd8
commit c8c40b1dd2
239 changed files with 16941 additions and 1544 deletions
+45 -12
View File
@@ -4,6 +4,7 @@ import (
"context"
"hotgo/internal/model/input/form"
"strconv"
"strings"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
@@ -25,6 +26,9 @@ type ImInviteListInp struct {
}
func (in *ImInviteListInp) Filter(ctx context.Context) (err error) {
if in.Page <= 0 {
in.Page = 1
}
if in.PerPage <= 0 {
in.PerPage = 20
}
@@ -53,12 +57,16 @@ type ImInviteCreateInp struct {
}
func (in *ImInviteCreateInp) Filter(ctx context.Context) (err error) {
in.IdempotencyKey = strings.TrimSpace(in.IdempotencyKey)
if in.ExpiresAt == nil || in.ExpiresAt.Before(gtime.Now()) {
return gerror.New("到期时间必须晚于当前时间")
}
if len(in.Remark) > 255 {
return gerror.New("备注不能超过255个字符")
}
if len(in.IdempotencyKey) > 128 {
return gerror.New("幂等键不能超过128个字符")
}
return
}
@@ -71,6 +79,7 @@ type ImInviteBatchCreateInp struct {
}
func (in *ImInviteBatchCreateInp) Filter(ctx context.Context) (err error) {
in.IdempotencyKey = strings.TrimSpace(in.IdempotencyKey)
if in.Quantity < 1 || in.Quantity > 1000 {
return gerror.New("批量生成数量必须在1到1000之间")
}
@@ -80,6 +89,9 @@ func (in *ImInviteBatchCreateInp) Filter(ctx context.Context) (err error) {
if len(in.Remark) > 255 {
return gerror.New("备注不能超过255个字符")
}
if len(in.IdempotencyKey) == 0 || len(in.IdempotencyKey) > 128 {
return gerror.New("批量生成必须提供不超过128个字符的幂等键")
}
return
}
@@ -93,30 +105,51 @@ type ImInviteRevokeInp struct {
Id string `json:"id" v:"required#邀请码ID不能为空" dc:"邀请码ID"`
}
type ImInviteBindUserInp struct {
TenantId int64 `json:"tenantId" dc:"IM租户ID"`
Id string `json:"id" v:"required#邀请码ID不能为空" dc:"邀请码ID"`
UserId int64 `json:"userId" v:"required|min:1#绑定用户不能为空|绑定用户不合法" dc:"绑定C端用户ID"`
}
func (in *ImInviteBindUserInp) Filter(ctx context.Context) (err error) {
if _, err = ParseOptionalInt64(in.Id); err != nil {
return gerror.New("邀请码ID不能为空")
}
if in.UserId <= 0 {
return gerror.New("绑定用户不能为空")
}
return nil
}
type ImInviteBatchRevokeInp struct {
TenantId int64 `json:"tenantId" dc:"IM租户ID"`
BatchId string `json:"batchId" v:"required#批次ID不能为空" dc:"批次ID"`
}
type ImInviteCodeModel struct {
Id string `json:"id" dc:"ID"`
BatchId string `json:"batchId" dc:"批次ID"`
Code string `json:"code" dc:"邀请码"`
Status string `json:"status" dc:"状态"`
ExpiresAt *gtime.Time `json:"expiresAt" dc:"到期时间"`
UsedBy string `json:"usedBy" dc:"使用用户"`
UsedAt *gtime.Time `json:"usedAt" dc:"使用时间"`
RequestId string `json:"requestId" dc:"请求ID"`
CreatedBy string `json:"createdBy" dc:"创建人"`
Remark string `json:"remark" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
Id string `json:"id" dc:"ID"`
TenantId string `json:"tenantId" dc:"IM租户ID"`
TenantName string `json:"tenantName" dc:"IM租户名称"`
BatchId string `json:"batchId" dc:"批次ID"`
Code string `json:"code" dc:"邀请码"`
Status string `json:"status" dc:"状态"`
ExpiresAt *gtime.Time `json:"expiresAt" dc:"到期时间"`
MaxUses int `json:"maxUses" dc:"最大可用次数,0表示不限制"`
UsageCount int `json:"usageCount" dc:"累计使用次数"`
BoundUserId string `json:"boundUserId" dc:"绑定用户ID"`
BoundUserLabel string `json:"boundUserLabel" dc:"绑定用户展示名"`
LastUsedAt *gtime.Time `json:"lastUsedAt" dc:"最后使用时间"`
CreatedBy string `json:"createdBy" dc:"创建人"`
Remark string `json:"remark" dc:"备注"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
}
type ImInviteBatchModel struct {
BatchId string `json:"batchId" dc:"批次ID"`
TenantId string `json:"tenantId" dc:"IM租户ID"`
Quantity int `json:"quantity" dc:"数量"`
ActiveCount int `json:"activeCount" dc:"有效数量"`
UsedCount int `json:"usedCount" dc:"已使用数量"`
UsageCount int `json:"usageCount" dc:"累计使用次数"`
RevokedCount int `json:"revokedCount" dc:"已撤销数量"`
ExpiredCount int `json:"expiredCount" dc:"已过期数量"`
ExpiresAt *gtime.Time `json:"expiresAt" dc:"到期时间"`