Просмотр исходного кода

更新gf版本为v1.14.0 添加按钮权限 友情链接完善 cms模板选择

yxh 5 лет назад
Родитель
Сommit
883f42eee6

+ 11 - 5
app/controller/admin/cms_menu.go

@@ -77,9 +77,12 @@ func (c *CmsMenu) Add(r *ghttp.Request) {
 	if err != nil {
 		response.FailJson(true, r, err.Error())
 	}
-
+	//获取分类栏目模板
+	ListTemp, contentTemp := cms_service.GetCmsTemplate()
 	res := g.Map{
-		"parentList": menus,
+		"parentList":  menus,
+		"listTemp":    ListTemp,
+		"contentTemp": contentTemp,
 	}
 	response.SusJson(true, r, "添加栏目", res)
 }
@@ -119,10 +122,13 @@ func (c *CmsMenu) Edit(r *ghttp.Request) {
 	if err != nil {
 		response.FailJson(true, r, err.Error())
 	}
-
+	//获取分类栏目模板
+	ListTemp, contentTemp := cms_service.GetCmsTemplate()
 	res := g.Map{
-		"menuInfo":   menuInfo,
-		"parentList": menus,
+		"menuInfo":    menuInfo,
+		"parentList":  menus,
+		"listTemp":    ListTemp,
+		"contentTemp": contentTemp,
 	}
 	response.SusJson(true, r, "修改栏目", res)
 }

+ 15 - 1
app/controller/admin/index.go

@@ -27,6 +27,7 @@ func (c *Index) GetInfo(r *ghttp.Request) {
 	}
 	userInfo := gconv.Map(userEntity)
 	rolesList := make([]string, 0, 10)
+	var permissions []string
 	if userInfo != nil {
 		userId := userEntity.Id
 		delete(userInfo, "user_password")
@@ -44,6 +45,19 @@ func (c *Index) GetInfo(r *ghttp.Request) {
 					roleIds[k] = v.Id
 				}
 				userInfo["roles"] = roles
+				isSuperAdmin := false
+				//获取无需验证权限的用户id
+				for _, v := range service.NotCheckAuthAdminIds {
+					if gconv.Uint64(v) == userId {
+						isSuperAdmin = true
+						break
+					}
+				}
+				if isSuperAdmin {
+					permissions = []string{"*/*/*"}
+				} else {
+					permissions, err = user_service.GetPermissions(roleIds)
+				}
 				rolesList = name
 			} else {
 				g.Log().Error(err)
@@ -56,7 +70,7 @@ func (c *Index) GetInfo(r *ghttp.Request) {
 	result := g.Map{
 		"user":        userInfo,
 		"roles":       rolesList,
-		"permissions": nil,
+		"permissions": permissions,
 	}
 
 	response.SusJson(true, r, "ok", result)

+ 1 - 1
app/controller/admin/plug_link.go

@@ -23,7 +23,7 @@ func (c *PlugLink) Add(r *ghttp.Request) {
 			response.FailJson(true, r, err.(*gvalid.Error).FirstString())
 		}
 		// 调用service中的添加函数添加链接
-		err = plug_link.AddSave(req)
+		err = plug_link_service.AddSavePlugLink(req)
 		if err != nil {
 			response.FailJson(true, r, err.Error())
 		}

+ 6 - 0
app/model/admin/cms_category/cms_category.go

@@ -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

+ 20 - 18
app/model/admin/cms_category/cms_category_entity.go

@@ -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

+ 40 - 36
app/model/admin/cms_category/cms_category_model.go

@@ -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",
 	}
 )
 

+ 15 - 0
app/model/admin/plug_ad/plug_ad.go

@@ -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
+}

+ 26 - 7
app/model/admin/plug_link/plug_link.go

@@ -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
+}

+ 12 - 9
app/model/admin/plug_link/plug_link_entity.go

@@ -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 - 18
app/model/admin/plug_link/plug_link_model.go

@@ -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",
 	}
 )
 

+ 1 - 1
app/model/admin/user/user.go

