kefu/router/view.go

308 lines
10 KiB
Go

package router
import (
"github.com/gin-gonic/gin"
"html/template"
"kefu/middleware"
"kefu/models"
"kefu/tmpl"
"net/http"
)
func InitViewRouter(engine *gin.Engine) {
//首页
engine.GET("/", middleware.CheckMysql, middleware.SystemReferIpblack, tmpl.PageFirstIndex)
engine.GET("/index", middleware.SetLanguage, middleware.SystemReferIpblack, tmpl.PageNewIndex)
engine.GET("/index_:lang", middleware.SetLanguage, tmpl.PageNewIndex)
//engine.GET("/welcome.html", middleware.CheckMysql, middleware.SetLanguage, tmpl.PageWelcome)
//登录界面
engine.GET("/ironMan/signInx", middleware.CheckMysql, middleware.SystemReferIpblack, tmpl.PageLogin)
//绑定界面
engine.GET("/bind", tmpl.PageBind)
engine.GET("/chatIndex", middleware.SetLanguage, middleware.SystemReferIpblack, tmpl.PageChat)
engine.GET("/wechatIndex", middleware.SetLanguage, tmpl.PageWechatChat)
//企业微信授权
engine.GET("/entWechatIndex", tmpl.PageEntWechatChat)
engine.GET("/entWechatAuth", tmpl.PageEntWechatAuth)
engine.GET("/chatRoom", tmpl.PageChatRoom)
//后台主界面
engine.GET("/mainGuide", middleware.DomainLimitMiddleware, func(c *gin.Context) {
c.HTML(http.StatusOK, "main_guide.html", gin.H{})
})
engine.GET("/main", middleware.CheckMysql, middleware.SystemReferIpblack, middleware.JwtPageMiddleware, tmpl.PageMain)
engine.GET("/chat_main", middleware.DomainLimitMiddleware, middleware.SystemReferIpblack, middleware.JwtPageMiddleware, tmpl.PageChatMain)
engine.GET("/setting", tmpl.PageSetting)
engine.GET("/setting_kefu_list", middleware.DomainLimitMiddleware, tmpl.PageKefuList)
engine.GET("/setting_visitor_list", middleware.DomainLimitMiddleware, tmpl.PageVisitorList)
engine.GET("/setting_deploy", middleware.DomainLimitMiddleware, tmpl.PageSettingDeploy)
engine.GET("/setting_welcome", middleware.DomainLimitMiddleware, tmpl.PageSettingWelcome)
engine.GET("/setting_config", middleware.DomainLimitMiddleware, tmpl.PageConfig)
engine.GET("/setting_configs", middleware.DomainLimitMiddleware, tmpl.PageConfigs)
engine.GET("/setting_statistics", tmpl.PageSettingStatis)
engine.GET("/setting_indexpage", tmpl.PageSettingIndexPage)
engine.GET("/setting_mysql", tmpl.PageSettingMysql)
engine.GET("/setting_visitor_message", tmpl.PageVisitorMessage)
engine.GET("/setting_user_all", tmpl.PageUserAllList)
engine.GET("/setting_kefu_message", tmpl.PageKefuMessage)
engine.GET("/setting_avator", tmpl.PageAvator)
engine.GET("/setting_modifypass", tmpl.PageModifypass)
engine.GET("/setting_ipblack", tmpl.PageIpblack)
engine.GET("/setting_articles", tmpl.PageSettingArticles)
engine.GET("/setting_wechat_menu", tmpl.PageSettingWechatMenu)
engine.GET("/setting_news", tmpl.PageSettingNews)
engine.GET("/setting_logs", tmpl.PageSettingLogs)
//engine.GET("/roles_list", tmpl.PageRoleList)
//机器人设置
engine.GET("/setting_robot", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_robot.html", gin.H{
"action": "setting_robot",
})
})
//大模型配置界面
engine.GET("/setting_llm", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_llm.html", gin.H{
"action": "setting_llm",
})
})
//微信客服界面
engine.GET("/setting_qyweixin_kefu", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_qyweixin_kefu.html", gin.H{
"action": "setting_qyweixin_kefu",
})
})
//支付界面
engine.GET("/setting_pay", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_pay.html", gin.H{
"action": "setting_pay",
})
})
//订单界面
engine.GET("/setting_orders", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_orders.html", gin.H{
"action": "setting_orders",
})
})
//生成二维码
engine.GET("/setting_marketing", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_marketing.html", gin.H{
"action": "setting_marketing",
})
})
//充值界面
engine.GET("/setting_charge", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_charge.html", gin.H{})
})
//访客来源
engine.GET("/setting_visitor_ext", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_visitor_ext.html", gin.H{
"action": "setting_visitor_ext",
})
})
//营销会员
engine.GET("/setting_customer", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_customer.html", gin.H{
"action": "setting_customer",
})
})
//服务统计
engine.GET("/setting_service_statistic", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_service_statistic.html", gin.H{
"action": "setting_service_statistic",
})
})
//CMS
engine.GET("/setting_cms", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_cms.html", gin.H{
"action": "setting_cms",
})
})
//微信客服管理
engine.GET("/setting_wechat", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_wechat.html", gin.H{
"action": "setting_wechat",
})
})
//向量知识库
engine.GET("/setting_qdrant", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_qdrant.html", gin.H{
"action": "setting_qdrant",
})
})
//训练知识库
engine.GET("/setting_training", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_training.html", gin.H{
"action": "setting_training",
})
})
//抖音接入
engine.GET("/setting_douyin", func(c *gin.Context) {
clientKey := models.FindConfig("DouyinClientKey")
c.HTML(http.StatusOK, "setting_douyin.html", gin.H{
"action": "setting_douyin",
"clientKey": clientKey,
})
})
//商户设置
engine.GET("/setting_company", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_company.html", gin.H{
"action": "setting_company",
})
})
//付费群列表
engine.GET("/setting_group", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_group.html", gin.H{
"action": "setting_group",
})
})
//商家管理
engine.GET("/setting_ent", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_ent.html", gin.H{
"action": "setting_ent",
})
})
//支付配置界面
engine.GET("/setting_pay_config", func(c *gin.Context) {
c.HTML(http.StatusOK, "setting_pay_config.html", gin.H{
"action": "setting_pay_config",
})
})
//演示页面
engine.GET("/deploy", func(c *gin.Context) {
kefuName := c.Query("kefuName")
entId := c.Query("entId")
siteUrl := c.Query("siteUrl")
c.HTML(http.StatusOK, "deploy.html", gin.H{
"kefuName": kefuName,
"entId": entId,
"siteUrl": siteUrl,
})
})
//测试
engine.GET("/test/:entId/:kefuName", func(c *gin.Context) {
kefuName := c.Param("kefuName")
entId := c.Param("entId")
siteUrl := c.Query("siteUrl")
c.HTML(http.StatusOK, "deploy.html", gin.H{
"kefuName": kefuName,
"entId": entId,
"siteUrl": siteUrl,
})
})
//sso单点登录
engine.GET("/sso", func(c *gin.Context) {
token := c.Query("token")
redirect := c.Query("redirect")
c.HTML(http.StatusOK, "sso.html", gin.H{
"TOKEN": token,
"REDIRECT": redirect,
})
})
//客服公众号一键授权
engine.GET("/wechatKefuTransfer", tmpl.PageWechatKefuTransfer)
engine.GET("/wechatKefu", tmpl.GetWechatKefu)
//AES加解密
engine.GET("/aes", func(c *gin.Context) {
c.HTML(http.StatusOK, "aes.html", gin.H{})
})
//关于页面
engine.GET("/aboutus.html", middleware.SystemReferIpblack, func(c *gin.Context) {
c.HTML(http.StatusOK, "aboutus.html", gin.H{
"nav": "aboutus",
})
})
//演示页面
engine.GET("/show.html", func(c *gin.Context) {
c.HTML(http.StatusOK, "show.html", gin.H{
"nav": "show",
})
})
//产品页面
engine.GET("/product.html", middleware.SystemReferIpblack, func(c *gin.Context) {
c.HTML(http.StatusOK, "product.html", gin.H{
"nav": "product",
})
})
//系列文章
engine.GET("/articles.html", middleware.SystemReferIpblack, func(c *gin.Context) {
news := models.FindCmsNews(1, 1000, "cat_id = ? ", 1)
c.HTML(http.StatusOK, "articles.html", gin.H{
"nav": "articles",
"news": news,
})
})
//抖音介绍
engine.GET("/douyin.html", func(c *gin.Context) {
c.HTML(http.StatusOK, "douyin.html", gin.H{
"nav": "douyin",
})
})
//文章
engine.GET("/article/:id", middleware.SystemReferIpblack, func(c *gin.Context) {
id := c.Param("id")
args := []interface{}{
id,
}
info := models.FindCmsNewsRow("id = ? ", args...)
c.HTML(http.StatusOK, "article.html", gin.H{
"nav": "articles",
"title": info.Title,
"content": template.HTML(info.Content),
"time": info.CreatedAt,
})
})
//扫码公众号接收消息提醒
engine.GET("/wechatNotice", func(c *gin.Context) {
systemBussinesId := models.FindConfig("SystemBussinesId")
c.HTML(http.StatusOK, "wechat_notice.html", gin.H{
"systemBussinesId": systemBussinesId,
})
})
//前台页面
engine.GET("/video.html", func(c *gin.Context) {
c.HTML(http.StatusOK, "video.html", gin.H{})
})
//前台页面
engine.GET("/cutpic.html", func(c *gin.Context) {
c.HTML(http.StatusOK, "cutpic.html", gin.H{})
})
//前台页面
engine.GET("/clause.html", func(c *gin.Context) {
c.HTML(http.StatusOK, "clause.html", gin.H{})
})
//微信网页授权
engine.GET("/wechat_auth", tmpl.PageWechatAuth)
//授权查询界面
engine.GET("/authorization", func(c *gin.Context) {
c.HTML(http.StatusOK, "authorization.html", gin.H{})
})
//支付测试
engine.GET("/pay/:entId/:kefuName", tmpl.PayHtml)
//AIGC界面
engine.GET("/aigc", func(c *gin.Context) {
c.HTML(http.StatusOK, "aigc.html", gin.H{})
})
//订单列表demo
engine.GET("/related_order_list", func(c *gin.Context) {
c.HTML(http.StatusOK, "related_order_list.html", gin.H{})
})
//设置AI扩展
engine.GET("/extend", tmpl.PageExtend)
engine.GET("/extend_fastgpt", middleware.DomainLimitMiddleware, tmpl.PageExtendFastGpt)
engine.GET("/extend_ragflow", middleware.DomainLimitMiddleware, tmpl.PageExtendRAGFlow)
//数字人
engine.GET("/digital_human", tmpl.PageDigitalHuman)
engine.GET("/digital_human_base_setting", middleware.DomainLimitMiddleware, tmpl.PageDigitalHumanBaseSetting)
engine.GET("/digital_human_image_base", middleware.DomainLimitMiddleware, tmpl.PageDigitalHumanImageBase)
engine.GET("/digital_human_action_base", middleware.DomainLimitMiddleware, tmpl.PageDigitalHumanActionBase)
engine.GET("/digital_human_voice_base", middleware.DomainLimitMiddleware, tmpl.PageDigitalHumanVoiceBase)
}