This commit is contained in:
苏尹岚
2021-03-23 16:50:29 +08:00
parent b40e508ac2
commit 97a9605712
2 changed files with 111 additions and 98 deletions

View File

@@ -2,10 +2,9 @@ package jd
import (
"encoding/json"
"fmt"
"net/url"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals/api"
"git.rosy.net.cn/jx-callback/business/model/dao"
@@ -125,7 +124,12 @@ func OnTokenChange(values url.Values) {
dao.WrapAddIDCULDEntity(voc2, "jxadmin")
if err := dao.CreateEntity(db, voc2); err == nil {
//添加成功后去开发者后台填验证码
if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil {
api.JdAPI.SetCookieWithStr(configs[0].Value)
if appID, err := api.JdAPI.GetJdNoAuthAppID(codeInfo.VenderID); err == nil {
api.JdAPI.SetCode(codeInfo.Code, appID)
}
}
}
} else {
globals.SugarLogger.Debugf("OnTokenChange 发验证码,但是库里有这个账号了")
@@ -133,12 +137,9 @@ func OnTokenChange(values url.Values) {
}
} else {
tokenInfo := &JdToken{}
fmt.Println("11111111111111111111", values)
if dataStr := values.Get("token"); dataStr != "" {
json.Unmarshal([]byte(dataStr), &tokenInfo)
}
fmt.Println("11111111111111111111", values.Get("token"))
fmt.Println("11111111111111111111", utils.Format4Output(tokenInfo, false))
if tokenInfo == nil {
return
}