mirror of
https://github.com/xiaoqidun/qqwry.git
synced 2023-06-27 14:38:22 +08:00
feat(查询优化): 剔除返回结果首尾空白字符
This commit is contained in:
parent
5303137428
commit
35d03559c6
5
qqwry.go
5
qqwry.go
@ -8,6 +8,7 @@ import (
|
|||||||
"golang.org/x/text/transform"
|
"golang.org/x/text/transform"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net"
|
"net"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -138,8 +139,8 @@ func QueryIP(queryIp string) (city string, area string, err error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
city = gb18030Decode([]byte(city))
|
city = strings.TrimSpace(gb18030Decode([]byte(city)))
|
||||||
area = gb18030Decode([]byte(area))
|
area = strings.TrimSpace(gb18030Decode([]byte(area)))
|
||||||
ipCache.Store(queryIp, cache{City: city, Area: area})
|
ipCache.Store(queryIp, cache{City: city, Area: area})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user