@@ -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之间"`
 }
 

+ 16 - 2
app/service/admin/auth_service/auth_rule.go

@@ -30,7 +30,7 @@ func GetIsMenuList() ([]*auth_rule.Entity, error) {
 	return gList, nil
 }
 
-//获取isMenu=1且status=1的菜单列表
+//获取isMenu=0|1且status=1的菜单列表
 func GetIsMenuStatusList() ([]*auth_rule.Entity, error) {
 	list, err := GetMenuList()
 	if err != nil {
@@ -45,6 +45,21 @@ func GetIsMenuStatusList() ([]*auth_rule.Entity, error) {
 	return gList, nil
 }
 
+//获取所有按钮isMenu=2 且status=1的菜单列表
+func GetIsButtonStatusList() ([]*auth_rule.Entity, error) {
+	list, err := GetMenuList()
+	if err != nil {
+		return nil, err
+	}
+	var gList = make([]*auth_rule.Entity, 0, len(list))
+	for _, v := range list {
+		if v.MenuType == 2 && v.Status == 1 {
+			gList = append(gList, v)
+		}
+	}
+	return gList, nil
+}
+
 //获取status==1的菜单列表
 func GetMenuIsStatusList() ([]*auth_rule.Entity, error) {
 	list, err := GetMenuList()
@@ -80,7 +95,6 @@ func GetMenuListSearch(req *auth_rule.ReqSearch) (list []*auth_rule.Entity, err
 		}
 		list = tmpList
 	}
-	g.Log().Debug(list)
 	return
 }
 

+ 24 - 0
app/service/admin/cms_service/menu.go

@@ -9,6 +9,8 @@ import (
 	"github.com/gogf/gf/errors/gerror"
 	"github.com/gogf/gf/frame/g"
 	"github.com/gogf/gf/net/ghttp"
+	"github.com/gogf/gf/os/gfile"
+	"github.com/gogf/gf/text/gstr"
 	"github.com/gogf/gf/util/gconv"
 )
 
@@ -149,3 +151,25 @@ func GetModelIdByCateIds(ids []int) (modelId uint, err error) {
 	}
 	return
 }
+
+//获取分类模板
+func GetCmsTemplate() ([]string, []string) {
+	pathArr := g.Cfg().GetArray("viewer.paths")
+	var listTemplates []string
+	var contentTemplates []string
+	for _, p := range pathArr {
+		path := gconv.String(p) + "/cms"
+		if gfile.IsDir(path) {
+			path = gfile.Abs(path)
+			cmsPath, _ := gfile.ScanDirFile(path, "*", true)
+			for _, cp := range cmsPath {
+				if gstr.ContainsI(cp, "list") {
+					listTemplates = append(listTemplates, gstr.TrimLeft(gstr.ReplaceByArray(cp, []string{path, "", "\\", "/"}), "/"))
+				} else if gstr.ContainsI(cp, "content") {
+					contentTemplates = append(contentTemplates, gstr.TrimLeft(gstr.ReplaceByArray(cp, []string{path, "", "\\", "/"}), "/"))
+				}
+			}
+		}
+	}
+	return listTemplates, contentTemplates
+}

+ 5 - 0
app/service/admin/plug_link_service/plugLink.go

