- update
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

master v1.0.34
李光春 2 years ago
parent 510aa3e051
commit 09a09e3888

@ -1,3 +1,3 @@
package golog
const Version = "1.0.33"
const Version = "1.0.34"

@ -106,25 +106,29 @@ func (c *GinClient) GormMiddleware() gin.HandlerFunc {
// 解析请求内容
var xmlBody map[string]string
var jsonBody map[string]interface{}
_ = json.Unmarshal(data, &jsonBody)
err := json.Unmarshal(data, &jsonBody)
if len(jsonBody) <= 0 {
xmlBody = goxml.XmlDecode(string(data))
}
if err != nil {
xmlBody = goxml.XmlDecode(string(data))
}
clientIp := gorequest.ClientIp(ginCtx.Request)
requestClientIpCountry, requestClientIpRegion, requestClientIpProvince, requestClientIpCity, requestClientIpIsp := "", "", "", "", ""
if c.ipService != nil {
// 判断是不是IPv4
if net.ParseIP(clientIp).To4() != nil {
// 判断是不是IPv4
_, info := c.ipService.Ipv4(clientIp)
requestClientIpCountry = info.Country
requestClientIpRegion = info.Region
requestClientIpProvince = info.Province
requestClientIpCity = info.City
requestClientIpIsp = info.ISP
} else if net.ParseIP(clientIp).To16() != nil {
// 判断是不是IPv6
}
// 判断是不是IPv6
if net.ParseIP(clientIp).To16() != nil {
info := c.ipService.Ipv6(clientIp)
requestClientIpCountry = info.Country
requestClientIpProvince = info.Province

Loading…
Cancel
Save