This commit is contained in:
Jay 2018-12-06 10:56:20 +08:00
parent c500f47e79
commit a1db5d2f47
2 changed files with 4 additions and 0 deletions

View File

@ -7,6 +7,7 @@ import (
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"log"
"net/http" "net/http"
"net/url" "net/url"
"strings" "strings"
@ -118,6 +119,7 @@ func PushMessage(target string, message interface{}) {
_, err = http.DefaultClient.Do(req) _, err = http.DefaultClient.Do(req)
if err != nil { if err != nil {
log.Println("send to line error :::: ", err)
return return
} }
} }

View File

@ -130,6 +130,7 @@ func GetNotifyWebhook(c *context.Context) {
log.Println("group data :::: ", v, v.Notify, v.Name) log.Println("group data :::: ", v, v.Notify, v.Name)
if v.Notify { if v.Notify {
str := v.Tmpl str := v.Tmpl
log.Println("template :::: ", str)
if len(str) == 0 { if len(str) == 0 {
str = fmt.Sprintf("%s\n%s", hook.Entry[0].Title, hook.Entry[0].Link.Href) str = fmt.Sprintf("%s\n%s", hook.Entry[0].Title, hook.Entry[0].Link.Href)
} else { } else {
@ -140,6 +141,7 @@ func GetNotifyWebhook(c *context.Context) {
msg := &lineapi.TextMessage{ msg := &lineapi.TextMessage{
Text: str, Text: str,
} }
log.Println("msg ::::: ", msg)
lineapi.PushMessage(v.ID, msg) lineapi.PushMessage(v.ID, msg)
} }