mirror of
				https://github.com/xiaoqidun/qqwry.git
				synced 2023-06-27 14:38:22 +08:00 
			
		
		
		
	feat(查询优化): 剔除返回结果首尾空白字符
This commit is contained in:
		
							
								
								
									
										5
									
								
								qqwry.go
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								qqwry.go
									
									
									
									
									
								
							| @@ -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 | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user