Compare commits

..

2 Commits

Author SHA1 Message Date
sugarBecomer 0f83cfc9b9 ✨ 适配华侨大学 2025-11-23 20:55:54 +08:00
sugarBecomer 83749fc647 🐛 提交验证码处理 2025-11-22 22:49:32 +08:00
6 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -46,7 +46,7 @@ bucket = "likedream"
appVersion = "9.7.2"
systemVersion = "iOS 17"
calVersion = "firstv"
sliderIds = ["1018764144934965", "sdhyxy", "hqdx"]
[task]
concurrency = 20
+3 -1
View File
@@ -23,6 +23,7 @@ import (
"github.com/PuerkitoBio/goquery"
"github.com/avast/retry-go/v4"
"github.com/deatil/go-cryptobin/cryptobin/crypto"
"github.com/gogf/gf/v2/frame/g"
"github.com/samber/oops"
"github.com/tidwall/gjson"
"resty.dev/v3"
@@ -192,7 +193,8 @@ func (c *CpdailyCasLogin) Login(ctx context.Context, schoolDetail *school.School
}
// 声明需要滑块验证码的学校id
var SliderCaptchaIds = []string{"1018764144934965", "sdhyxy"}
var SliderCaptchaIds = g.Cfg().MustGet(ctx, cst.ConfigSliderSchoolIds).Strings()
// []string{"1018764144934965", "sdhyxy", "hqdx"}
// 判断是否需要验证码
if isCasNeedCaptcha(ctx, loginResponseUrl, loginType, username, c.client) {
// 如果是滑块验证码
@@ -42,9 +42,7 @@ type ApiResponse struct {
type ITStarResponse struct {
Code json.Number `json:"code"`
Msg string `json:"msg"`
Data struct {
SuccCode []string `json:"succCode"`
} `json:"data"`
Data []string `json:"data"`
}
type SubmitCaptchaResolver interface {
@@ -145,10 +145,7 @@ func (r *NormalSubmitCaptchaResolver) getResultFromItStar(rawResponse json.RawMe
err := sonic.Unmarshal(rawResponse, &responseMap)
utils.OkOrPanic(err)
responseMap["authKey"] = "ITStarYYDS"
itstarUrl := strings.TrimSuffix(r.getITStarUrl(), "/")
url := itstarUrl + "/captcha/unLimitValidate"
url := r.getITStarUrl()
resp, err := r.client.R().
SetBody(responseMap).
@@ -161,7 +158,7 @@ func (r *NormalSubmitCaptchaResolver) getResultFromItStar(rawResponse json.RawMe
utils.OkOrPanic(errors.NewBusinessError(503, fmt.Sprintf("验证码识别出错: %s", itstarResp.Msg)))
}
return itstarResp.Data.SuccCode
return itstarResp.Data
}
// submitCaptcha 提交验证码
@@ -551,7 +551,7 @@ func (c *CpdailySleepCheckTask) FillCustomForm(ctx context.Context, form map[str
return utils.Catch(func() {
ticket = submitCaptchaResolver.GetCaptchaTicket(ctx, captchaInfo)
})
}, retry.Delay(15*time.Second), retry.Attempts(5), retry.Context(ctx))
}, retry.Delay(10*time.Second), retry.Attempts(5), retry.Context(ctx))
if e != nil {
utils.OkOrPanic(errors.NewBusinessError(503, "提交验证码识别失败").WithInnerError(e), oops.WithContext(ctx).Wrap)
}
+1
View File
@@ -22,6 +22,7 @@ const (
ConfigCpdailyAppVersion = "cpdaily.appVersion"
ConfigCpdailySystemVersion = "cpdaily.systemVersion"
ConfigCpdailyCalVersion = "cpdaily.calVersion"
ConfigSliderSchoolIds = "cpdaily.sliderIds"
ConfigRedisUrl = "redis.url"