34 lines
684 B
Go
34 lines
684 B
Go
package model
|
|
|
|
import (
|
|
"encoding/json"
|
|
"yintai-api/app/common/service"
|
|
)
|
|
|
|
type ProcessTranslations struct {
|
|
ProcessID int64
|
|
Lang string
|
|
Title string
|
|
Images string
|
|
Content string
|
|
ProcessTime string
|
|
}
|
|
|
|
func (r *ProcessTranslations) Format() map[string]any {
|
|
res := make(map[string]any)
|
|
images := make([]string, 0)
|
|
_ = json.Unmarshal([]byte(r.Images), &images)
|
|
for _, img := range images {
|
|
img = service.NewQiniu().QuarterUrl(img)
|
|
images = append(images, img)
|
|
}
|
|
res["process_id"] = r.ProcessID
|
|
res["images"] = images
|
|
res["lang"] = r.Lang
|
|
res["title"] = r.Title
|
|
res["content"] = r.Content
|
|
res["process_time"] = r.ProcessTime
|
|
|
|
return res
|
|
}
|