fix:1、修复匿名访问判断错误的BUG

2、重构配置文件自动加载逻辑
This commit is contained in:
lifei6671
2018-09-19 11:32:29 +08:00
parent 4d59df6d57
commit 3aa703d479
17 changed files with 301 additions and 256 deletions

View File

@@ -2,25 +2,29 @@ package controllers
import (
"math"
"net/url"
"github.com/astaxie/beego"
"github.com/lifei6671/mindoc/conf"
"github.com/lifei6671/mindoc/models"
"github.com/lifei6671/mindoc/utils/pagination"
"github.com/lifei6671/mindoc/conf"
"net/url"
)
type HomeController struct {
BaseController
}
func (c *HomeController) Index() {
c.Prepare()
c.TplName = "home/index.tpl"
func (c *HomeController) Prepare() {
c.BaseController.Prepare()
//如果没有开启匿名访问,则跳转到登录页面
if !c.EnableAnonymous && c.Member == nil {
c.Redirect(conf.URLFor("AccountController.Login")+"?url="+url.PathEscape(conf.BaseUrl+c.Ctx.Request.URL.RequestURI()), 302)
}
}
func (c *HomeController) Index() {
c.Prepare()
c.TplName = "home/index.tpl"
pageIndex, _ := c.GetInt("page", 1)
pageSize := 18