Files
im_manager/server/internal/model/input/sysin/maoyu.go
T

210 lines
8.1 KiB
Go

package sysin
import (
"context"
"strings"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/model/input/form"
)
// 毛隅管理页面输入输出:概览、互动动作配置、宠物档案、场景生成任务、互动通知。
// 内容审核、举报、操作日志协议与养成一致,直接复用 Cultivate* 输入输出,仅路由前缀不同。
type MaoyuDashboardInp struct{}
type MaoyuDashboardModel struct {
PetCount int64 `json:"petCount"`
ActivePetCount int64 `json:"activePetCount"`
BuildingPetCount int64 `json:"buildingPetCount"`
JobRunningCount int64 `json:"jobRunningCount"`
JobSucceededCount int64 `json:"jobSucceededCount"`
JobFailedCount int64 `json:"jobFailedCount"`
NoticeCount int64 `json:"noticeCount"`
UnreadNoticeCount int64 `json:"unreadNoticeCount"`
PostCount int64 `json:"postCount"`
PublicPostCount int64 `json:"publicPostCount"`
FriendsPostCount int64 `json:"friendsPostCount"`
PrivatePostCount int64 `json:"privatePostCount"`
CommentCount int64 `json:"commentCount"`
LikeCount int64 `json:"likeCount"`
TakenDownCount int64 `json:"takenDownCount"`
PendingAuditCount int64 `json:"pendingAuditCount"`
ApprovedAuditCount int64 `json:"approvedAuditCount"`
RejectedAuditCount int64 `json:"rejectedAuditCount"`
PendingReportCount int64 `json:"pendingReportCount"`
ProcessingCount int64 `json:"processingReportCount"`
ProcessedCount int64 `json:"processedReportCount"`
}
type MaoyuActionConfigListInp struct {
form.PageReq
Keyword string `json:"keyword"`
Status string `json:"status" v:"in:,enabled,disabled#动作状态不正确"`
Version string `json:"version"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *MaoyuActionConfigListInp) Filter(ctx context.Context) (err error) {
if in.CreatedAt != nil && len(in.CreatedAt) == 2 && !in.CreatedAt[0].IsZero() && !in.CreatedAt[1].IsZero() {
in.CreatedAt = []*gtime.Time{in.CreatedAt[0].StartOfDay(), in.CreatedAt[1].EndOfDay()}
} else {
in.CreatedAt = nil
}
in.Keyword = strings.TrimSpace(in.Keyword)
return nil
}
type MaoyuActionConfigListModel struct {
Id string `json:"id"`
ActionCode string `json:"actionCode"`
ActionName string `json:"actionName"`
Enabled bool `json:"enabled"`
DailyLimit int `json:"dailyLimit"`
CooldownSeconds int `json:"cooldownSeconds"`
MutexGroup string `json:"mutexGroup"`
AssetKey string `json:"assetKey"`
EffectConfig map[string]any `json:"effectConfig"`
ConfigVersion string `json:"configVersion"`
SortNo int `json:"sortNo"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type MaoyuActionConfigViewInp struct {
Id string `json:"id" v:"required#动作配置ID不能为空"`
}
type MaoyuActionConfigViewModel struct{ MaoyuActionConfigListModel }
type MaoyuActionConfigEditInp struct {
Id string `json:"id"`
ActionCode string `json:"actionCode" v:"required|max-length:24|regex:^[a-z][a-z0-9_]*$#动作编码不能为空|动作编码过长|动作编码仅支持小写字母、数字和下划线"`
ActionName string `json:"actionName" v:"required|max-length:64#动作名称不能为空|动作名称过长"`
DailyLimit int `json:"dailyLimit" v:"min:0#每日次数不能为负"`
CooldownSeconds int `json:"cooldownSeconds" v:"min:0#冷却时间不能为负"`
MutexGroup string `json:"mutexGroup" v:"max-length:32#互斥组过长"`
AssetKey string `json:"assetKey" v:"required|max-length:64#素材键不能为空|素材键过长"`
EffectConfig map[string]any `json:"effectConfig"`
SortNo int `json:"sortNo"`
}
type MaoyuActionConfigStatusInp struct {
Id string `json:"id" v:"required#动作配置ID不能为空"`
Reason string `json:"reason"`
}
type MaoyuPetListInp struct {
form.PageReq
UserId string `json:"userId"`
PetType string `json:"petType"`
Status string `json:"status" v:"in:,creating,active,deleted#宠物状态不正确"`
Keyword string `json:"keyword"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *MaoyuPetListInp) Filter(ctx context.Context) (err error) {
if in.CreatedAt != nil && len(in.CreatedAt) == 2 && !in.CreatedAt[0].IsZero() && !in.CreatedAt[1].IsZero() {
in.CreatedAt = []*gtime.Time{in.CreatedAt[0].StartOfDay(), in.CreatedAt[1].EndOfDay()}
} else {
in.CreatedAt = nil
}
in.Keyword = strings.TrimSpace(in.Keyword)
return nil
}
type MaoyuPetListModel struct {
Id string `json:"id"`
UserId string `json:"userId"`
PetType string `json:"petType"`
CustomTypeName string `json:"customTypeName"`
PetName string `json:"petName"`
BirthDate string `json:"birthDate"`
AgeEstimated bool `json:"ageEstimated"`
WeightValue string `json:"weightValue"`
WeightUnit string `json:"weightUnit"`
AvatarFileId string `json:"avatarFileId"`
Status string `json:"status"`
CurrentSceneId string `json:"currentSceneId"`
Version uint `json:"version"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type MaoyuPetViewInp struct {
Id string `json:"id" v:"required#宠物ID不能为空"`
}
type MaoyuPetViewModel struct{ MaoyuPetListModel }
type MaoyuJobListInp struct {
form.PageReq
PetId string `json:"petId"`
UserId string `json:"userId"`
Status string `json:"status" v:"in:,queued,prechecking,generating,reviewing,succeeded,failed,canceled#任务状态不正确"`
ErrorCode string `json:"errorCode"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *MaoyuJobListInp) Filter(ctx context.Context) (err error) {
if in.CreatedAt != nil && len(in.CreatedAt) == 2 && !in.CreatedAt[0].IsZero() && !in.CreatedAt[1].IsZero() {
in.CreatedAt = []*gtime.Time{in.CreatedAt[0].StartOfDay(), in.CreatedAt[1].EndOfDay()}
} else {
in.CreatedAt = nil
}
return nil
}
type MaoyuJobListModel struct {
Id string `json:"id"`
UserId string `json:"userId"`
PetId string `json:"petId"`
Status string `json:"status"`
Stage string `json:"stage"`
Progress int `json:"progress"`
ProgressMode string `json:"progressMode"`
InputFileId string `json:"inputFileId"`
ResultSceneId string `json:"resultSceneId"`
ErrorCode string `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
Provider string `json:"provider"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt"`
CreatedAt string `json:"createdAt"`
UpdatedAt string `json:"updatedAt"`
}
type MaoyuJobViewInp struct {
Id string `json:"id" v:"required#任务ID不能为空"`
}
type MaoyuJobViewModel struct{ MaoyuJobListModel }
type MaoyuNoticeListInp struct {
form.PageReq
RecipientId string `json:"recipientId"`
ActorId string `json:"actorId"`
EventType string `json:"eventType" v:"in:,post_liked,comment_liked,post_commented#通知类型不正确"`
Status string `json:"status" v:"in:,unread,read#通知状态不正确"`
PostId string `json:"postId"`
CreatedAt []*gtime.Time `json:"createdAt"`
}
func (in *MaoyuNoticeListInp) Filter(ctx context.Context) (err error) {
if in.CreatedAt != nil && len(in.CreatedAt) == 2 && !in.CreatedAt[0].IsZero() && !in.CreatedAt[1].IsZero() {
in.CreatedAt = []*gtime.Time{in.CreatedAt[0].StartOfDay(), in.CreatedAt[1].EndOfDay()}
} else {
in.CreatedAt = nil
}
return nil
}
type MaoyuNoticeListModel struct {
Id string `json:"id"`
RecipientId string `json:"recipientId"`
ActorId string `json:"actorId"`
EventType string `json:"eventType"`
EventKey string `json:"eventKey"`
PostId string `json:"postId"`
CommentId string `json:"commentId"`
TargetFileId string `json:"targetFileId"`
Status string `json:"status"`
OccurredAt string `json:"occurredAt"`
ReadAt string `json:"readAt"`
CreatedAt string `json:"createdAt"`
}