fix: 发短信前按页面完成预检查和回调计数

This commit is contained in:
Nixevol
2026-10-16 18:16:25 +08:00
parent ef33ed166c
commit d17d8c9778
3 changed files with 202 additions and 25 deletions
+20
View File
@@ -21,6 +21,12 @@ type loginScript struct {
pwdType string
userType string
redirectType string
jqueryVer string
releasePath string
checkFirst string
needPath string
agreePath string
userNoPath string
}
type billAPI struct {
@@ -44,6 +50,12 @@ var (
piwCookieRE = regexp.MustCompile(`setCookie\(\s*["']([A-Za-z0-9_]+)["']\s*,\s*data\.piw`)
pwdTypeRE = regexp.MustCompile(`PWD_TYPE_RND\s*=\s*["'](\d+)["']`)
userTypeRE = regexp.MustCompile(`USER_TYPE_MOBILE\s*=\s*["'](\d+)["']`)
jqueryVerRE = regexp.MustCompile(`(?:jquery:"|jQuery v)(\d+\.\d+\.\d+)`)
releaseRE = regexp.MustCompile(`(/portal/Service/checkRelease)`)
checkFirstRE = regexp.MustCompile(`(/portal/Service/alogin_checkFirst)`)
needVerifyRE = regexp.MustCompile(`(/portal/Service/CheckNeedVerify)`)
agreementRE = regexp.MustCompile(`(/portal/Service/CheckAgreement)`)
userNumberRE = regexp.MustCompile(`(/portal/Service/CheckUsernumber)`)
loginFromRE = regexp.MustCompile(`(?is)<input[^>]*id=["']loginFrom["'][^>]*>`)
inputValueRE = regexp.MustCompile(`value=["']([^"']*)["']`)
scriptSrcRE = regexp.MustCompile(`(?i)<script[^>]*?\ssrc=["']?([^"'\s>]+)`)
@@ -85,6 +97,14 @@ func parseLoginBundle(js string) (loginScript, error) {
if m := userTypeRE.FindStringSubmatch(js); m != nil {
out.userType = m[1]
}
if m := jqueryVerRE.FindStringSubmatch(js); m != nil {
out.jqueryVer = m[1]
}
out.releasePath = first(releaseRE, js)
out.checkFirst = first(checkFirstRE, js)
out.needPath = first(needVerifyRE, js)
out.agreePath = first(agreementRE, js)
out.userNoPath = first(userNumberRE, js)
if out.sendPath == "" || out.loginPath == "" || out.captchaAppID == "" {
return out, errors.New("登录脚本不完整")
}