aa
This commit is contained in:
@@ -155,27 +155,27 @@ func OnTokenChange(values url.Values) {
|
||||
return
|
||||
}
|
||||
voc := &model.VendorOrgCode{}
|
||||
sql := `
|
||||
SELECT * FROM tmp_jd WHERE vendor_org_code = ?
|
||||
`
|
||||
sqlParams := []interface{}{tokenInfo.VenderID}
|
||||
if err := dao.GetRow(db, &voc, sql, sqlParams); err == nil && voc != nil {
|
||||
if result, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, voc.VendorOrgCode, model.VendorOrgTypePlatform); len(result) > 0 {
|
||||
result[0].Token = tokenInfo.Token
|
||||
if _, err = dao.UpdateEntity(db, result[0], "Token"); err == nil {
|
||||
//添加成功后去开发者后台填验证码
|
||||
// if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil {
|
||||
// api.JdAPI.SetCookieWithStr(configs[0].Value)
|
||||
// result2, _ := api.JdAPI.GetJdAppInfo()
|
||||
// result[0].AppKey = result2.AppKey
|
||||
// result[0].AppSecret = result2.AppSecret
|
||||
// dao.UpdateEntity(db, result[0], "AppKey", "AppSecret")
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("OnTokenChange, 发token,但是库里没这个账号")
|
||||
//sql := `
|
||||
// SELECT * FROM tmp_jd WHERE vendor_org_code = ?
|
||||
//`
|
||||
//sqlParams := []interface{}{tokenInfo.VenderID}
|
||||
//if err := dao.GetRow(db, &voc, sql, sqlParams); err == nil && voc != nil {
|
||||
if result, _ := dao.GetVendorOrgCode(db, model.VendorIDJD, voc.VendorOrgCode, model.VendorOrgTypePlatform); len(result) > 0 {
|
||||
result[0].Token = tokenInfo.Token
|
||||
if _, err := dao.UpdateEntity(db, result[0], "Token"); err == nil {
|
||||
//添加成功后去开发者后台填验证码
|
||||
// if configs, err := dao.QueryConfigs(dao.GetDB(), "jdConfigCookie", model.ConfigTypeCookie, ""); err == nil {
|
||||
// api.JdAPI.SetCookieWithStr(configs[0].Value)
|
||||
// result2, _ := api.JdAPI.GetJdAppInfo()
|
||||
// result[0].AppKey = result2.AppKey
|
||||
// result[0].AppSecret = result2.AppSecret
|
||||
// dao.UpdateEntity(db, result[0], "AppKey", "AppSecret")
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
globals.SugarLogger.Debugf("OnTokenChange, 发token,但是库里没这个账号")
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user