yintai2/app/common/model/document.go

52 lines
1.0 KiB
Go

package model
import (
"time"
"yintai-api/app/common/service"
)
type Document struct {
ID int64
Code string
Weight int64
CreateTime int64
UpdateTime int64
}
type DocumentPage struct {
Document
DocumentTranslations
CategoryID int64
CategoryName string
CategoryEn string
}
func (d *DocumentPage) Format() map[string]any {
res := make(map[string]any)
res["id"] = d.ID
res["code"] = d.Code
res["create_time"] = time.Now().Format("2006-01-02 15:04:05")
res["lang"] = d.Lang
res["name"] = d.Name
res["title"] = d.Title
res["sub_title"] = d.SubTitle
res["image_title"] = d.ImageTitle
res["desc"] = d.Description
res["path"] = service.NewQiniu().QuarterUrl(d.StoragePath)
res["cover"] = service.NewQiniu().QuarterUrl(d.Cover)
res["extra"] = d.Extra
res["category_id"] = d.CategoryID
res["category_name"] = d.CategoryName
res["categroy_name_en"] = d.CategoryEn
res["weight"] = d.Weight
return res
}
func (r *Document) Format() map[string]any {
res := make(map[string]any)
return res
}