1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package utils
import (
"crypto/md5"
"encoding/hex"
"gin-vue-admin/global"
"strconv"
"time"
)
func GetIpaddr(ip string) GetIpaddrReply {
url := global.GVA_CONFIG.Ipaddr.Url
data := map[string]string{}
data["ip"] = ip
resp := GetIpaddrPostUrl(url, data, global.GVA_CONFIG.Ipaddr.Appcode, 1)
reply := new(GetIpaddrReply)
UnserislizeJson(resp, reply)
return *reply
}
type GetIpaddrReq struct {
Ip string `json:"ip"`
}
type GetIpaddrReply struct {
Code int `json:"code"`
Msg string `json:"msg"`
TaskNo string `json:"taskNo"`
Data IpData `json:"data"`
}
type IpData struct {
Country string `json:"country"`
CountryID string `json:"country_id"`
Area string `json:"area"`
Region string `json:"region"`
RegionID string `json:"region_id"`
City string `json:"city"`
CityID string `json:"city_id"`
IP string `json:"ip"`
LongIP string `json:"long_ip"`
Isp string `json:"isp"`
}
func SendMobileCode(action, mobile, code string) string {
url := "http://39.101.175.217:8088" + "/v2sms.aspx"
nowtime := strconv.FormatInt(time.Now().Unix(), 10)
h := md5.New()
h.Write([]byte("dthydthy12345" + nowtime))
sign := hex.EncodeToString(h.Sum(nil))
content := "【顶图DR】您的验证码为:" + code
postData := make(map[string]string)
postData["action"] = action
postData["rt"] = "json"
postData["userid"] = "47"
postData["timestamp"] = nowtime
postData["sign"] = string(sign)
postData["mobile"] = mobile
postData["content"] = content
postData["sendTime"] = ""
postData["extno"] = ""
return PostWithFormData("POST", url, &postData, "")
}