From 3aaccce092346f6e40ec2910033409faae1699bc Mon Sep 17 00:00:00 2001 From: Gh-mean <1625631757@qq.com> Date: Wed, 1 Dec 2021 21:46:05 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=80=82=E9=85=8D=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E6=B7=B1=E6=BE=9C=E6=A0=A1=E5=9B=AD=E7=BD=91=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/util.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/util.go b/util/util.go index 6f7b60f..2ef3af7 100644 --- a/util/util.go +++ b/util/util.go @@ -22,7 +22,12 @@ func Search(reg string, content string) (string, error) { } func GetIp(body string) (string, error) { - return Search("id=\"user_ip\" value=\"(.*?)\"", body) + //判断原正则是否有匹配,如果无就使用新正则尝试 + if ip, err := Search("id=\"user_ip\" value=\"(.*?)\"", body); err == nil { + return ip, nil + } + ip, err := Search("ip : \"(.*?)\"", body) + return ip, err } func GetToken(body string) (string, error) {