From 7bcdc4ef276676eff2f3e85892fb190e5be16560 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Sun, 27 Sep 2020 19:14:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E6=9B=B4=E6=96=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E8=AE=BF=E5=AE=A2=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/config.go | 3 -- config/language.go | 4 +- controller/chat.go | 9 ++-- controller/index.go | 2 +- middleware/language.go | 5 ++- router/view.go | 2 +- static/html/index.html | 96 +++++++++++++++++++++------------------- static/images/admin.png | Bin 0 -> 120629 bytes tmpl/common.go | 8 ++-- 9 files changed, 69 insertions(+), 60 deletions(-) create mode 100644 static/images/admin.png diff --git a/config/config.go b/config/config.go index e7a3cfd..8787697 100644 --- a/config/config.go +++ b/config/config.go @@ -19,10 +19,7 @@ const Dir = "config/" const AccountConf = Dir + "account.json" const MysqlConf = Dir + "mysql.json" const MailConf = Dir + "mail.json" -const LangConf = Dir + "language.json" const MainConf = Dir + "config.json" -const WeixinToken = "" -const ServerJiang = "" func init() { //配置文件 diff --git a/config/language.go b/config/language.go index f5feb16..2645079 100644 --- a/config/language.go +++ b/config/language.go @@ -4,7 +4,7 @@ type Language struct { WebCopyRight string MainIntro string Send string - Notice string + Notice, Maintech string IndexSubIntro, IndexVisitors, IndexAgent, IndexDocument, IndexOnlineChat string } @@ -22,6 +22,7 @@ func CreateLanguage(lang string) *Language { IndexOnlineChat: "Let’s chat. - We're online", Send: "Send", Notice: "Hello and welcome to go-fly - how can we help?", + Maintech: "Main technical architecture", } } if lang == "cn" { @@ -35,6 +36,7 @@ func CreateLanguage(lang string) *Language { IndexOnlineChat: "在线咨询", Send: "发送", Notice: "欢迎您访问go-fly!有什么我能帮助您的?", + Maintech: "主要技术架构", } } return language diff --git a/controller/chat.go b/controller/chat.go index 0a3cafb..f15d1e4 100644 --- a/controller/chat.go +++ b/controller/chat.go @@ -52,7 +52,7 @@ func init() { ReadBufferSize: 1024, WriteBufferSize: 1024, } - //go sendPingUpdateStatus() + go UpdateVisitorStatusCron() go singleBroadcaster() //go sendPingOnlineUsers() //sendPingToClient() @@ -173,16 +173,19 @@ func sendPingToClient() { } //定时给更新数据库状态 -func sendPingUpdateStatus() { +func UpdateVisitorStatusCron() { for { visitors := models.FindVisitorsOnline() for _, visitor := range visitors { + if visitor.VisitorId == "" { + continue + } _, ok := clientList[visitor.VisitorId] if !ok { models.UpdateVisitorStatus(visitor.VisitorId, 0) } } - time.Sleep(20 * time.Second) + time.Sleep(60 * time.Second) } } diff --git a/controller/index.go b/controller/index.go index fe648e4..bdbcf4c 100644 --- a/controller/index.go +++ b/controller/index.go @@ -7,7 +7,7 @@ import ( ) func Index(c *gin.Context) { - c.Redirect(302, "/index") + c.Redirect(302, "/index/en") } //首页跳转 diff --git a/middleware/language.go b/middleware/language.go index 4419168..9dc72a3 100644 --- a/middleware/language.go +++ b/middleware/language.go @@ -5,7 +5,10 @@ import ( ) func SetLanguage(c *gin.Context) { - lang := c.Query("lang") + var lang string + if lang = c.Param("lang"); lang == "" { + lang = c.Query("lang") + } if lang == "" || lang != "cn" { lang = "en" } diff --git a/router/view.go b/router/view.go index 50cf445..76fe65b 100644 --- a/router/view.go +++ b/router/view.go @@ -7,7 +7,7 @@ import ( ) func InitViewRouter(engine *gin.Engine) { - engine.GET("/index", tmpl.PageIndex) + engine.GET("/index/:lang", middleware.SetLanguage, tmpl.PageIndex) engine.GET("/login", tmpl.PageLogin) engine.GET("/chat_page", middleware.SetLanguage, tmpl.PageChat) engine.GET("/chatIndex", middleware.SetLanguage, tmpl.PageChat) diff --git a/static/html/index.html b/static/html/index.html index 7a4fec4..494b45b 100644 --- a/static/html/index.html +++ b/static/html/index.html @@ -75,49 +75,53 @@ margin: 30px auto; } .footer { + clear: both; background-color: #f7fbfd; width: 100%; padding: 40px 150px; box-sizing: border-box; } - .try{ - display: inline-block; - padding: 10px 20px; - background: #519eff; - color: #fff; - border-radius: 5px; - cursor: pointer; - margin-right: 20px; - text-decoration: none; - } - .try:hover { - transform: translateY(-1px); - background: #318cff; - box-shadow: 0 7px 14px rgba(50,50,50,.1), 0 3px 6px rgba(0,0,0,.1); - } .copyright{ color: #6c757d; text-align: center; margin: 60px 0; } - .codeDeploy{ - color: #fff; - width: 1000px; - margin: 0 auto; - background: #555555; - padding: 10px; - white-space: pre-wrap; - word-wrap: break-word; - line-height: 24px; + .mainTechLeft{ + width: 300px; + float: left; + } + .mainTechLeft h1{ + font-size: 34px; + margin: 0; + line-height: 48px; + color: #555; + font-weight: 500; + font-family: Helvetica Neue,Helvetica,PingFang SC,Hiragino Sans GB,Microsoft YaHei,SimSun,sans-serif; + } + .mainTechLeft p{ + font-size: 18px; + line-height: 28px; + color: #888; + margin: 10px 0 5px; + } + .floatRight{ + width: 700px; + border: 1px solid #e1e1e1; + padding: 4px; + margin-top: 35px; + display: block; + float: right; }

GO-FLY

- English (United States) - 中文版 (简体) + English (United States) + 中文版 (简体) + Github {{.AgentBtn}} + {{.Document}}
-
-    <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
-    <script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.min.js"></script>
-    <link href="https://gofly.sopans.com/static/css/gofly-front.css" rel="stylesheet" type="text/css"/>
-    <div id="launchButton" class="launchButton">
-    <svg x="0px" y="0px" viewBox="0 0 27 21.9" aria-labelledby="title desc" role="img" class="xhl-launch-button-svg"><title>Chat Icon </title><desc>three small dots to indicate that an agent is available to chat</desc><path fill="#ffffff" d="M23.2,0L2.6,1.7C1,1.9,0,3.2,0,4.9v8c0,1.6,0.8,3,2.4,3.1l5.3,0.5c0,0,1,1.6,0.3,3.2C7.2,21.3,6,21.9,6,21.9 c4.2,0,6.6-3.1,7.8-4.9l9.4,0.7c1.8,0.2,3.8-1.3,3.8-3.1V3.1C27,1.3,25-0.1,23.2,0z M6.4,10.1c-0.9,0-1.7-0.7-1.7-1.7 c0-0.9,0.7-1.7,1.7-1.7C7.3,6.8,8,7.5,8,8.5C8,9.4,7.3,10.1,6.4,10.1z M13.2,10.1c-0.9,0-1.7-0.7-1.7-1.7c0-0.9,0.7-1.7,1.7-1.7 c0.9,0,1.7,0.7,1.7,1.7C14.8,9.4,14.1,10.1,13.2,10.1z M19.9,10.1c-0.9,0-1.7-0.7-1.7-1.7c0-0.9,0.7-1.7,1.7-1.7 c0.9,0,1.7,0.7,1.7,1.7C21.6,9.4,20.9,10.1,19.9,10.1z"></path></svg>
-    <div class="launchButtonText">
-    Chat with us
-    </div>
-    </div>
-    <script>
-    var GOFLY_URL="https://gofly.sopans.com";
-    </script>
-    <script src="https://gofly.sopans.com/static/js/gofly-front.js"></script>
-
+
+
+

{{.Maintech}}

+

github.com/dgrijalva/jwt-go

+

github.com/gin-gonic/gin

+

github.com/go-sql-driver/mysql

+

github.com/gobuffalo/packr/v2

+

github.com/gorilla/websocket

+

github.com/ipipdotnet/ipdb-go

+

github.com/jinzhu/gorm

+

github.com/satori/go.uuid

+

github.com/spf13/cobra

+

github.com/swaggo/gin-swagger

+

github.com/swaggo/swag +

+
+ +
+