feat: 新增创作作品管理模块及相关配置
This commit is contained in:
115
workflow/model/dto/creation_info_dto.go
Normal file
115
workflow/model/dto/creation_info_dto.go
Normal file
@@ -0,0 +1,115 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
"gitea.com/red-future/common/beans"
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/os/gtime"
|
||||
)
|
||||
|
||||
type CreationInput struct {
|
||||
g.Meta `path:"/creation" method:"post" tags:"创作作品管理" summary:"作品创作" dc:"作品创作"`
|
||||
|
||||
Mode string `json:"mode"`
|
||||
ContentType string `json:"content_type"`
|
||||
Theme string `json:"theme"`
|
||||
Title string `json:"title"`
|
||||
Style string `json:"style"`
|
||||
Count int `json:"count"`
|
||||
ImagePerPost int `json:"image_per_post"`
|
||||
ImageRatio string `json:"image_ratio"`
|
||||
Desc string `json:"desc"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
type ImageUploadItem struct {
|
||||
Title string `json:"title"` // 内容标题
|
||||
Index int `json:"index"` // 第几条
|
||||
ImageUrls []string `json:"image_urls"` // 上传成功的图片URL列表
|
||||
HtmlFileUrl string `json:"html_file_url"` // 上传成功的HTML文件URL(如有)
|
||||
Theme string `json:"theme"`
|
||||
ContentType string `json:"content_type"`
|
||||
}
|
||||
|
||||
// CreationOutput 接口最终返回结构体(你原有dto,这里补充完整)
|
||||
type CreationOutput struct {
|
||||
SuccessCount int `json:"success_count"` // 成功条数
|
||||
Items []ImageUploadItem `json:"items"` // 所有上传成功的详情
|
||||
}
|
||||
|
||||
type Create struct {
|
||||
HtmlFileUrl string
|
||||
ImageUrls []string
|
||||
ContentType string
|
||||
Theme string
|
||||
Title string
|
||||
}
|
||||
|
||||
// UploadFileBytesReq 上传文件请求(字节流)
|
||||
type UploadFileBytesReq struct {
|
||||
FileName string `json:"fileName" dc:"文件名"`
|
||||
FileBytes []byte `json:"fileBytes" dc:"文件字节流"`
|
||||
FileStoreURL string `json:"fileStoreURL" dc:"文件存储URL"`
|
||||
}
|
||||
|
||||
type UploadFileBytesRes struct {
|
||||
FileURL string `json:"fileURL" dc:"上传地址"`
|
||||
FileSize int `json:"fileSize" dc:"文件大小"`
|
||||
FileName string `json:"fileName" dc:"文件名称"`
|
||||
FileFormat string `json:"fileFormat" dc:"文件格式"`
|
||||
FileAddressPrefix string `json:"fileAddressPrefix"`
|
||||
}
|
||||
|
||||
type ListCreationInfoReq struct {
|
||||
g.Meta `path:"/list" method:"get" tags:"创作作品管理" summary:"作品列表" dc:"作品列表"`
|
||||
|
||||
Page *beans.Page `json:"page"`
|
||||
Creator string `json:"creator"`
|
||||
}
|
||||
|
||||
type ListCreationInfoRes struct {
|
||||
List []*CreationInfoVO `json:"list"`
|
||||
Total int `json:"total"`
|
||||
Tree []TimeNode
|
||||
ImgAddressPrefix string `json:"imgAddressPrefix"`
|
||||
}
|
||||
|
||||
type CreationInfoVO struct {
|
||||
Id int64 `json:"id,string" dc:"id"`
|
||||
HtmlFileUrl string `json:"htmlFileUrl"`
|
||||
ImageUrls []string `json:"imageUrls"`
|
||||
Theme string `json:"theme"`
|
||||
Title string `json:"title"`
|
||||
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
|
||||
UpdatedAt *gtime.Time `json:"updatedAt" dc:"更新时间"`
|
||||
}
|
||||
|
||||
// 第一层:日期
|
||||
type TimeNode struct {
|
||||
CreatedDate string `json:"createdDate"`
|
||||
ContentTypes []ContentTypeNode `json:"contentTypes"`
|
||||
}
|
||||
|
||||
// 第二层:ContentType
|
||||
type ContentTypeNode struct {
|
||||
ContentType string `json:"contentType"`
|
||||
Themes []ThemeNode `json:"themes"`
|
||||
}
|
||||
|
||||
// 第三层:Theme
|
||||
type ThemeNode struct {
|
||||
Theme string `json:"theme"`
|
||||
Titles []TitleNode `json:"titles"`
|
||||
}
|
||||
|
||||
// Title 节点:Title-1、Title-2...
|
||||
type TitleNode struct {
|
||||
Title string `json:"title"` // 标题+编号:如 通勤-1
|
||||
HtmlFileUrl string `json:"htmlFileUrl"` // html地址
|
||||
ImageUrls []ImgNode `json:"imageUrls"` // 图片列表
|
||||
}
|
||||
|
||||
// 图片
|
||||
type ImgNode struct {
|
||||
Name string `json:"name"` // img+1
|
||||
Url string `json:"url"`
|
||||
}
|
||||
31
workflow/model/entity/creation_info.go
Normal file
31
workflow/model/entity/creation_info.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package entity
|
||||
|
||||
import "gitea.com/red-future/common/beans"
|
||||
|
||||
type CreationInfo struct {
|
||||
beans.SQLBaseDO `orm:",inherit"` // 嵌入基础字段:Id, TenantId, Creator, CreatedAt, Updater, UpdatedAt, DeletedAt
|
||||
// 业务字段
|
||||
HtmlFileUrl string `orm:"html_file_url" json:"htmlFileUrl"`
|
||||
ImageUrls []string `orm:"image_urls" json:"imageUrls"`
|
||||
ContentType string `orm:"content_type" json:"contentType"`
|
||||
Theme string `orm:"theme" json:"theme"`
|
||||
Title string `orm:"title" json:"title"`
|
||||
}
|
||||
|
||||
type creationInfoCol struct {
|
||||
beans.SQLBaseCol
|
||||
HtmlFileUrl string
|
||||
ImageUrls string
|
||||
ContentType string
|
||||
Theme string
|
||||
Title string
|
||||
}
|
||||
|
||||
var CreationInfoCol = creationInfoCol{
|
||||
SQLBaseCol: beans.DefSQLBaseCol,
|
||||
HtmlFileUrl: "html_file_url",
|
||||
ImageUrls: "image_urls",
|
||||
ContentType: "content_type",
|
||||
Theme: "theme",
|
||||
Title: "title",
|
||||
}
|
||||
Reference in New Issue
Block a user