GetByFilter 通过 Get 方法获取数据,自动拼接 url param 参数
(url string, body, filters map[string]interface{}, opts ...HTTPOption)
| 242 | |
| 243 | // GetByFilter 通过 Get 方法获取数据,自动拼接 url param 参数 |
| 244 | func GetByFilter(url string, body, filters map[string]interface{}, opts ...HTTPOption) (*simplejson.Json, error) { |
| 245 | if !strings.HasSuffix(url, "/") { |
| 246 | url = url + "/" |
| 247 | } |
| 248 | if !strings.HasSuffix(url, "?") { |
| 249 | url = url + "?" |
| 250 | } |
| 251 | |
| 252 | i, count := 0, len(filters) |
| 253 | for k, v := range filters { |
| 254 | url += fmt.Sprintf("%v=%v", k, v) |
| 255 | if i < count-1 { |
| 256 | url += "&" |
| 257 | } |
| 258 | i++ |
| 259 | } |
| 260 | return CURLPerform("GET", url, body, "", opts...) |
| 261 | } |
| 262 | |
| 263 | var chinesePunctuationRegex = regexp.MustCompile("[(\u4e00-\u9fa5)(\u3002|\uff1f|\uff01|\uff0c|\u3001|\uff1b|\uff1a|\u201c|\u201d|\u2018|\u2019|\uff08|\uff09|\u300a|\u300b|\u3010|\u3011|\u007e)]+") |
| 264 |
nothing calls this directly
no test coverage detected