Commit 8ca9f219 by Joneq

增加发送短信

parent 09c61258
Showing with 39 additions and 0 deletions
package logic
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"time"
)
const APIMD5STR string = "fh6y5t4rr351d2c3bryi"
const APIDOMAIN string = "http://api.liexin.com/msg/sendMessageByAuto"
func sendMessage(mobile , content string){
timeNow := time.Now().Second()
requestContent,_ := json.Marshal(map[string]string{"content":content})
requestTel,_ := json.Marshal([]string{mobile})
requestbody,err := json.Marshal(map[string]map[string]string{
"form_params" :{
"data" : string(requestContent),
"touser" :string(requestTel),
"keyword" : "crm_notify_kefu",
"k1" : Int64TurnString(int64(timeNow)),
"k2" : Md5(Md5(Int64TurnString(int64(timeNow)))+APIMD5STR),
"is_ignore" : "true",
},
})
if err != nil {
fmt.Print(err)
}
resp,err := http.Post(APIDOMAIN,"application/json",bytes.NewBuffer(requestbody))
defer resp.Body.Close()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment