feat: 新增养成管理后台
This commit is contained in:
@@ -0,0 +1,149 @@
|
||||
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 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:"-"`
|
||||
}
|
||||
|
||||
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 CultivateReportHandleInp struct {
|
||||
Id string `json:"id" v:"required#举报ID不能为空"`
|
||||
Action string `json:"action" v:"required|in:processing,resolve,reject#处理动作不能为空|处理动作不正确"`
|
||||
HandleResult string `json:"handleResult"`
|
||||
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)
|
||||
if in.Action != "processing" && in.HandleResult == "" {
|
||||
return gerror.New("办结举报时必须填写处理结果")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type CultivateOperationLogListInp struct {
|
||||
form.PageReq
|
||||
OperatorId string `json:"operatorId"`
|
||||
OperationType string `json:"operationType"`
|
||||
TargetType string `json:"targetType"`
|
||||
CreatedAt []*gtime.Time `json:"createdAt"`
|
||||
}
|
||||
|
||||
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"`
|
||||
}
|
||||
Reference in New Issue
Block a user