mirror of
https://github.com/tiger1103/gfast.git
synced 2026-09-20 17:57:51 +00:00
文章管理
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"gfast/library/response"
|
||||
"github.com/gogf/gf/net/ghttp"
|
||||
)
|
||||
|
||||
type CmsModel struct{}
|
||||
|
||||
func (c *CmsModel) List(r *ghttp.Request) {
|
||||
response.FailJson(true, r, "功能开发中...")
|
||||
}
|
||||
|
||||
//添加模型
|
||||
func (c *CmsModel) Add(r *ghttp.Request) {
|
||||
response.FailJson(true, r, "功能开发中...")
|
||||
}
|
||||
@@ -7,6 +7,12 @@ import (
|
||||
|
||||
type CmsNews struct{}
|
||||
|
||||
func (c CmsNews) NewsList(r *ghttp.Request) {
|
||||
func (c *CmsNews) List(r *ghttp.Request) {
|
||||
response.SusJson(true, r, "信息列表")
|
||||
}
|
||||
|
||||
//添加信息
|
||||
func (c *CmsNews) Add(r *ghttp.Request) {
|
||||
//获取可选栏目
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ type ReqSearchList struct {
|
||||
|
||||
//添加请求参数
|
||||
type ReqAdd struct {
|
||||
ParentId uint64 `p:"parent_id" v:"integer|min:0#父级ID不能为空|父级ID必须为大于等于0的整数"`
|
||||
ParentId int64 `p:"parent_id" v:"integer|min:0#父级ID不能为空|父级ID必须为大于等于0的整数"`
|
||||
Name string `p:"name" v:"required#栏目名称不能为空"`
|
||||
Alias string `p:"alias"`
|
||||
CateType uint `p:"cate_type" v:"required|in:1,2,3,4#请选择栏目类型|栏目类型只能在1-4之间"`
|
||||
@@ -56,27 +56,13 @@ func GetList() (list []*Entity, err error) {
|
||||
if err != nil {
|
||||
g.Log().Error()
|
||||
err = gerror.New("获取菜单数据失败")
|
||||
return
|
||||
}
|
||||
//缓存数据
|
||||
cache.Set(cache_service.AdminCmsMenu, list, 0, cache_service.AdminCmsTag)
|
||||
return
|
||||
}
|
||||
|
||||
//获取频道列表
|
||||
func GetListChannel() (list []*Entity, err error) {
|
||||
listAll, err := GetList()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
list = make([]*Entity, 0, len(listAll))
|
||||
for _, v := range listAll {
|
||||
if v.Status == 1 && v.CateType == ChannelCateType {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//保存栏目操作
|
||||
func AddSave(req *ReqAdd) (id int64, err error) {
|
||||
var entity Entity
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
// Entity is the golang structure for table cms_category.
|
||||
type Entity struct {
|
||||
Id uint64 `orm:"id,primary" json:"id"` // 分类id
|
||||
ParentId uint64 `orm:"parent_id" json:"parent_id"` // 分类父id
|
||||
ParentId int64 `orm:"parent_id" json:"parent_id"` // 分类父id
|
||||
Status uint `orm:"status" json:"status"` // 状态,1:发布,0:不发布
|
||||
DeleteTime uint `orm:"delete_time" json:"delete_time"` // 删除时间
|
||||
ListOrder float64 `orm:"list_order" json:"list_order"` // 排序
|
||||
|
||||
@@ -6,12 +6,39 @@ import (
|
||||
|
||||
//获取频道列表
|
||||
func GetMenuListChannel() (list []*cms_category.Entity, err error) {
|
||||
return cms_category.GetListChannel()
|
||||
//获取频道列表
|
||||
listAll, err := GetMenuList()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
list = make([]*cms_category.Entity, 0, len(listAll))
|
||||
for _, v := range listAll {
|
||||
if v.Status == 1 && v.CateType == cms_category.ChannelCateType {
|
||||
list = append(list, v)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//获取可发布文章栏目
|
||||
func GetPublishableMenuList() (list []*cms_category.Entity, err error) {
|
||||
menuList, err := GetMenuList()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
list = make([]*cms_category.Entity, 0, len(menuList))
|
||||
for _, menu := range menuList {
|
||||
if menu.Status == 1 {
|
||||
list = append(list, menu)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//获取所有菜单列表
|
||||
func GetMenuList() (list []*cms_category.Entity, err error) {
|
||||
return cms_category.GetList()
|
||||
return
|
||||
//return cms_category.GetList()
|
||||
}
|
||||
|
||||
//保存栏目操作
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
package cms_service
|
||||
Reference in New Issue
Block a user