@@ -28,3 +28,8 @@ func GetPlugLinkByID(id int64) (*plug_link.Entity, error) {
 func SelectPlugLinkListByPage(req *plug_link.SelectPageReq) (total int, page int64, list []*plug_link.ListEntity, err error) {
 	return plug_link.SelectListByPage(req)
 }
+
+// 按链接分类查询当前分类下的size条最新链接(status:1启用,0未启用,优先序号排序,其次时间倒序)
+func ListByTypeId(typeId int, size int, status int) (list []*plug_link.Entity, err error) {
+	return plug_link.ListByTypeId(typeId, size, status)
+}

+ 5 - 0
app/service/admin/plug_service/plugAd.go

@@ -28,3 +28,8 @@ func GetPlugAdByID(id int64) (*plug_ad.Entity, error) {
 func SelectPlugAdListByPage(req *plug_ad.SelectPageReq) (total int, page int64, list []*plug_ad.ListEntity, err error) {
 	return plug_ad.SelectListByPage(req)
 }
+
+// 获取size条状态为status的广告信息,优先按排序序号排序,其次按时间倒序(status 0停用 1正常)
+func GetSizeAd(size int, status int, typeId int) ([]*plug_ad.Entity, error) {
+	return plug_ad.GetSizeAd(size, status, typeId)
+}

+ 31 - 2
app/service/admin/user_service/user.go

@@ -53,7 +53,7 @@ func UpdatePwd(r *ghttp.Request, data *UpdatePwdReq) error {
 	}
 
 	return ResetUserPwd(&user.ResetPwdReq{
-		Id:       currentUser["id"].(int),
+		Id:       gconv.Uint64(currentUser["id"]),
 		Password: data.NewPassword,
 	})
 }
@@ -140,7 +140,7 @@ func GetAdminList(req *user.SearchReq) (total, page int, userList []*user.Entity
 	if req.DeptId != "" {
 		depts, err = sys_dept.GetList(&sys_dept.SearchParams{Status: "1"})
 		if err != nil {
-			g.Log().Debug(err)
+			g.Log().Error(err)
 			err = gerror.New("获取部门信息失败")
 			return
 		}
@@ -168,6 +168,9 @@ func GetAdminRole(userId uint64, allRoleList []*role.Entity) (roles []*role.Enti
 				roles = append(roles, v)
 			}
 		}
+		if len(roles) == len(roleIds) {
+			break
+		}
 	}
 	return
 }
@@ -284,3 +287,29 @@ func ResetUserPwd(req *user.ResetPwdReq) error {
 	req.Password = utils.EncryptCBC(gconv.String(req.Password), utils.AdminCbcPublicKey)
 	return user.ResetUserPwd(req)
 }
+
+func GetPermissions(roleIds []uint) ([]string, error) {
+	//获取角色对应的菜单id
+	enforcer, err := casbin_adapter_service.GetEnforcer()
+	if err != nil {
+		return nil, err
+	}
+	menuIds := map[int64]int64{}
+	for _, roleId := range roleIds {
+		//查询当前权限
+		gp := enforcer.GetFilteredPolicy(0, fmt.Sprintf("g_%d", roleId))
+		for _, p := range gp {
+			mid := gconv.Int64(gstr.SubStr(p[1], 2))
+			menuIds[mid] = mid
+		}
+	}
+	//获取所有开启的按钮
+	allButtons, err := auth_service.GetIsButtonStatusList()
+	userButtons := make([]string, 0, len(allButtons))
+	for _, button := range allButtons {
+		if _, ok := menuIds[gconv.Int64(button.Id)]; gstr.Equal(button.Condition, "nocheck") || ok {
+			userButtons = append(userButtons, button.Name)
+		}
+	}
+	return userButtons, nil
+}

+ 28 - 16
app/service/cache_service/cache.go

