kefu/tmpl/index.go

38 lines
721 B
Go
Raw Normal View History

2024-12-10 02:50:12 +00:00
package tmpl
import (
"github.com/gin-gonic/gin"
"kefu/models"
"net/http"
)
// 匹配http://xxx/
func PageFirstIndex(c *gin.Context) {
if c.Request.RequestURI == "/favicon.ico" {
return
}
//首页默认跳转地址
IndexJumpUrl := models.FindConfig("IndexJumpUrl")
if IndexJumpUrl != "" {
c.Redirect(302, IndexJumpUrl)
}
news := models.FindCmsNews(1, 1000, "cat_id = ? ", 1)
c.HTML(http.StatusOK, "index.html", gin.H{
"nav": "index",
"news": news,
})
}
// 首页
func PageNewIndex(c *gin.Context) {
if c.Request.RequestURI == "/favicon.ico" {
return
}
news := models.FindCmsNews(1, 1000, "cat_id = ? ", 1)
c.HTML(http.StatusOK, "index.html", gin.H{
"nav": "index",
"news": news,
})
}