feat: add member URL pool and login tracking
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
package sysin
|
||||
|
||||
import (
|
||||
"context"
|
||||
"strings"
|
||||
|
||||
"hotgo/internal/consts"
|
||||
"hotgo/internal/library/dict"
|
||||
"hotgo/internal/model/input/form"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type UrlPoolListInp struct {
|
||||
form.PageReq
|
||||
Name string `json:"name" dc:"地址名称"`
|
||||
Domain string `json:"domain" dc:"域名关键词"`
|
||||
Status int `json:"status" dc:"状态"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
}
|
||||
|
||||
func (in *UrlPoolListInp) Filter(ctx context.Context) error {
|
||||
if in.Status > 0 && !dict.HasOptionKey(consts.UrlPoolStatusOptions, in.Status) {
|
||||
return gerror.New("URL地址状态不合法")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UrlPoolListModel struct {
|
||||
Id uint64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Scheme string `json:"scheme"`
|
||||
Domain string `json:"domain"`
|
||||
BaseUrl string `json:"baseUrl"`
|
||||
Status int `json:"status"`
|
||||
BindCount uint64 `json:"bindCount"`
|
||||
CurrentBoundCount uint64 `json:"currentBoundCount"`
|
||||
LastBoundAt *gtime.Time `json:"lastBoundAt"`
|
||||
Remark string `json:"remark"`
|
||||
CreatedAt *gtime.Time `json:"createdAt"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt"`
|
||||
}
|
||||
|
||||
type UrlPoolViewInp struct {
|
||||
Id uint64 `json:"id" v:"required|min:1#地址ID不能为空|地址ID不能为空"`
|
||||
}
|
||||
|
||||
func (in *UrlPoolViewInp) Filter(ctx context.Context) error { return nil }
|
||||
|
||||
type UrlPoolViewModel struct {
|
||||
UrlPoolListModel
|
||||
CreatedBy uint64 `json:"createdBy"`
|
||||
UpdatedBy uint64 `json:"updatedBy"`
|
||||
}
|
||||
|
||||
type UrlPoolEditInp struct {
|
||||
Id uint64 `json:"id"`
|
||||
Name string `json:"name" v:"required|max-length:100#地址名称不能为空|地址名称不能超过100个字符"`
|
||||
BaseUrl string `json:"baseUrl" v:"required|max-length:512#注册入口不能为空|注册入口不能超过512个字符"`
|
||||
Status int `json:"status" v:"required#状态不能为空"`
|
||||
Remark string `json:"remark" v:"max-length:500#备注不能超过500个字符"`
|
||||
}
|
||||
|
||||
func (in *UrlPoolEditInp) Filter(ctx context.Context) error {
|
||||
in.Name = strings.TrimSpace(in.Name)
|
||||
in.BaseUrl = strings.TrimSpace(in.BaseUrl)
|
||||
if !dict.HasOptionKey(consts.UrlPoolStatusOptions, in.Status) {
|
||||
return gerror.New("URL地址状态不合法")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UrlPoolStatusInp struct {
|
||||
Id uint64 `json:"id" v:"required|min:1#地址ID不能为空|地址ID不能为空"`
|
||||
Status int `json:"status" v:"required#状态不能为空"`
|
||||
}
|
||||
|
||||
func (in *UrlPoolStatusInp) Filter(ctx context.Context) error {
|
||||
if !dict.HasOptionKey(consts.UrlPoolStatusOptions, in.Status) {
|
||||
return gerror.New("URL地址状态不合法")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type UrlPoolImportIssue struct {
|
||||
Row int `json:"row" dc:"Excel行号"`
|
||||
Message string `json:"message" dc:"失败原因"`
|
||||
}
|
||||
|
||||
type UrlPoolImportModel struct {
|
||||
TotalRows int `json:"totalRows" dc:"有效数据行数"`
|
||||
SuccessCount int `json:"successCount" dc:"成功导入数量"`
|
||||
DuplicateCount int `json:"duplicateCount" dc:"重复跳过数量"`
|
||||
FailedCount int `json:"failedCount" dc:"校验失败数量"`
|
||||
Issues []*UrlPoolImportIssue `json:"issues" dc:"校验失败明细,最多返回100条"`
|
||||
}
|
||||
|
||||
type UrlPoolMemberListInp struct {
|
||||
form.PageReq
|
||||
UrlPoolId uint64 `json:"urlPoolId" v:"required|min:1#地址ID不能为空|地址ID不能为空"`
|
||||
Keyword string `json:"keyword" dc:"会员编号、用户名或手机号"`
|
||||
BoundAt []*gtime.Time `json:"boundAt" dc:"绑定时间"`
|
||||
}
|
||||
|
||||
func (in *UrlPoolMemberListInp) Filter(ctx context.Context) error { return nil }
|
||||
|
||||
type UrlPoolMemberListModel struct {
|
||||
MemberId uint64 `json:"memberId"`
|
||||
MemberNo string `json:"memberNo"`
|
||||
Username string `json:"username"`
|
||||
Mobile string `json:"mobile"`
|
||||
MemberStatus int `json:"memberStatus"`
|
||||
BoundAt *gtime.Time `json:"boundAt"`
|
||||
}
|
||||
|
||||
type UrlPoolSummaryInp struct{}
|
||||
|
||||
func (in *UrlPoolSummaryInp) Filter(ctx context.Context) error { return nil }
|
||||
|
||||
type UrlPoolSummaryModel struct {
|
||||
TotalCount int `json:"totalCount"`
|
||||
EnabledCount int `json:"enabledCount"`
|
||||
InvalidCount int `json:"invalidCount"`
|
||||
BoundMemberCount int `json:"boundMemberCount"`
|
||||
UnboundMemberCount int `json:"unboundMemberCount"`
|
||||
InvalidMemberCount int `json:"invalidMemberCount"`
|
||||
}
|
||||
Reference in New Issue
Block a user