feat(查询优化): 剔除返回结果首尾空白字符

This commit is contained in:
xiaoqidun 2021-04-09 12:45:47 +08:00
parent 5303137428
commit 35d03559c6

View File

@ -8,6 +8,7 @@ import (
"golang.org/x/text/transform"
"io/ioutil"
"net"
"strings"
"sync"
)
@ -138,8 +139,8 @@ func QueryIP(queryIp string) (city string, area string, err error) {
}
}
}
city = gb18030Decode([]byte(city))
area = gb18030Decode([]byte(area))
city = strings.TrimSpace(gb18030Decode([]byte(city)))
area = strings.TrimSpace(gb18030Decode([]byte(area)))
ipCache.Store(queryIp, cache{City: city, Area: area})
return
}