|
|
@ -36,7 +36,7 @@ func SendNoticeEmail(username, msg string) {
|
|
|
|
log.Println(err)
|
|
|
|
log.Println(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func SendAppGetuiPush(msg string) {
|
|
|
|
func SendAppGetuiPush(kefu string, title, content string) {
|
|
|
|
token := models.FindConfig("GetuiToken")
|
|
|
|
token := models.FindConfig("GetuiToken")
|
|
|
|
if token == "" {
|
|
|
|
if token == "" {
|
|
|
|
token = getGetuiToken()
|
|
|
|
token = getGetuiToken()
|
|
|
@ -58,21 +58,30 @@ func SendAppGetuiPush(msg string) {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
"push_message":{
|
|
|
|
"push_message":{
|
|
|
|
"notification":{
|
|
|
|
"notification":{
|
|
|
|
"title":"请填写通知标题",
|
|
|
|
"title":"%s",
|
|
|
|
"body":"请填写通知内容",
|
|
|
|
"body":"%s",
|
|
|
|
"click_type":"url",
|
|
|
|
"click_type":"url",
|
|
|
|
"url":"https//:xxx"
|
|
|
|
"url":"https//:xxx"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`
|
|
|
|
`
|
|
|
|
req := fmt.Sprintf(format, tools.Uuid(), "0507db8a6769af494f22e17a6177c29a")
|
|
|
|
clients := models.FindClients(kefu)
|
|
|
|
url := "https://restapi.getui.com/v2/" + appid + "/push/single/cid"
|
|
|
|
if len(clients) == 0 {
|
|
|
|
headers := make(map[string]string)
|
|
|
|
return
|
|
|
|
headers["Content-Type"] = "application/json;charset=utf-8"
|
|
|
|
}
|
|
|
|
headers["token"] = token
|
|
|
|
//clientIds := make([]string, 0)
|
|
|
|
res, err := tools.PostHeader(url, []byte(req), headers)
|
|
|
|
for _, client := range clients {
|
|
|
|
log.Println(url, req, err, res)
|
|
|
|
//clientIds = append(clientIds, client.Client_id)
|
|
|
|
|
|
|
|
req := fmt.Sprintf(format, tools.Md5(tools.Uuid()), client.Client_id, title, content)
|
|
|
|
|
|
|
|
url := "https://restapi.getui.com/v2/" + appid + "/push/single/cid"
|
|
|
|
|
|
|
|
headers := make(map[string]string)
|
|
|
|
|
|
|
|
headers["Content-Type"] = "application/json;charset=utf-8"
|
|
|
|
|
|
|
|
headers["token"] = token
|
|
|
|
|
|
|
|
res, err := tools.PostHeader(url, []byte(req), headers)
|
|
|
|
|
|
|
|
log.Println(url, req, err, res)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func getGetuiToken() string {
|
|
|
|
func getGetuiToken() string {
|
|
|
|
appid := models.FindConfig("GetuiAppID")
|
|
|
|
appid := models.FindConfig("GetuiAppID")
|
|
|
|