更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -12,13 +12,10 @@ import (
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// ApiGetCardController 对外提卡接口(无需登录)
|
||||
// GET /api/getcard?type=xianyu&module=cursor
|
||||
type ApiGetCardController struct {
|
||||
beego.Controller
|
||||
}
|
||||
|
||||
// validPlatformTypes 支持的来源平台
|
||||
var validPlatformTypes = map[string]bool{
|
||||
"xianyu": true,
|
||||
"pinduoduo": true,
|
||||
@@ -28,7 +25,6 @@ var validPlatformTypes = map[string]bool{
|
||||
"xubei": true,
|
||||
}
|
||||
|
||||
// validModules 支持的号池模块
|
||||
var validModules = map[string]bool{
|
||||
"cursor": true,
|
||||
"windsurf": true,
|
||||
@@ -48,14 +44,6 @@ func (c *ApiGetCardController) cardOK(text string) {
|
||||
_ = c.Ctx.Output.Body([]byte(text))
|
||||
}
|
||||
|
||||
// GetCard 提取一张卡(不可重复提取)
|
||||
// GET /api/getcard?type=xianyu&module=cursor&data_type=tk
|
||||
//
|
||||
// 参数:
|
||||
// - type (必填) 来源平台:xianyu / taobao / pinduoduo / jingdong / local / xubei
|
||||
// - module (必填) 号池模块:cursor / windsurf / krio / codex
|
||||
// - data_type (可选) 账号类型:account / tk / account_tk,不传则取任意未提取的
|
||||
// - id/start_id/current_id (可选) 起始 ID:仅取 id >= 起始值 的记录,按 id 从大到小提取
|
||||
func (c *ApiGetCardController) GetCard() {
|
||||
platform := c.GetString("type")
|
||||
module := c.GetString("module")
|
||||
@@ -66,7 +54,6 @@ func (c *ApiGetCardController) GetCard() {
|
||||
return
|
||||
}
|
||||
|
||||
// 读取机器码/MAC
|
||||
machineCode := strings.TrimSpace(c.GetString("machine_code"))
|
||||
if machineCode == "" {
|
||||
machineCode = strings.TrimSpace(c.GetString("machineCode"))
|
||||
@@ -75,7 +62,6 @@ func (c *ApiGetCardController) GetCard() {
|
||||
machineCode = strings.TrimSpace(c.GetString("mac"))
|
||||
}
|
||||
|
||||
// 参数校验
|
||||
if platform == "" {
|
||||
c.cardErr(400, 400, "缺少参数 type(来源平台)")
|
||||
return
|
||||
@@ -131,7 +117,6 @@ func (c *ApiGetCardController) readOptionalStartID() (uint64, error) {
|
||||
}
|
||||
|
||||
func (c *ApiGetCardController) extractCursor(platform, dataType string, startID uint64, now time.Time, machineCode string) {
|
||||
// 优先查询该机器码是否已经绑定过未删除的卡密
|
||||
if machineCode != "" {
|
||||
var existing models.PlatformAccountPoolCursor
|
||||
err := models.Orm.QueryTable(new(models.PlatformAccountPoolCursor)).
|
||||
@@ -142,7 +127,6 @@ func (c *ApiGetCardController) extractCursor(platform, dataType string, startID
|
||||
Limit(1).
|
||||
One(&existing)
|
||||
if err == nil {
|
||||
// 直接返回已绑定的卡密信息
|
||||
c.cardOK(buildCardResult(&existing.Account, &existing.Password, existing.Token, existing.DataType))
|
||||
return
|
||||
}
|
||||
@@ -225,7 +209,6 @@ func (c *ApiGetCardController) extractCodex(platform, dataType string, startID u
|
||||
|
||||
type poolRowFetcher func() (id uint64, account, password *string, token, rowDataType string, isUsed *int8, err error)
|
||||
|
||||
// extractWithProbe 按 id 从大到小提取并探测 Token 可用性;不可用则标记已提取并继续下一条。
|
||||
func (c *ApiGetCardController) extractWithProbe(
|
||||
module, platform, dataType string,
|
||||
now time.Time,
|
||||
@@ -267,7 +250,6 @@ func (c *ApiGetCardController) extractWithProbe(
|
||||
return
|
||||
}
|
||||
|
||||
// 已有探测结论:可用则直接返回,不可用则继续下一条。
|
||||
if known, available := poolIsUsedAvailable(isUsed); known {
|
||||
if available {
|
||||
c.cardOK(buildCardResult(account, password, token, rowDataType))
|
||||
@@ -291,7 +273,6 @@ func (c *ApiGetCardController) extractWithProbe(
|
||||
}
|
||||
}
|
||||
|
||||
// buildCardResult 根据账号类型返回格式化字符串
|
||||
func buildCardResult(account, password *string, token string, dataType string) string {
|
||||
acc := ""
|
||||
pwd := ""
|
||||
@@ -306,7 +287,7 @@ func buildCardResult(account, password *string, token string, dataType string) s
|
||||
return fmt.Sprintf("账号:%s / 密码:%s", acc, pwd)
|
||||
case "account_tk":
|
||||
return fmt.Sprintf("账号:%s / 密码:%s / Token:%s", acc, pwd, token)
|
||||
default: // tk
|
||||
default:
|
||||
return token
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user