kefu/tmpl/common.go

42 lines
1.1 KiB
Go

package tmpl
import (
"github.com/gin-gonic/gin"
"github.com/patrickmn/go-cache"
"html/template"
"kefu/models"
"kefu/tools"
"net/http"
"time"
)
var pageCache = cache.New(60*time.Minute, 5*time.Minute)
// 登陆界面
func PageMain(c *gin.Context) {
SystemTitle := models.FindConfig("SystemTitle")
SystemKefu := models.FindConfig("SystemKefu")
nav := tools.FileGetContent("html/nav.html")
c.HTML(http.StatusOK, "main.html", gin.H{
"Nav": template.HTML(nav),
"SystemTitle": SystemTitle,
"SystemKefu": template.HTML(SystemKefu),
})
}
// 客服界面
func PageChatMain(c *gin.Context) {
KefuAudioBtn := models.FindConfig("KefuAudioBtn")
KefuUploadImgBtn := models.FindConfig("KefuUploadImgBtn")
KefuUploadFileBtn := models.FindConfig("KefuUploadFileBtn")
KefuCleanBtn := models.FindConfig("KefuCleanBtn")
baiduFanyiAppId := models.FindConfig("BaiduFanyiAppId")
c.HTML(http.StatusOK, "chat_main.html", gin.H{
"KefuAudioBtn": KefuAudioBtn,
"KefuUploadImgBtn": KefuUploadImgBtn,
"KefuUploadFileBtn": KefuUploadFileBtn,
"KefuCleanBtn": KefuCleanBtn,
"BaiduFanyiAppId": baiduFanyiAppId,
})
}