52 lines
1.5 KiB
Go
52 lines
1.5 KiB
Go
package submitcaptcha
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
)
|
|
|
|
// ValidationInfo 验证信息结构体
|
|
type ValidationInfo struct {
|
|
Validation bool `json:"validation"` // 验证状态,必需字段
|
|
SceneCode string `json:"sceneCode,omitempty"` // 场景代码,可选
|
|
AccountKey string `json:"accountKey,omitempty"` // 账户密钥,可选
|
|
TenantId string `json:"tenantId,omitempty"` // 租户ID,可选
|
|
UserId string `json:"userId,omitempty"` // 用户ID,可选
|
|
}
|
|
|
|
// CpSubmitCaptcha 今日校园提交验证码结构体
|
|
type CpSubmitCaptcha struct {
|
|
Code string `json:"code,omitempty"`
|
|
RawResponseJson json.RawMessage `json:"-"`
|
|
}
|
|
|
|
type CpSubmitCaptchaForAI struct {
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
ImageInfos []struct {
|
|
Code string `json:"code"`
|
|
Path string `json:"path"`
|
|
} `json:"imageInfos"`
|
|
}
|
|
|
|
// ApiResponse 通用API响应结构体
|
|
type ApiResponse struct {
|
|
Code json.Number `json:"code"`
|
|
Message string `json:"message"`
|
|
Data json.RawMessage `json:"data,omitempty"`
|
|
Datas json.RawMessage `json:"datas,omitempty"`
|
|
Result json.RawMessage `json:"result,omitempty"`
|
|
}
|
|
|
|
// ITStarResponse ITStar验证码识别响应结构体
|
|
type ITStarResponse struct {
|
|
Code json.Number `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data []string `json:"data"`
|
|
}
|
|
|
|
type SubmitCaptchaResolver interface {
|
|
GetValidationInfo(ctx context.Context) ValidationInfo
|
|
GetCaptchaTicket(ctx context.Context, info ValidationInfo) string
|
|
}
|