Fixed location info
This commit is contained in:
parent
efe8a36b7a
commit
325d17c871
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
@ -83,11 +84,18 @@ func updateUserInfo(ctx *aero.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
newLocation := arn.UserLocation{}
|
newLocation := arn.IPInfoDBLocation{}
|
||||||
json.Unmarshal(data, &newLocation)
|
json.Unmarshal(data, &newLocation)
|
||||||
|
|
||||||
if newLocation.CountryName != "-" {
|
if newLocation.CountryName != "-" {
|
||||||
user.Location = newLocation
|
user.Location.CountryName = newLocation.CountryName
|
||||||
|
user.Location.CountryCode = newLocation.CountryCode
|
||||||
|
user.Location.Latitude, _ = strconv.ParseFloat(newLocation.Latitude, 64)
|
||||||
|
user.Location.Longitude, _ = strconv.ParseFloat(newLocation.Latitude, 64)
|
||||||
|
user.Location.CityName = newLocation.CityName
|
||||||
|
user.Location.RegionName = newLocation.RegionName
|
||||||
|
user.Location.TimeZone = newLocation.TimeZone
|
||||||
|
user.Location.ZipCode = newLocation.ZipCode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user