代码拉取完成,页面将自动刷新
同步操作将从 phachon/mm-wiki 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package main
import (
"github.com/astaxie/beego"
"mm-wiki/app/controllers"
systemControllers "mm-wiki/app/modules/system/controllers"
"mm-wiki/app/utils"
"net/http"
"html/template"
)
func init() {
initRouter()
}
func initRouter() {
// router
beego.BConfig.WebConfig.AutoRender = false
beego.BConfig.RouterCaseSensitive = false
beego.Router("/", &controllers.MainController{}, "*:Index")
beego.Router("/author", &controllers.AuthorController{}, "*:Index")
beego.AutoRouter(&controllers.AuthorController{})
beego.AutoRouter(&controllers.MainController{})
beego.AutoRouter(&controllers.SpaceController{})
beego.AutoRouter(&controllers.CollectionController{})
beego.AutoRouter(&controllers.FollowController{})
beego.AutoRouter(&controllers.UserController{})
beego.AutoRouter(&controllers.DocumentController{})
beego.AutoRouter(&controllers.PageController{})
beego.AutoRouter(&controllers.ImageController{})
systemNamespace := beego.NewNamespace("/system",
beego.NSAutoRouter(&systemControllers.MainController{}),
beego.NSAutoRouter(&systemControllers.ProfileController{}),
beego.NSAutoRouter(&systemControllers.UserController{}),
beego.NSAutoRouter(&systemControllers.RoleController{}),
beego.NSAutoRouter(&systemControllers.PrivilegeController{}),
beego.NSAutoRouter(&systemControllers.SpaceController{}),
beego.NSAutoRouter(&systemControllers.Space_UserController{}),
beego.NSAutoRouter(&systemControllers.LogController{}),
beego.NSAutoRouter(&systemControllers.EmailController{}),
beego.NSAutoRouter(&systemControllers.LinkController{}),
beego.NSAutoRouter(&systemControllers.AuthController{}),
beego.NSAutoRouter(&systemControllers.ConfigController{}),
beego.NSAutoRouter(&systemControllers.ContactController{}),
beego.NSAutoRouter(&systemControllers.StaticController{}),
)
beego.AddNamespace(systemNamespace)
beego.ErrorHandler("404", http_404)
beego.ErrorHandler("500", http_500)
// add template func
beego.AddFuncMap("dateFormat", utils.Date.Format)
}
func http_404(rw http.ResponseWriter, req *http.Request) {
t,_:= template.New("404.html").ParseFiles(beego.BConfig.WebConfig.ViewsPath+"/error/404.html")
data := make(map[string]interface{})
data["content"] = "page not found"
t.Execute(rw, data)
}
func http_500(rw http.ResponseWriter, req *http.Request) {
t, _ := template.New("500.html").ParseFiles(beego.BConfig.WebConfig.ViewsPath + "/error/500.html")
data := make(map[string]interface{})
t.Execute(rw, data)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。