@@ -25,7 +25,7 @@ func (c *CacheTagService) cacheTagKey(key interface{}, tag interface{}) {
 	c.setTagKey(tag)
 	if c.tagKey != nil {
 		tagValue := []interface{}{key}
-		value := gcache.Get(c.tagKey)
+		value, _ := gcache.Get(c.tagKey)
 		if value != nil {
 			keyValue := gconv.SliceAny(value)
 			for _, v := range keyValue {
@@ -60,7 +60,8 @@ func (c *CacheTagService) SetIfNotExist(key interface{}, value interface{}, dura
 	tagSetMux.Lock()
 	defer tagSetMux.Unlock()
 	c.cacheTagKey(key, tag)
-	return gcache.SetIfNotExist(key, value, duration)
+	v, _ := gcache.SetIfNotExist(key, value, duration)
+	return v
 }
 
 // Sets batch sets cache with tagKey-value pairs by <data>, which is expired after <duration>.
@@ -82,7 +83,8 @@ func (c *CacheTagService) Sets(data map[interface{}]interface{}, duration time.D
 // Get returns the value of <tagKey>.
 // It returns nil if it does not exist or its value is nil.
 func (c *CacheTagService) Get(key interface{}) interface{} {
-	return gcache.Get(key)
+	v, _ := gcache.Get(key)
+	return v
 }
 
 // GetOrSet returns the value of <tagKey>,
@@ -94,17 +96,19 @@ func (c *CacheTagService) GetOrSet(key interface{}, value interface{}, duration
 	tagSetMux.Lock()
 	defer tagSetMux.Unlock()
 	c.cacheTagKey(key, tag)
-	return gcache.GetOrSet(key, value, duration)
+	v, _ := gcache.GetOrSet(key, value, duration)
+	return v
 }
 
 // GetOrSetFunc returns the value of <tagKey>, or sets <tagKey> with result of function <f>
 // and returns its result if <tagKey> does not exist in the cache. The tagKey-value pair expires
 // after <duration>. It does not expire if <duration> <= 0.
-func (c *CacheTagService) GetOrSetFunc(key interface{}, f func() interface{}, duration time.Duration, tag interface{}) interface{} {
+func (c *CacheTagService) GetOrSetFunc(key interface{}, f func() (interface{}, error), duration time.Duration, tag interface{}) interface{} {
 	tagSetMux.Lock()
 	defer tagSetMux.Unlock()
 	c.cacheTagKey(key, tag)
-	return gcache.GetOrSetFunc(key, f, duration)
+	v, _ := gcache.GetOrSetFunc(key, f, duration)
+	return v
 }
 
 // GetOrSetFuncLock returns the value of <tagKey>, or sets <tagKey> with result of function <f>
@@ -112,26 +116,29 @@ func (c *CacheTagService) GetOrSetFunc(key interface{}, f func() interface{}, du
 // after <duration>. It does not expire if <duration> <= 0.
 //
 // Note that the function <f> is executed within writing mutex lock.
-func (c *CacheTagService) GetOrSetFuncLock(key interface{}, f func() interface{}, duration time.Duration, tag interface{}) interface{} {
+func (c *CacheTagService) GetOrSetFuncLock(key interface{}, f func() (interface{}, error), duration time.Duration, tag interface{}) interface{} {
 	tagSetMux.Lock()
 	defer tagSetMux.Unlock()
 	c.cacheTagKey(key, tag)
-	return gcache.GetOrSetFuncLock(key, f, duration)
+	v, _ := gcache.GetOrSetFuncLock(key, f, duration)
+	return v
 }
 
 // Contains returns true if <tagKey> exists in the cache, or else returns false.
 func (c *CacheTagService) Contains(key interface{}) bool {
-	return gcache.Contains(key)
+	v, _ := gcache.Contains(key)
+	return v
 }
 
 // Remove deletes the <tagKey> in the cache, and returns its value.
 func (c *CacheTagService) Remove(key interface{}) interface{} {
-	return gcache.Remove(key)
+	v, _ := gcache.Remove(key)
+	return v
 }
 
 // Removes deletes <keys> in the cache.
 func (c *CacheTagService) Removes(keys []interface{}) {
-	gcache.Removes(keys)
+	gcache.Remove(keys...)
 }
 
 // Remove deletes the <tag> in the cache, and returns its value.
@@ -157,25 +164,30 @@ func (c *CacheTagService) RemoveByTags(tag []interface{}) {
 
 // Data returns a copy of all tagKey-value pairs in the cache as map type.
 func (c *CacheTagService) Data() map[interface{}]interface{} {
-	return gcache.Data()
+	v, _ := gcache.Data()
+	return v
 }
 
 // Keys returns all keys in the cache as slice.
 func (c *CacheTagService) Keys() []interface{} {
-	return gcache.Keys()
+	v, _ := gcache.Keys()
+	return v
 }
 
 // KeyStrings returns all keys in the cache as string slice.
 func (c *CacheTagService) KeyStrings() []string {
-	return gcache.KeyStrings()
+	v, _ := gcache.KeyStrings()
+	return v
 }
 
 // Values returns all values in the cache as slice.
 func (c *CacheTagService) Values() []interface{} {
-	return gcache.Values()
+	v, _ := gcache.Values()
+	return v
 }
 
 // Size returns the size of the cache.
 func (c *CacheTagService) Size() int {
-	return gcache.Size()
+	v, _ := gcache.Size()
+	return v
 }

+ 1 - 1
app/task/functions.go

@@ -87,7 +87,7 @@ func GetOnlineInfo(token string) g.Map {
 	cacheKey := boot.AdminGfToken.CacheKey + userKey
 	switch boot.AdminGfToken.CacheMode {
 	case gtoken.CacheModeCache:
-		userCacheValue := gcache.Get(cacheKey)
+		userCacheValue, _ := gcache.Get(cacheKey)
 		if userCacheValue == nil {
 			return nil
 		}

+ 8 - 1
config/config.toml

@@ -64,4 +64,11 @@
     moduleName    = "module"
     packageName   = "gfast"
     autoRemovePre = true
-    tablePrefix   = "t_,sys_"
+    tablePrefix   = "t_,sys_"
+
+
+#模板配置
+[viewer]
+paths       = ["./template"]
+defaultFile = "index.html"
+delimiters  =  ["${", "}"]

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
data/db.sql


+ 2 - 2
go.mod

@@ -7,8 +7,8 @@ require (
 	github.com/go-ole/go-ole v1.2.4 // indirect
 	github.com/go-openapi/spec v0.19.8 // indirect
 	github.com/go-openapi/swag v0.19.9 // indirect
-	github.com/goflyfox/gtoken v1.3.19
-	github.com/gogf/gf v1.13.6
+	github.com/goflyfox/gtoken v1.3.20
+	github.com/gogf/gf v1.14.0
 	github.com/mailru/easyjson v0.7.1 // indirect
 	github.com/mojocn/base64Captcha v1.3.1
 	github.com/mssola/user_agent v0.5.1

+ 8 - 9
go.sum

@@ -22,8 +22,8 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8
 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
 github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
-github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
+github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
+github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w=
 github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
@@ -55,11 +55,10 @@ github.com/go-openapi/swag v0.19.9 h1:1IxuqvBUU3S2Bi4YC7tlP9SJF1gVpCvqN0T2Qof4az
 github.com/go-openapi/swag v0.19.9/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY=
 github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
 github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
-github.com/goflyfox/gtoken v1.3.19 h1:p0fhXybMNwB1sFn+DnCOQkE/IbLaNE31rRLIGZ+qShk=
-github.com/goflyfox/gtoken v1.3.19/go.mod h1:b1ffjYH5cBEtiEGwLsRxtl0s0ler06hAvbYKa9IkbR4=
-github.com/gogf/gf v1.13.4/go.mod h1:dGX0/BElXDBYbdJGascqfrWScj8IMeOietDjVD6/5Fc=
-github.com/gogf/gf v1.13.6 h1:wm/eaVdViAcO7KqZCOCc/lzgGdBSDTRn7cDQ5gWMddw=
-github.com/gogf/gf v1.13.6/go.mod h1:dGX0/BElXDBYbdJGascqfrWScj8IMeOietDjVD6/5Fc=
+github.com/goflyfox/gtoken v1.3.20 h1:7J8A/DandT9D9m2ceNbmYKE8ZBbhy/ZH+L5jW64q76k=
+github.com/goflyfox/gtoken v1.3.20/go.mod h1:o+RTTc1R/ifKH5NSsVPtk4lirnocvbQmmk1I39+Y29Q=
+github.com/gogf/gf v1.14.0 h1:cO7yqWQB8PVCQ8ynTARd/LDQvJdzA6ZkUSr7GPslmFI=
+github.com/gogf/gf v1.14.0/go.mod h1:7b21qQKDyIwJO4PkBCxVci5C62tm89MANGV2wJgAf50=
 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
 github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
 github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -164,9 +163,9 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h
 golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
 golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
-golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=

+ 1 - 1
library/service/service.go

@@ -19,7 +19,7 @@ import (
 )
 
 //版本号
-const Version = "1.1.01"
+const Version = "1.1.02"
 
 //获取数字验证码
 func GetVerifyImgDigit() (idKeyC string, base64stringC string) {

+ 53 - 0
template/cms/content/show.html

@@ -0,0 +1,53 @@
+<html>
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
+    <title>Gfast开源框架演示站点</title>
+    <meta name="keywords" content="GO后台管理系统 GO权限管理系统 GO前后端分离框架">
+    <meta name="description"
+          content="Gfast前后端分离框架由奇讯科技团队研发,公司以以统计宏观数据库平台、挂图作战(督办)指挥平台为主打产品,为您提供网站建设、软件开发、APP软件定制。0874-3331516">
+    <meta name="SiteName" content="Gfast官方网站">
+    <meta name="SiteDomain" content="http://www.g-fast.cn">
+    <link rel="shortcut icon" type="image/x-icon" href="${.domain}image/favicon.ico">
+    <link rel="stylesheet" type="text/css" href="${.domain}cms/css/public.css"/>
+    <link rel="stylesheet" type="text/css" href="${.domain}cms/css/qxkj.css"/>
+</head>
+
+<body>
+<div class="site">
+    <div class="container">
+        ${template "left_nav" .}
+        <div class="content-wrapper">
+            <div class="recent-content">
+                <div class="showart">
+                    <div class="loccrumbs"><span>您当前的位置 ></span>
+                        <a href="#">首页 </a> >
+                        <a href="#">财经股票</a>
+                    </div>
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场</a></h3>
+                    <div class="footbar">
+                        <i class="footbar-like">网站小编 </i>
+                        <i class="footbar-like"><a href="#">点赞(2)</a></i>
+                        <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                        <i class="footbar-like"><a href="#">分享</a></i>
+                    </div>
+                    <div class="showcontent">
+                        <img src="images/showbg.jpg">
+                        <p>
+                            特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但该计划遭到许多国会议员、农业协会代表和农场主们的反对,他们纷纷表示“要市场不要补贴”,敦促特朗普政府尽快结束与其他经济体的贸易争端。</p>
+                        <p>
+                            特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但该计划遭到许多国会议员、农业协会代表和农场主们的反对,他们纷纷表示“要市场不要补贴”,敦促特朗普政府尽快结束与其他经济体的贸易争端。</p>
+                        <p>
+                            特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但该计划遭到许多国会议员、农业协会代表和农场主们的反对,他们纷纷表示“要市场不要补贴”,敦促特朗普政府尽快结束与其他经济体的贸易争端。</p>
+                        <p>
+                            特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但该计划遭到许多国会议员、农业协会代表和农场主们的反对,他们纷纷表示“要市场不要补贴”,敦促特朗普政府尽快结束与其他经济体的贸易争端。</p>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+    ${template "sitebar" .}
+</div>
+</div>
+</body>

+ 221 - 0
template/cms/index.html

@@ -0,0 +1,221 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
+    <title>Gfast开源框架演示站点</title>
+    <meta name="keywords" content="GO后台管理系统 GO权限管理系统 GO前后端分离框架">
+    <meta name="description"
+          content="Gfast前后端分离框架由奇讯科技团队研发,公司以以统计宏观数据库平台、挂图作战(督办)指挥平台为主打产品,为您提供网站建设、软件开发、APP软件定制。0874-3331516">
+    <meta name="SiteName" content="Gfast官方网站">
+    <meta name="SiteDomain" content="http://www.g-fast.cn">
+    <link rel="shortcut icon" type="image/x-icon" href="${.domain}image/favicon.ico">
+    <link rel="stylesheet" type="text/css" href="${.domain}cms/css/public.css"/>
+    <link rel="stylesheet" type="text/css" href="${.domain}cms/css/qxkj.css"/>
+</head>
+
+<body>
+<div class="site">
+    <div class="container">
+        ${template "left_nav" .}
+        <div class="content-wrapper">
+            <div class="gslider">
+                <img src="${.domain}cms/images/800x400.jpg">
+            </div>
+            <div class="recent-content">
+                <h2><span>最新发布</span></h2>
+
+                <div class="lista">
+                    <h3><a href="#">呼伦贝尔: 你不可错过的辽阔草原和兴安秋色!</a></h3>
+                    <div class="pov">
+                        <div class="tittop">
+                            <b>网站小编</b><b>发布于 2018-08-03</b>
+                        </div>
+                        <ul>
+                            <li>
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="${.domain}cms/images/280x180.jpg"></div>
+                                </a>
+                            </li>
+                            <li>
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="${.domain}cms/images/g7-280.jpg"></div>
+                                </a>
+                            </li>
+                            <li class="mg">
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="${.domain}cms/images/280x180.jpg"></div>
+                                </a>
+                            </li>
+                        </ul>
+                    </div>
+                    <div class="footbar">
+                        <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                        <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                        <i class="footbar-like"><a href="#">评论(2)</a></i>
+                        <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="${.domain}cms/images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="${.domain}cms/images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="${.domain}cms/images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">呼伦贝尔: 你不可错过的辽阔草原和兴安秋色!</a></h3>
+                    <div class="pov">
+                        <div class="tittop">
+                            <b>网站小编</b><b>发布于 2018-08-03</b>
+                        </div>
+                        <ul>
+                            <li>
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="${.domain}cms/images/280x180.jpg"></div>
+                                </a>
+                            </li>
+                            <li>
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="${.domain}cms/images/g7-280.jpg"></div>
+                                </a>
+                            </li>
+                            <li class="mg">
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="${.domain}cms/images/280x180.jpg"></div>
+                                </a>
+                            </li>
+                        </ul>
+                    </div>
+                    <div class="footbar">
+                        <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                        <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                        <i class="footbar-like"><a href="#">评论(2)</a></i>
+                        <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="${.domain}cms/images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="${.domain}cms/images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+            </div>
+        </div>
+        ${template "sitebar" .}
+    </div>
+</div>
+</body>

+ 25 - 0
template/cms/left_nav/left_nav.html

@@ -0,0 +1,25 @@
+${define "left_nav"}
+<div class="left-col">
+    <div class="site-branding">
+        <div id="logo">
+            <a href="${.domain}/index" rel="home">
+                <img width="240" height="70" src="${.domain}cms/images/logo.png" class="custom-logo" alt="Gfast"></a>
+        </div>
+    </div>
+    <div class="nav">
+        <ul>
+            ${range $index,$item := .menus}
+                ${if eq $index 0}
+                <li>
+                    <a href="#" class="active">${$item.Name}</a>
+                </li>
+                ${else}
+                <li>
+                    <a href="#">${$item.Name}</a>
+                </li>
+                ${end}
+            ${end}
+        </ul>
+    </div>
+</div>
+${end}

+ 184 - 0
template/cms/list/list.html

@@ -0,0 +1,184 @@
+<html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
+    <title>Gfast开源框架演示站点</title>
+    <meta name="keywords" content="GO后台管理系统 GO权限管理系统 GO前后端分离框架">
+    <meta name="description"
+          content="Gfast前后端分离框架由奇讯科技团队研发,公司以以统计宏观数据库平台、挂图作战(督办)指挥平台为主打产品,为您提供网站建设、软件开发、APP软件定制。0874-3331516">
+    <meta name="SiteName" content="Gfast官方网站">
+    <meta name="SiteDomain" content="http://www.g-fast.cn">
+    <link rel="shortcut icon" type="image/x-icon" href="${.domain}image/favicon.ico">
+    <link rel="stylesheet" type="text/css" href="${.domain}cms/css/public.css"/>
+    <link rel="stylesheet" type="text/css" href="${.domain}cms/css/qxkj.css"/>
+</head>
+
+<body>
+<div class="site">
+    <div class="container">
+        ${template "left_nav" .}
+        <div class="content-wrapper">
+            <div class="recent-content">
+                <h2><span>最新发布</span></h2>
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">呼伦贝尔: 你不可错过的辽阔草原和兴安秋色!</a></h3>
+                    <div class="pov">
+                        <div class="tittop">
+                            <b>网站小编</b><b>发布于 2018-08-03</b>
+                        </div>
+                        <ul>
+                            <li>
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="images/280x180.jpg"></div>
+                                </a>
+                            </li>
+                            <li>
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="images/g7-280.jpg"></div>
+                                </a>
+                            </li>
+                            <li class="mg">
+                                <a href="#" target="_banlk">
+                                    <div class="thumbnail-wrap"><img src="images/280x180.jpg"></div>
+                                </a>
+                            </li>
+                        </ul>
+                    </div>
+                    <div class="footbar">
+                        <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                        <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                        <i class="footbar-like"><a href="#">评论(2)</a></i>
+                        <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+
+                <div class="lista">
+                    <h3><a href="#">美拟补贴贸易战中受损农场主遭反对:不要补贴要市场!</a></h3>
+                    <div class="pov">
+                        <div class="sview">
+                            <div class="sviewl">
+                                <div class="tittop">
+                                    <b>网站小编</b><b>发布于 2018-08-03</b>
+                                </div>
+                                <div class="art_summary">
+                                    <p>特朗普政府24日宣布一项总额最高达120亿美元的农业补贴计划,以援助在美国挑起的贸易争端中受损的美国农场主。但…</p>
+                                </div>
+                                <div class="footbar">
+                                    <i class="footbar-category"><a href="#">旅游攻略</a></i>
+                                    <i class="footbar-like"><a href="#" title="点赞这篇文章">点赞(231) </a></i>
+                                    <i class="footbar-like"><a href="#">评论(2)</a></i>
+                                    <i class="footbar-like"><a href="#">阅读(2,310)</a></i>
+                                </div>
+                            </div>
+                            <div class="sviewr">
+                                <a href="#"><img src="images/g7-280.jpg"></a>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+        ${template "sitebar" .}
+    </div>
+</div>
+</body>

+ 124 - 0
template/cms/sitebar/sitebar.html

@@ -0,0 +1,124 @@
+${define "sitebar"}
+<div class="sitebar">
+    <div class="searchbox">
+        <form id="searchform" method="get" action="/">
+            <input type="search" name="s" class="search-input" placeholder="请输入关键词" autocomplete="off">
+            <button type="submit" class="search-submit">搜索</button>
+        </form>
+    </div>
+    <div class="ali">
+        <a href="https://www.aliyun.com/activity/daily/bestoffer?userCode=fcor2omk">
+            <img src="${.domain}cms/images/ay.jpg">
+        </a>
+    </div>
+    <div class="sitebar-article">
+        <h2><span>浏览最多的文章</span></h2>
+        <div class="sitebar-article-list">
+            <ul>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+            </ul>
+        </div>
+    </div>
+
+    <div class="ali">
+        <a href="https://www.aliyun.com/daily-act/ecs/care?userCode=fcor2omk">
+            <img src="${.domain}cms/images/aliyun.jpg">
+        </a>
+    </div>
+
+    <div class="sitebar-article">
+        <h2><span>点赞最多的文章</span></h2>
+        <div class="sitebar-article-list">
+            <ul>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+                <li>
+                    <div class="artl">
+                        <a href="@#">
+                            <p>超美的三亚,5天4晚全五星酒店高大上自由行</p>
+                        </a>
+                        <label>2018-07-27</label>
+                    </div>
+                    <div class="artr">
+                        <a href="#"><img src="${.domain}cms/images/g17-120.jpg"></a>
+                    </div>
+                </li>
+            </ul>
+        </div>
+    </div>
+</div>
+${end}

Некоторые файлы не были показаны из-за большого количества измененных файлов