mirror of
https://github.com/tiger1103/gfast.git
synced 2026-09-21 10:12:59 +00:00
更新gf版本为v1.14.0 添加按钮权限 友情链接完善 cms模板选择
This commit is contained in:
@@ -38,6 +38,8 @@ type ReqAdd struct {
|
||||
Status uint `p:"status" v:"in:0,1#状态只能包含0或1"`
|
||||
CateAddress string `p:"cate_address"`
|
||||
CateContent string `p:"content"`
|
||||
ListTemplate string `p:"list_template"`
|
||||
ContentTemplate string `p:"content_template"`
|
||||
}
|
||||
|
||||
//修改请求参数
|
||||
@@ -81,6 +83,8 @@ func AddSave(req *ReqAdd) (id int64, err error) {
|
||||
entity.SeoDescription = req.InputSeoDescription
|
||||
entity.CateAddress = req.CateAddress
|
||||
entity.CateContent = req.CateContent
|
||||
entity.ListTemplate = req.ListTemplate
|
||||
entity.ContentTemplate = req.ContentTemplate
|
||||
moreFields := g.Map{}
|
||||
if req.Thumbnail != "" {
|
||||
moreFields["thumb"] = req.Thumbnail
|
||||
@@ -141,6 +145,8 @@ func EditSave(req *ReqEdit) (id int64, err error) {
|
||||
entity.SeoDescription = req.InputSeoDescription
|
||||
entity.CateAddress = req.CateAddress
|
||||
entity.CateContent = req.CateContent
|
||||
entity.ListTemplate = req.ListTemplate
|
||||
entity.ContentTemplate = req.ContentTemplate
|
||||
moreFields := g.Map{}
|
||||
if req.Thumbnail != "" {
|
||||
moreFields["thumb"] = req.Thumbnail
|
||||
|
||||
@@ -11,24 +11,26 @@ import (
|
||||
|
||||
// Entity is the golang structure for table cms_category.
|
||||
type Entity struct {
|
||||
Id uint64 `orm:"id,primary" json:"id"` // 分类id
|
||||
ParentId int64 `orm:"parent_id" json:"parent_id"` // 分类父id
|
||||
ModelId uint `orm:"model_id" json:"model_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"` // 排序
|
||||
Name string `orm:"name" json:"name"` // 分类名称
|
||||
Alias string `orm:"alias" json:"alias"` // 栏目别名
|
||||
Description string `orm:"description" json:"description"` // 分类描述
|
||||
SeoTitle string `orm:"seo_title" json:"seo_title"` //
|
||||
SeoKeywords string `orm:"seo_keywords" json:"seo_keywords"` //
|
||||
SeoDescription string `orm:"seo_description" json:"seo_description"` //
|
||||
ListTpl string `orm:"list_tpl" json:"list_tpl"` // 分类列表模板
|
||||
OneTpl string `orm:"one_tpl" json:"one_tpl"` // 分类文章页模板
|
||||
More string `orm:"more" json:"more"` // 扩展属性
|
||||
CateType uint `orm:"cate_type" json:"cate_type"` // 分类类型
|
||||
CateAddress string `orm:"cate_address" json:"cate_address"` // 跳转地址
|
||||
CateContent string `orm:"cate_content" json:"cate_content"` // 单页内容
|
||||
Id uint64 `orm:"id,primary" json:"id"` // 分类id
|
||||
ParentId int64 `orm:"parent_id" json:"parent_id"` // 分类父id
|
||||
ModelId uint `orm:"model_id" json:"model_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"` // 排序
|
||||
Name string `orm:"name" json:"name"` // 分类名称
|
||||
Alias string `orm:"alias" json:"alias"` // 栏目别名
|
||||
Description string `orm:"description" json:"description"` // 分类描述
|
||||
SeoTitle string `orm:"seo_title" json:"seo_title"` //
|
||||
SeoKeywords string `orm:"seo_keywords" json:"seo_keywords"` //
|
||||
SeoDescription string `orm:"seo_description" json:"seo_description"` //
|
||||
ListTpl string `orm:"list_tpl" json:"list_tpl"` // 分类列表模板
|
||||
OneTpl string `orm:"one_tpl" json:"one_tpl"` // 分类文章页模板
|
||||
More string `orm:"more" json:"more"` // 扩展属性
|
||||
CateType uint `orm:"cate_type" json:"cate_type"` // 分类类型
|
||||
CateAddress string `orm:"cate_address" json:"cate_address"` // 跳转地址
|
||||
CateContent string `orm:"cate_content" json:"cate_content"` // 单页内容
|
||||
ListTemplate string `orm:"list_template" json:"list_template"` //列表页模板
|
||||
ContentTemplate string `orm:"content_template" json:"content_template"` //列表页模板
|
||||
}
|
||||
|
||||
// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
|
||||
|
||||
@@ -24,43 +24,47 @@ var (
|
||||
Model = &arModel{g.DB("default").Table(Table).Safe()}
|
||||
// Columns defines and stores column names for table cms_category.
|
||||
Columns = struct {
|
||||
Id string // 分类id
|
||||
ParentId string // 分类父id
|
||||
ModelId string // 模型ID
|
||||
Status string // 状态,1:发布,0:不发布
|
||||
DeleteTime string // 删除时间
|
||||
ListOrder string // 排序
|
||||
Name string // 分类名称
|
||||
Alias string // 栏目别名
|
||||
Description string // 分类描述
|
||||
SeoTitle string //
|
||||
SeoKeywords string //
|
||||
SeoDescription string //
|
||||
ListTpl string // 分类列表模板
|
||||
OneTpl string // 分类文章页模板
|
||||
More string // 扩展属性
|
||||
CateType string // 分类类型
|
||||
CateAddress string // 跳转地址
|
||||
CateContent string // 单页内容
|
||||
Id string // 分类id
|
||||
ParentId string // 分类父id
|
||||
ModelId string // 模型ID
|
||||
Status string // 状态,1:发布,0:不发布
|
||||
DeleteTime string // 删除时间
|
||||
ListOrder string // 排序
|
||||
Name string // 分类名称
|
||||
Alias string // 栏目别名
|
||||
Description string // 分类描述
|
||||
SeoTitle string //
|
||||
SeoKeywords string //
|
||||
SeoDescription string //
|
||||
ListTpl string // 分类列表模板
|
||||
OneTpl string // 分类文章页模板
|
||||
More string // 扩展属性
|
||||
CateType string // 分类类型
|
||||
CateAddress string // 跳转地址
|
||||
CateContent string // 单页内容
|
||||
ListTemplate string //列表页模板
|
||||
ContentTemplate string //内容页模板
|
||||
}{
|
||||
Id: "id",
|
||||
ParentId: "parent_id",
|
||||
ModelId: "model_id",
|
||||
Status: "status",
|
||||
DeleteTime: "delete_time",
|
||||
ListOrder: "list_order",
|
||||
Name: "name",
|
||||
Alias: "alias",
|
||||
Description: "description",
|
||||
SeoTitle: "seo_title",
|
||||
SeoKeywords: "seo_keywords",
|
||||
SeoDescription: "seo_description",
|
||||
ListTpl: "list_tpl",
|
||||
OneTpl: "one_tpl",
|
||||
More: "more",
|
||||
CateType: "cate_type",
|
||||
CateAddress: "cate_address",
|
||||
CateContent: "cate_content",
|
||||
Id: "id",
|
||||
ParentId: "parent_id",
|
||||
ModelId: "model_id",
|
||||
Status: "status",
|
||||
DeleteTime: "delete_time",
|
||||
ListOrder: "list_order",
|
||||
Name: "name",
|
||||
Alias: "alias",
|
||||
Description: "description",
|
||||
SeoTitle: "seo_title",
|
||||
SeoKeywords: "seo_keywords",
|
||||
SeoDescription: "seo_description",
|
||||
ListTpl: "list_tpl",
|
||||
OneTpl: "one_tpl",
|
||||
More: "more",
|
||||
CateType: "cate_type",
|
||||
CateAddress: "cate_address",
|
||||
CateContent: "cate_content",
|
||||
ListTemplate: "list_template",
|
||||
ContentTemplate: "content_template",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -150,3 +150,18 @@ func SelectListByPage(req *SelectPageReq) (total int, page int64, list []*ListEn
|
||||
}
|
||||
return total, page, list, nil
|
||||
}
|
||||
|
||||
// 获取size条状态为status的广告信息,优先按排序序号排序,其次按时间倒序(status 0停用 1正常)
|
||||
func GetSizeAd(size int, status int, typeId int) ([]*Entity, error) {
|
||||
model := Model
|
||||
model = model.Where("ad_open = ?", status)
|
||||
if typeId != 0 {
|
||||
model = model.Where("ad_adtypeid = ?", typeId)
|
||||
}
|
||||
entity, err := model.Order("ad_sort asc,ad_addtime desc").Limit(size).All()
|
||||
if err != nil {
|
||||
g.Log().Error(err)
|
||||
return nil, gerror.New("查询广告信息失败")
|
||||
}
|
||||
return entity, nil
|
||||
}
|
||||
|
||||
@@ -14,13 +14,16 @@ import (
|
||||
|
||||
// AddReq 用于存储新增链接请求的请求参数
|
||||
type AddReq struct {
|
||||
LinkName string `p:"linkName" v:"required#名称不能为空"` // 链接名称
|
||||
LinkUrl string `p:"linkUrl"` // 链接URL
|
||||
LinkTarget string `p:"linkTarget"` // 打开方式
|
||||
LinkTypeID int `p:"linkTypeID"` // 所属栏目ID
|
||||
LinkQQ string `p:"linkQQ"` // 联系QQ
|
||||
LinkOrder int64 `p:"linkOrder"` // 排序
|
||||
LinkOpen int `p:"linkOpen"` // 0禁用1启用(是否审核)
|
||||
LinkName string `p:"linkName" v:"required#名称不能为空"` // 链接名称
|
||||
LinkUrl string `p:"linkUrl" v:"required#名称不能为空"` // 链接URL
|
||||
LinkTarget string `p:"linkTarget" ` // 打开方式
|
||||
LinkTypeID int `p:"linkTypeID"` // 所属栏目ID
|
||||
LinkQQ string `p:"linkQQ" v:"required#名称不能为空"` // 联系QQ
|
||||
LinkOrder int64 `p:"linkOrder"` // 排序
|
||||
LinkOpen int `p:"linkOpen"` // 0禁用1启用(是否审核)
|
||||
LinkUsername string `p:"linkUsername" v:"required#名称不能为空"` // 申请友情链接的联系人
|
||||
LinkEmail string `p:"linkEmail"` // 联系邮箱
|
||||
LinkRemark string `p:"linkRemark"` // 申请友情链接时的备注
|
||||
}
|
||||
|
||||
// EditReq 用于存储修改广告位请求参数
|
||||
@@ -66,6 +69,9 @@ func AddSave(req *AddReq) error {
|
||||
entity.LinkAddtime = int(gtime.Timestamp()) // 添加时间
|
||||
entity.LinkOrder = req.LinkOrder
|
||||
entity.LinkOpen = req.LinkOpen
|
||||
entity.LinkUsername = req.LinkUsername
|
||||
entity.LinkEmail = req.LinkEmail
|
||||
entity.LinkRemark = req.LinkRemark
|
||||
// 保存实体
|
||||
_, err := entity.Insert()
|
||||
if err != nil {
|
||||
@@ -100,6 +106,9 @@ func EditSave(editReq *EditReq) error {
|
||||
entity.LinkQq = editReq.LinkQQ
|
||||
entity.LinkOrder = editReq.LinkOrder
|
||||
entity.LinkOpen = editReq.LinkOpen
|
||||
entity.LinkUsername = editReq.LinkUsername
|
||||
entity.LinkEmail = editReq.LinkEmail
|
||||
entity.LinkRemark = editReq.LinkRemark
|
||||
_, err = entity.Update()
|
||||
if err != nil {
|
||||
g.Log().Error(err)
|
||||
@@ -147,3 +156,13 @@ func SelectListByPage(req *SelectPageReq) (total int, page int64, list []*ListEn
|
||||
}
|
||||
return total, page, list, nil
|
||||
}
|
||||
|
||||
// 按链接分类查询当前分类下的size条最新链接(status:1启用,0未启用,优先序号排序,其次时间倒序)
|
||||
func ListByTypeId(typeId int, size int, status int) (list []*Entity, err error) {
|
||||
list, err = Model.Where("link_typeid = ?", typeId).And("link_open = ?", status).Fields("link_name,link_url,link_target").Order("link_order asc,link_addtime desc").Limit(size).All()
|
||||
if err != nil {
|
||||
g.Log().Error(err)
|
||||
return nil, gerror.New("按分类查询链接出错")
|
||||
}
|
||||
return list, nil
|
||||
}
|
||||
|
||||
@@ -11,15 +11,18 @@ import (
|
||||
|
||||
// Entity is the golang structure for table plug_link.
|
||||
type Entity struct {
|
||||
LinkId int `orm:"link_id,primary" json:"link_id"` //
|
||||
LinkName string `orm:"link_name" json:"link_name"` // 链接名称
|
||||
LinkUrl string `orm:"link_url" json:"link_url"` // 链接URL
|
||||
LinkTarget string `orm:"link_target" json:"link_target"` // 打开方式
|
||||
LinkTypeid int `orm:"link_typeid" json:"link_typeid"` // 所属栏目ID
|
||||
LinkQq string `orm:"link_qq" json:"link_qq"` // 联系QQ
|
||||
LinkOrder int64 `orm:"link_order" json:"link_order"` // 排序
|
||||
LinkAddtime int `orm:"link_addtime" json:"link_addtime"` // 添加时间
|
||||
LinkOpen int `orm:"link_open" json:"link_open"` // 0禁用1启用
|
||||
LinkId int `orm:"link_id,primary" json:"link_id"` //
|
||||
LinkName string `orm:"link_name" json:"link_name"` // 链接名称
|
||||
LinkUrl string `orm:"link_url" json:"link_url"` // 链接URL
|
||||
LinkTarget string `orm:"link_target" json:"link_target"` // 打开方式
|
||||
LinkTypeid int `orm:"link_typeid" json:"link_typeid"` // 所属栏目ID
|
||||
LinkQq string `orm:"link_qq" json:"link_qq"` // 联系QQ
|
||||
LinkOrder int64 `orm:"link_order" json:"link_order"` // 排序
|
||||
LinkAddtime int `orm:"link_addtime" json:"link_addtime"` // 添加时间
|
||||
LinkOpen int `orm:"link_open" json:"link_open"` // 0禁用1启用
|
||||
LinkUsername string `orm:"link_username" json:"link_username"` // 申请友情链接的联系人
|
||||
LinkEmail string `orm:"link_email" json:"link_email"` // 联系邮箱
|
||||
LinkRemark string `orm:"link_remark" json:"link_remark"` // 申请友情链接时的备注
|
||||
}
|
||||
|
||||
// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
|
||||
|
||||
@@ -24,25 +24,31 @@ var (
|
||||
Model = &arModel{g.DB("default").Table(Table).Safe()}
|
||||
// Columns defines and stores column names for table plug_link.
|
||||
Columns = struct {
|
||||
LinkId string //
|
||||
LinkName string // 链接名称
|
||||
LinkUrl string // 链接URL
|
||||
LinkTarget string // 打开方式
|
||||
LinkTypeid string // 所属栏目ID
|
||||
LinkQq string // 联系QQ
|
||||
LinkOrder string // 排序
|
||||
LinkAddtime string // 添加时间
|
||||
LinkOpen string // 0禁用1启用
|
||||
LinkId string //
|
||||
LinkName string // 链接名称
|
||||
LinkUrl string // 链接URL
|
||||
LinkTarget string // 打开方式
|
||||
LinkTypeid string // 所属栏目ID
|
||||
LinkQq string // 联系QQ
|
||||
LinkOrder string // 排序
|
||||
LinkAddtime string // 添加时间
|
||||
LinkOpen string // 0禁用1启用
|
||||
LinkUsername string // 申请友情链接的联系人
|
||||
LinkEmail string // 联系邮箱
|
||||
LinkRemark string // 申请友情链接时的备注
|
||||
}{
|
||||
LinkId: "link_id",
|
||||
LinkName: "link_name",
|
||||
LinkUrl: "link_url",
|
||||
LinkTarget: "link_target",
|
||||
LinkTypeid: "link_typeid",
|
||||
LinkQq: "link_qq",
|
||||
LinkOrder: "link_order",
|
||||
LinkAddtime: "link_addtime",
|
||||
LinkOpen: "link_open",
|
||||
LinkId: "link_id",
|
||||
LinkName: "link_name",
|
||||
LinkUrl: "link_url",
|
||||
LinkTarget: "link_target",
|
||||
LinkTypeid: "link_typeid",
|
||||
LinkQq: "link_qq",
|
||||
LinkOrder: "link_order",
|
||||
LinkAddtime: "link_addtime",
|
||||
LinkOpen: "link_open",
|
||||
LinkUsername: "link_username",
|
||||
LinkEmail: "link_email",
|
||||
LinkRemark: "link_remark",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ type StatusReq struct {
|
||||
|
||||
//重置用户密码状态参数
|
||||
type ResetPwdReq struct {
|
||||
Id int `p:"userId" v:"required#用户id不能为空"`
|
||||
Id uint64 `p:"userId" v:"required#用户id不能为空"`
|
||||
Password string `p:"password" v:"required|password#密码不能为空|密码以字母开头,只能包含字母、数字和下划线,长度在6~18之间"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user