This commit is contained in:
parent
8884d945aa
commit
accb060e27
@ -65,7 +65,7 @@ func (c networkClient) ClientOfflineNotify() error {
|
||||
}
|
||||
|
||||
// 如果存在,判断离线时间
|
||||
if time.Since(peer.LastHandshakeTime) < 3 {
|
||||
if time.Since(peer.LastHandshakeTime).Minutes() < 3 {
|
||||
var ipAllocation string
|
||||
for _, iaip := range peer.AllowedIPs {
|
||||
ipAllocation += iaip.String() + ","
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"gitee.ltd/lxh/logger/log"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"strings"
|
||||
"wireguard-ui/global/client"
|
||||
"wireguard-ui/model"
|
||||
)
|
||||
@ -36,6 +37,7 @@ func WechatNotify(setting *model.Setting) wechatNotify {
|
||||
// @param msg
|
||||
// @return error
|
||||
func (w wechatNotify) SendTextMessage(msg string) error {
|
||||
log.Debugf("发送通知到微信: %v", msg)
|
||||
req := client.HttpClient.R()
|
||||
|
||||
req.SetHeader("Content-Type", "application/json")
|
||||
@ -43,7 +45,13 @@ func (w wechatNotify) SendTextMessage(msg string) error {
|
||||
"wxid": w.toUserId,
|
||||
"msg": msg,
|
||||
})
|
||||
result, err := req.Post(fmt.Sprintf("%s:%s", w.Addr, w.Path))
|
||||
|
||||
req.URL = fmt.Sprintf("%s:%s", w.Addr, w.Path)
|
||||
switch strings.ToUpper(w.Method) {
|
||||
case "POST":
|
||||
req.Method = "POST"
|
||||
}
|
||||
result, err := req.SetDebug(true).Send()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user