阅读背景:

go 钉钉报警

来源:互联网 
代码 package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" ) const webhook_url = "https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" func dingToInfo(s string) bool { content, data := make(map[string]string), make(map[string]interface{}) content["content"] = s data["msgtype"] = "text" data["text"] = content b, _ := json.Marshal(data) resp, err := http.Post(webhook_url, "application/json", bytes.NewBuffer(b)) if err != nil { fmt.Println(err) } defer resp.Body.Close() body, _ := ioutil.ReadAll(resp.Body) fmt.Println(string(body)) return true } func main() { dingToInfo("报警") }代码 package main import ( "bytes" "encoding/json" "


你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: