diff --git a/conf/demo_config.yaml b/conf/demo_config.yaml index b849138..9d0d731 100644 --- a/conf/demo_config.yaml +++ b/conf/demo_config.yaml @@ -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 代表限制次数 diff --git a/controllers/login.go b/controllers/login.go index bf9df4e..f0ee0db 100644 --- a/controllers/login.go +++ b/controllers/login.go @@ -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)) }