291 lines
10 KiB
Go
291 lines
10 KiB
Go
package sysin
|
|
|
|
import (
|
|
"context"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/gogf/gf/v2/errors/gerror"
|
|
"github.com/gogf/gf/v2/os/gtime"
|
|
|
|
"hotgo/internal/model/input/form"
|
|
)
|
|
|
|
type CultivateContentListInp struct {
|
|
form.PageReq
|
|
ObjectType string `json:"objectType" d:"feed_post"`
|
|
AuthorId string `json:"authorId"`
|
|
Status string `json:"status"`
|
|
Keyword string `json:"keyword"`
|
|
CreatedAt []*gtime.Time `json:"createdAt"`
|
|
}
|
|
|
|
func (in *CultivateContentListInp) Filter(context.Context) error {
|
|
in.ObjectType = strings.TrimSpace(in.ObjectType)
|
|
if in.ObjectType != "feed_post" && in.ObjectType != "feed_comment" {
|
|
return gerror.New("内容类型不正确")
|
|
}
|
|
if in.AuthorId != "" {
|
|
if _, err := strconv.ParseUint(in.AuthorId, 10, 64); err != nil {
|
|
return gerror.New("作者ID不正确")
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type CultivateContentListModel struct {
|
|
Id string `json:"id"`
|
|
ObjectType string `json:"objectType"`
|
|
PostId string `json:"postId"`
|
|
AuthorId string `json:"authorId"`
|
|
ContentText string `json:"contentText"`
|
|
FlowerCode string `json:"flowerCode"`
|
|
Visibility string `json:"visibility"`
|
|
Status string `json:"status"`
|
|
AuditStatus string `json:"auditStatus"`
|
|
RejectReason string `json:"rejectReason"`
|
|
LikeCount uint `json:"likeCount"`
|
|
CommentCount uint `json:"commentCount"`
|
|
CreatedAt *gtime.Time `json:"createdAt"`
|
|
UpdatedAt *gtime.Time `json:"updatedAt"`
|
|
}
|
|
|
|
type CultivateContentViewInp struct {
|
|
ObjectType string `json:"objectType" v:"required|in:feed_post,feed_comment#内容类型不能为空|内容类型不正确"`
|
|
Id string `json:"id" v:"required#内容ID不能为空"`
|
|
ObjectId uint64 `json:"-"`
|
|
}
|
|
|
|
func (in *CultivateContentViewInp) Filter(context.Context) error {
|
|
id, err := strconv.ParseUint(strings.TrimSpace(in.Id), 10, 64)
|
|
if err != nil || id == 0 {
|
|
return gerror.New("内容ID不正确")
|
|
}
|
|
in.ObjectId = id
|
|
return nil
|
|
}
|
|
|
|
type CultivateMediaModel struct {
|
|
Id string `json:"id"`
|
|
FileId string `json:"fileId"`
|
|
ThumbnailFileId string `json:"thumbnailFileId"`
|
|
MediaType string `json:"mediaType"`
|
|
AuditStatus string `json:"auditStatus"`
|
|
SortNo uint `json:"sortNo"`
|
|
}
|
|
type CultivateAuditModel struct {
|
|
Id string `json:"id"`
|
|
AuditSource string `json:"auditSource"`
|
|
StatusBefore string `json:"statusBefore"`
|
|
StatusAfter string `json:"statusAfter"`
|
|
ResultCode string `json:"resultCode"`
|
|
RiskLabels any `json:"riskLabels"`
|
|
OperatorId string `json:"operatorId"`
|
|
OccurredAt *gtime.Time `json:"occurredAt"`
|
|
}
|
|
type CultivateContentViewModel struct {
|
|
CultivateContentListModel
|
|
AuthorNickname string `json:"authorNickname"`
|
|
AuthorAvatarFileId string `json:"authorAvatarFileId"`
|
|
Media []*CultivateMediaModel `json:"media"`
|
|
Audits []*CultivateAuditModel `json:"audits"`
|
|
RelatedReports []*CultivateReportListModel `json:"relatedReports"`
|
|
}
|
|
|
|
type CultivateContentReviewInp struct {
|
|
ObjectType string `json:"objectType" v:"required|in:feed_post,feed_comment#内容类型不能为空|内容类型不正确"`
|
|
Id string `json:"id" v:"required#内容ID不能为空"`
|
|
Action string `json:"action" v:"required|in:approve,reject,take_down,restore#审核动作不能为空|审核动作不正确"`
|
|
Reason string `json:"reason"`
|
|
ObjectId uint64 `json:"-"`
|
|
}
|
|
|
|
type CultivateContentBatchReviewInp struct {
|
|
ObjectType string `json:"objectType" v:"required|in:feed_post,feed_comment#内容类型不能为空|内容类型不正确"`
|
|
Ids []string `json:"ids" v:"required#请选择内容"`
|
|
Action string `json:"action" v:"required|in:approve,reject,take_down,restore#审核动作不能为空|审核动作不正确"`
|
|
Reason string `json:"reason"`
|
|
}
|
|
|
|
func (in *CultivateContentBatchReviewInp) Filter(ctx context.Context) error {
|
|
if len(in.Ids) == 0 || len(in.Ids) > 100 {
|
|
return gerror.New("单次批量处理数量必须为1至100条")
|
|
}
|
|
in.Reason = strings.TrimSpace(in.Reason)
|
|
if (in.Action == "reject" || in.Action == "take_down") && in.Reason == "" {
|
|
return gerror.New("拒绝或下架时必须填写原因")
|
|
}
|
|
for _, id := range in.Ids {
|
|
item := &CultivateContentReviewInp{ObjectType: in.ObjectType, Id: id, Action: in.Action, Reason: in.Reason}
|
|
if err := item.Filter(ctx); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type CultivateContentBatchReviewModel struct {
|
|
SuccessCount int `json:"successCount"`
|
|
FailedCount int `json:"failedCount"`
|
|
Failures map[string]string `json:"failures"`
|
|
}
|
|
|
|
func (in *CultivateContentReviewInp) Filter(context.Context) error {
|
|
id, err := strconv.ParseUint(strings.TrimSpace(in.Id), 10, 64)
|
|
if err != nil || id == 0 {
|
|
return gerror.New("内容ID不正确")
|
|
}
|
|
in.ObjectId = id
|
|
in.Reason = strings.TrimSpace(in.Reason)
|
|
if (in.Action == "reject" || in.Action == "take_down") && in.Reason == "" {
|
|
return gerror.New("拒绝或下架时必须填写原因")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type CultivateReportListInp struct {
|
|
form.PageReq
|
|
ObjectType string `json:"objectType"`
|
|
Status string `json:"status"`
|
|
ReporterId string `json:"reporterId"`
|
|
CreatedAt []*gtime.Time `json:"createdAt"`
|
|
}
|
|
|
|
func (in *CultivateReportListInp) Filter(context.Context) error {
|
|
if in.ReporterId != "" {
|
|
if _, err := strconv.ParseUint(in.ReporterId, 10, 64); err != nil {
|
|
return gerror.New("举报人ID不正确")
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type CultivateReportListModel struct {
|
|
Id string `json:"id"`
|
|
ReporterId string `json:"reporterId"`
|
|
ReportedUserId string `json:"reportedUserId"`
|
|
ObjectType string `json:"objectType"`
|
|
ObjectId string `json:"objectId"`
|
|
ReasonCode string `json:"reasonCode"`
|
|
Description string `json:"description"`
|
|
EvidenceFileIds any `json:"evidenceFileIds"`
|
|
SourcePage string `json:"sourcePage"`
|
|
Status string `json:"status"`
|
|
HandlerId string `json:"handlerId"`
|
|
HandleResult string `json:"handleResult"`
|
|
HandledAt *gtime.Time `json:"handledAt"`
|
|
CreatedAt *gtime.Time `json:"createdAt"`
|
|
}
|
|
|
|
type CultivateReportViewInp struct {
|
|
Id string `json:"id" v:"required#举报ID不能为空"`
|
|
ReportId uint64 `json:"-"`
|
|
}
|
|
|
|
func (in *CultivateReportViewInp) Filter(context.Context) error {
|
|
id, err := strconv.ParseUint(strings.TrimSpace(in.Id), 10, 64)
|
|
if err != nil || id == 0 {
|
|
return gerror.New("举报ID不正确")
|
|
}
|
|
in.ReportId = id
|
|
return nil
|
|
}
|
|
|
|
type CultivateReportViewModel struct {
|
|
CultivateReportListModel
|
|
ReporterNickname string `json:"reporterNickname"`
|
|
ReportedUserNickname string `json:"reportedUserNickname"`
|
|
TargetContent *CultivateContentListModel `json:"targetContent"`
|
|
History []*CultivateReportListModel `json:"history"`
|
|
}
|
|
|
|
type CultivateReportHandleInp struct {
|
|
Id string `json:"id" v:"required#举报ID不能为空"`
|
|
Action string `json:"action" v:"required|in:processing,resolve,reject#处理动作不能为空|处理动作不正确"`
|
|
HandleResult string `json:"handleResult"`
|
|
ContentAction string `json:"contentAction" v:"in:none,take_down#内容处置不正确"`
|
|
UserAction string `json:"userAction" v:"in:none,freeze,ban#用户处置不正确"`
|
|
Reason string `json:"reason"`
|
|
ReportId uint64 `json:"-"`
|
|
}
|
|
|
|
func (in *CultivateReportHandleInp) Filter(context.Context) error {
|
|
id, err := strconv.ParseUint(strings.TrimSpace(in.Id), 10, 64)
|
|
if err != nil || id == 0 {
|
|
return gerror.New("举报ID不正确")
|
|
}
|
|
in.ReportId = id
|
|
in.HandleResult = strings.TrimSpace(in.HandleResult)
|
|
in.ContentAction = strings.TrimSpace(in.ContentAction)
|
|
in.UserAction = strings.TrimSpace(in.UserAction)
|
|
in.Reason = strings.TrimSpace(in.Reason)
|
|
if in.ContentAction == "" {
|
|
in.ContentAction = "none"
|
|
}
|
|
if in.UserAction == "" {
|
|
in.UserAction = "none"
|
|
}
|
|
if in.Action != "processing" && in.HandleResult == "" {
|
|
return gerror.New("办结举报时必须填写处理结果")
|
|
}
|
|
if (in.ContentAction != "none" || in.UserAction != "none") && in.Reason == "" {
|
|
return gerror.New("联动处置时必须填写处置原因")
|
|
}
|
|
if in.Action != "resolve" && (in.ContentAction != "none" || in.UserAction != "none") {
|
|
return gerror.New("仅确认处理时可执行内容或用户处置")
|
|
}
|
|
return nil
|
|
}
|
|
|
|
type CultivateOperationLogListInp struct {
|
|
form.PageReq
|
|
OperatorId string `json:"operatorId"`
|
|
OperationType string `json:"operationType"`
|
|
TargetType string `json:"targetType"`
|
|
TargetId string `json:"targetId"`
|
|
RequestId string `json:"requestId"`
|
|
CreatedAt []*gtime.Time `json:"createdAt"`
|
|
}
|
|
|
|
type CultivateDashboardInp struct{}
|
|
|
|
func (*CultivateDashboardInp) Filter(context.Context) error { return nil }
|
|
|
|
type CultivateDashboardModel struct {
|
|
PlantCount int64 `json:"plantCount"`
|
|
GrowingCount int64 `json:"growingCount"`
|
|
BloomCount int64 `json:"bloomCount"`
|
|
HarvestedCount int64 `json:"harvestedCount"`
|
|
RemovedCount int64 `json:"removedCount"`
|
|
Active7d int64 `json:"active7d"`
|
|
Active30d int64 `json:"active30d"`
|
|
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"`
|
|
ProcessingReportCount int64 `json:"processingReportCount"`
|
|
ProcessedReportCount int64 `json:"processedReportCount"`
|
|
}
|
|
|
|
func (*CultivateOperationLogListInp) Filter(context.Context) error { return nil }
|
|
|
|
type CultivateOperationLogListModel struct {
|
|
Id string `json:"id"`
|
|
OperatorId string `json:"operatorId"`
|
|
OperationType string `json:"operationType"`
|
|
TargetType string `json:"targetType"`
|
|
TargetId string `json:"targetId"`
|
|
RequestId string `json:"requestId"`
|
|
BeforeSnapshot any `json:"beforeSnapshot"`
|
|
AfterSnapshot any `json:"afterSnapshot"`
|
|
Reason string `json:"reason"`
|
|
CreatedAt *gtime.Time `json:"createdAt"`
|
|
}
|