style: 优化util GetIp格式
This commit is contained in:
@@ -23,11 +23,10 @@ func Search(reg string, content string) (string, error) {
|
|||||||
|
|
||||||
func GetIp(body string) (string, error) {
|
func GetIp(body string) (string, error) {
|
||||||
//判断原正则是否有匹配,如果无就使用新正则尝试
|
//判断原正则是否有匹配,如果无就使用新正则尝试
|
||||||
if ip, err := Search("id=\"user_ip\" value=\"(.*?)\"", body); err == nil {
|
if ip, e := Search("id=\"user_ip\" value=\"(.*?)\"", body); e == nil {
|
||||||
return ip, nil
|
return ip, nil
|
||||||
}
|
}
|
||||||
ip, err := Search("ip : \"(.*?)\"", body)
|
return Search("ip : \"(.*?)\"", body)
|
||||||
return ip, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetToken(body string) (string, error) {
|
func GetToken(body string) (string, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user