fix 去除token配置,配合喵咪对接

This commit is contained in:
ZJY 2021-09-27 22:25:37 +08:00
parent d3433daf60
commit 171a3f3e43
2 changed files with 43 additions and 61 deletions

View File

@ -11,7 +11,6 @@ containers:
AtTime: #填写1-12之间的数 填错自负默认为10 10点容易出现高峰超时。
IsHelp: #填写true或者false false
IsOldV4: #填写true或者false false是否新版或者旧版V4
ApiToken: #为空默认随机禁用
Wskey: # 填空默认禁用wskey转换 需要的填true
IsAddFriend: #填写true或者false false
Lim: #填写1-N 代表限制次数

View File

@ -478,78 +478,61 @@ func (c *LoginController) CkLogin() {
}
func (c *LoginController) SMSLogin() {
token := c.GetString("token")
cookie := c.GetString("ck")
qq := c.GetString("qq")
logs.Info(cookie)
(&models.JdCookie{}).Push(cookie)
if token == models.Config.ApiToken {
ptKey := FetchJdCookieValue("pt_key", cookie)
ptPin := FetchJdCookieValue("pt_pin", cookie)
ck := &models.JdCookie{
PtKey: ptKey,
PtPin: ptPin,
Hack: models.False,
QQ: 0,
}
if qq != "" {
ck.QQ, _ = strconv.Atoi(qq)
}
if ptKey != "" && ptPin != "" {
if models.CookieOK(ck) {
if !models.HasPin(ptPin) {
models.NewJdCookie(ck)
ck.Query()
msg := fmt.Sprintf("来自短信的添加,账号:%s,QQ: %s", ck.PtPin, qq)
(&models.JdCookie{}).Push(msg)
} else if !models.HasKey(ptKey) {
ck, _ := models.GetJdCookie(ptPin)
ck.InPool(ptKey)
if qq != "" {
ck.Update(models.QQ, qq)
}
msg := fmt.Sprintf("来自短信的更新,账号:%s", ck.PtPin)
(&models.JdCookie{}).Push(msg)
}
result := Result{
Data: "null",
Code: 200,
Message: "添加成功",
}
jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[]
if errs != nil {
fmt.Println(errs.Error())
}
c.Ctx.WriteString(string(jsons))
} else {
result := Result{
Data: "null",
Code: 300,
Message: "CK过期",
}
jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[]
if errs != nil {
fmt.Println(errs.Error())
}
msg := fmt.Sprintf("传入过期CK请小心攻击账号%s", ck.PtPin)
ptKey := FetchJdCookieValue("pt_key", cookie)
ptPin := FetchJdCookieValue("pt_pin", cookie)
ck := &models.JdCookie{
PtKey: ptKey,
PtPin: ptPin,
Hack: models.False,
QQ: 0,
}
if qq != "" {
ck.QQ, _ = strconv.Atoi(qq)
}
if ptKey != "" && ptPin != "" {
if models.CookieOK(ck) {
if !models.HasPin(ptPin) {
models.NewJdCookie(ck)
ck.Query()
msg := fmt.Sprintf("来自短信的添加,账号:%s,QQ: %s", ck.PtPin, qq)
(&models.JdCookie{}).Push(msg)
} else if !models.HasKey(ptKey) {
ck, _ := models.GetJdCookie(ptPin)
ck.InPool(ptKey)
if qq != "" {
ck.Update(models.QQ, qq)
}
msg := fmt.Sprintf("来自短信的更新,账号:%s", ck.PtPin)
(&models.JdCookie{}).Push(msg)
c.Ctx.WriteString(string(jsons))
}
} else {
result := Result{
Data: "null",
Code: 300,
Message: "CK错误",
Code: 200,
Message: "添加成功",
}
jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[]
if errs != nil {
fmt.Println(errs.Error())
}
msg := fmt.Sprintf("传入错误CK请小心攻击账号%s", ck.PtPin)
c.Ctx.WriteString(string(jsons))
} else {
result := Result{
Data: "null",
Code: 300,
Message: "CK过期",
}
jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[]
if errs != nil {
fmt.Println(errs.Error())
}
msg := fmt.Sprintf("传入过期CK请小心攻击账号%s", ck.PtPin)
(&models.JdCookie{}).Push(msg)
c.Ctx.WriteString(string(jsons))
}
@ -557,13 +540,13 @@ func (c *LoginController) SMSLogin() {
result := Result{
Data: "null",
Code: 300,
Message: "Token错误",
Message: "CK错误",
}
jsons, errs := json.Marshal(result) //转换成JSON返回的是byte[]
if errs != nil {
fmt.Println(errs.Error())
}
msg := fmt.Sprintf("传入错误Token请小心攻击")
msg := fmt.Sprintf("传入错误CK请小心攻击账号%s", ck.PtPin)
(&models.JdCookie{}).Push(msg)
c.Ctx.WriteString(string(jsons))
}