parent
b8ce5a0474
commit
b0abaecf08
@ -1,3 +1,4 @@
|
||||
{
|
||||
"Upload":"static/upload/"
|
||||
"Upload":"static/upload/",
|
||||
"NoticeServerJiang": true
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/taoshihan1991/imaptool/config"
|
||||
"github.com/taoshihan1991/imaptool/tools"
|
||||
"log"
|
||||
)
|
||||
|
||||
func SendServerJiang(content string)string{
|
||||
conf:=config.CreateConfig()
|
||||
if config.ServerJiang=="" || !conf.NoticeServerJiang{
|
||||
log.Println("do not notice serverjiang:",config.ServerJiang,conf.NoticeServerJiang)
|
||||
return ""
|
||||
}
|
||||
sendStr:=fmt.Sprintf("%s,访客来了",content)
|
||||
desp:="[登录](https://gofly.sopans.com/main)";
|
||||
res:=tools.Get(config.ServerJiang+"?text="+sendStr+"&desp="+desp)
|
||||
return res
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func Get(url string)string{
|
||||
res, err :=http.Get(url)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
robots, err := ioutil.ReadAll(res.Body)
|
||||
res.Body.Close()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return string(robots)
|
||||
}
|
Loading…
Reference in new issue