优化backend产品和解决方案
This commit is contained in:
@@ -60,6 +60,7 @@ func cmsSolutionToMap(row models.CmsSolution) map[string]interface{} {
|
||||
"title": row.Title,
|
||||
"thumb": row.Thumb,
|
||||
"desc": row.Desc,
|
||||
"content": row.Content,
|
||||
"url": row.URL,
|
||||
"sort": row.Sort,
|
||||
"status": row.Status,
|
||||
@@ -141,12 +142,13 @@ func (c *BackendSolutionController) List() {
|
||||
}
|
||||
|
||||
type cmsSolutionPayload struct {
|
||||
Title string `json:"title"`
|
||||
Thumb string `json:"thumb"`
|
||||
Desc string `json:"desc"`
|
||||
URL string `json:"url"`
|
||||
Sort int `json:"sort"`
|
||||
Status int8 `json:"status"`
|
||||
Title string `json:"title"`
|
||||
Thumb string `json:"thumb"`
|
||||
Desc string `json:"desc"`
|
||||
Content string `json:"content"`
|
||||
URL string `json:"url"`
|
||||
Sort int `json:"sort"`
|
||||
Status int8 `json:"status"`
|
||||
}
|
||||
|
||||
// Create POST /backend/addServices
|
||||
@@ -187,6 +189,7 @@ func (c *BackendSolutionController) Create() {
|
||||
Title: title,
|
||||
Thumb: strings.TrimSpace(p.Thumb),
|
||||
Desc: strings.TrimSpace(p.Desc),
|
||||
Content: p.Content,
|
||||
URL: strings.TrimSpace(p.URL),
|
||||
Sort: p.Sort,
|
||||
Status: p.Status,
|
||||
@@ -245,6 +248,7 @@ func (c *BackendSolutionController) Update() {
|
||||
"title": title,
|
||||
"thumb": strings.TrimSpace(p.Thumb),
|
||||
"desc": strings.TrimSpace(p.Desc),
|
||||
"content": p.Content,
|
||||
"url": strings.TrimSpace(p.URL),
|
||||
"sort": p.Sort,
|
||||
"status": p.Status,
|
||||
|
||||
@@ -2,8 +2,6 @@ package models
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
type BackendMenuFront struct {
|
||||
@@ -27,7 +25,3 @@ type BackendMenuFront struct {
|
||||
func (m *BackendMenuFront) TableName() string {
|
||||
return "yz_backend_menu_front"
|
||||
}
|
||||
|
||||
func init() {
|
||||
orm.RegisterModel(new(BackendMenuFront))
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ type CmsSolution struct {
|
||||
Title string `orm:"column(title);size(100)" json:"title"`
|
||||
Thumb string `orm:"column(thumb);size(500);default()" json:"thumb"`
|
||||
Desc string `orm:"column(desc);size(500);default()" json:"desc"`
|
||||
Content string `orm:"column(content);type(mediumtext);null" json:"content"`
|
||||
URL string `orm:"column(url);size(500);default()" json:"url"`
|
||||
Sort int `orm:"column(sort);default(0)" json:"sort"`
|
||||
Status int8 `orm:"column(status);default(1)" json:"status"`
|
||||
@@ -55,6 +56,7 @@ CREATE TABLE IF NOT EXISTS yz_cms_solution (
|
||||
title varchar(100) NOT NULL DEFAULT '',
|
||||
thumb varchar(500) NOT NULL DEFAULT '',
|
||||
` + "`desc`" + ` varchar(500) NOT NULL DEFAULT '',
|
||||
content mediumtext,
|
||||
url varchar(500) NOT NULL DEFAULT '',
|
||||
sort int NOT NULL DEFAULT 0,
|
||||
status tinyint NOT NULL DEFAULT 1,
|
||||
@@ -67,6 +69,8 @@ CREATE TABLE IF NOT EXISTS yz_cms_solution (
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
// 确保已有表补齐 content 字段
|
||||
_, _ = Orm.Raw("ALTER TABLE yz_cms_solution ADD COLUMN content mediumtext").Exec()
|
||||
_, err = Orm.Raw(`
|
||||
CREATE TABLE IF NOT EXISTS yz_cms_solution_category (
|
||||
id bigint unsigned NOT NULL AUTO_INCREMENT,
|
||||
|
||||
@@ -69,11 +69,16 @@ func Init(_ string) {
|
||||
|
||||
new(CmsArticleCategory),
|
||||
new(CmsArticle),
|
||||
new(CmsProductCategory),
|
||||
new(CmsProduct),
|
||||
new(CmsSolutionCategory),
|
||||
new(CmsSolution),
|
||||
|
||||
new(CmsFrontendTemplate),
|
||||
new(CmsFrontendBanner),
|
||||
new(CmsFrontendFriendlink),
|
||||
new(CmsFrontendOnepage),
|
||||
new(BackendMenuFront),
|
||||
|
||||
new(SystemReminderList),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user