代码拉取完成,页面将自动刷新
同步操作将从 进击的皇虫/DocHub 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package HomeControllers
import (
"fmt"
"strings"
"github.com/TruthHun/DocHub/helper"
"github.com/TruthHun/DocHub/models"
"github.com/astaxie/beego/orm"
)
type IndexController struct {
BaseController
}
func (this *IndexController) Get() {
//获取横幅
this.Data["Banners"], _, _ = models.GetList(models.GetTableBanner(), 1, 100, orm.NewCondition().And("status", 1), "Sort")
//判断用户是否已登录,如果已登录,则返回用户信息
if this.IsLogin > 0 {
users, rows, err := models.NewUser().UserList(1, 1, "", "*", "i.`Id`=?", this.IsLogin)
if err != nil {
helper.Logger.Error(err.Error())
}
if rows > 0 {
this.Data["User"] = users[0]
} else {
//如果用户不存在,则重置cookie
this.IsLogin = 0
this.ResetCookie()
}
this.Data["LoginUid"] = this.IsLogin
} else {
this.Xsrf()
}
modelCate := models.NewCategory()
//首页分类显示
_, this.Data["Cates"] = modelCate.GetAll(true)
this.Data["Latest"], _, _ = models.NewDocument().SimpleList(fmt.Sprintf("d.`Id` in(%v)", strings.Trim(this.Sys.Trends, ",")), 5)
this.Data["Seo"] = models.NewSeo().GetByPage("PC-Index", "文库首页", "文库首页", "文库首页", this.Sys.Site)
this.Data["IsHome"] = true
this.Data["PageId"] = "wenku-index"
this.TplName = "index.html"
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。