删除了ai识别验证码部分,新增个人成绩补考标识和cet成绩查询

This commit is contained in:
WuYuuuub
2026-06-17 12:21:27 +08:00
parent 1cd0c655f8
commit 58301bbed0
9 changed files with 456 additions and 134 deletions

View File

@@ -1,55 +1,7 @@
package captcha
import (
"fmt"
"io"
"log/slog"
"net/http"
"schedule_converter/client"
"schedule_converter/config"
)
func SaveCaptchaImage(httpClient *http.Client) ([]byte, error) {
req, err := http.NewRequest("GET", config.Get().BaseURL+"/captchaImage", nil)
if err != nil {
return nil, err
}
req.Header = client.GetHeaders()
resp, err := httpClient.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("获取验证码失败, 状态码: %d", resp.StatusCode)
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}
return body, nil
// GetCaptchaCode 返回固定验证码
// 教务系统验证码已不再需要识别,直接使用固定值
func GetCaptchaCode() string {
return "...."
}
func GetAndRecognize(httpClient *http.Client) (string, error) {
_, err := SaveCaptchaImage(httpClient)
if err != nil {
return "", err
}
captchaCode, err := Recognize("captcha.png")
if err != nil {
return "", err
}
slog.Debug("验证码识别完成", "result", captchaCode)
return captchaCode, nil
}
func Recognize(imagePath string) (string, error) {
return "....", nil
}