增加发消息提醒

pull/23/head
taoshihan1991 4 years ago
parent 5bfa5c5d3c
commit dadd4c8e01

@ -207,6 +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"))
}
c.JSON(200, gin.H{
"code": 200,

@ -32,7 +32,7 @@ func NewVisitorServer(c *gin.Context) {
To_id: vistorInfo.ToId,
}
go models.UpdateVisitorStatus(vistorInfo.VisitorId, 1)
go SendServerJiang(vistorInfo.Name)
go SendServerJiang(vistorInfo.Name, "来了", c.GetHeader("Host"))
AddVisitorToList(user)

@ -64,15 +64,15 @@ func init() {
}
go UpdateVisitorStatusCron()
}
func SendServerJiang(content string) string {
func SendServerJiang(title string, content string, domain string) string {
noticeServerJiang, err := strconv.ParseBool(models.FindConfig("NoticeServerJiang"))
serverJiangAPI := models.FindConfig("ServerJiangAPI")
if err != nil || !noticeServerJiang || serverJiangAPI == "" {
log.Println("do not notice serverjiang:", serverJiangAPI, noticeServerJiang)
return ""
}
sendStr := fmt.Sprintf("%s,访客来了", content)
desp := "[登录](https://gofly.sopans.com/main)"
sendStr := fmt.Sprintf("%s%s", title, content)
desp := title + ":" + content + "[登录](http://" + domain + "/main)"
url := serverJiangAPI + "?text=" + sendStr + "&desp=" + desp
//log.Println(url)
res := tools.Get(url)

Loading…
Cancel
Save