From 7b66a66f3e00f6192d899e1fe31e13d16398ed9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Mon, 2 Mar 2020 14:44:35 +0800 Subject: [PATCH] =?UTF-8?q?Cookie=E5=8A=A0=E5=85=A5=E5=88=B0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/misc/misc.go | 14 ++++++++++++-- business/model/new_config.go | 2 ++ globals/api/api.go | 28 ++++++++++++++-------------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 34748517b..41efd68c8 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -108,7 +108,9 @@ var ( cancelPayTimeOutOrderList = localjx.GetHalfHoursList() - ebaiStorePageCookieExdTOKEN string + ebaiStorePageCookieExdTOKEN string + ebaiStorePageCookieWMUSS2 string + ebaiStorePageCookieWMSTOKEN2 string ) func GetImportantTaskID(taskName string) string { @@ -206,8 +208,16 @@ func Init() { if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieExdTOKEN", model.ConfigTypeSys, ""); err == nil { ebaiStorePageCookieExdTOKEN = configs[0].Value } - api.Ebai2API.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) + if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieWMUSS2", model.ConfigTypeSys, ""); err == nil { + ebaiStorePageCookieWMUSS2 = configs[0].Value + } + if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieWMSTOKEN2", model.ConfigTypeSys, ""); err == nil { + ebaiStorePageCookieWMSTOKEN2 = configs[0].Value + } api.EbaiAPI.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) + api.Ebai2API.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) + api.Ebai2API.SetCookie("WMUSS", ebaiStorePageCookieWMUSS2) + api.Ebai2API.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN2) } func syncStoreSku() { diff --git a/business/model/new_config.go b/business/model/new_config.go index 4dd3f2a43..a2f1bc131 100644 --- a/business/model/new_config.go +++ b/business/model/new_config.go @@ -7,6 +7,7 @@ const ( ConfigTypeBank = "Bank" ConfigTypeRole = "Role" ConfigTypeJxStore = "JxStore" + ConfigTypeCookie = "Cookie" ) const ( @@ -24,6 +25,7 @@ var ( ConfigTypeBank: "银行", ConfigTypeRole: "角色", ConfigTypeJxStore: "京西商城", + ConfigTypeCookie: "Cookie", } ) diff --git a/globals/api/api.go b/globals/api/api.go index 25420c685..6fcf9263f 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -127,22 +127,22 @@ func Init() { } if !beego.AppConfig.DefaultBool("disableEbai", false) { EbaiAPI = ebaiapi.New(beego.AppConfig.String("ebaiSource"), beego.AppConfig.String("ebaiSecret")) - ebaiStorePageCookieWMUSS := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS", "") - ebaiStorePageCookieWMSTOKEN := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN", "") + // ebaiStorePageCookieWMUSS := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS", "") + // ebaiStorePageCookieWMSTOKEN := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN", "") // ebaiStorePageCookieExdTOKEN := beego.AppConfig.DefaultString("ebaiStorePageCookieExdTOKEN", "") - if ebaiStorePageCookieWMUSS != "" && ebaiStorePageCookieWMSTOKEN != "" { //&& ebaiStorePageCookieExdTOKEN != "" { - EbaiAPI.SetCookie("WMUSS", ebaiStorePageCookieWMUSS) - EbaiAPI.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN) - // EbaiAPI.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) - } + // if ebaiStorePageCookieWMUSS != "" && ebaiStorePageCookieWMSTOKEN != "" { //&& ebaiStorePageCookieExdTOKEN != "" { + // EbaiAPI.SetCookie("WMUSS", ebaiStorePageCookieWMUSS) + // EbaiAPI.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN) + // EbaiAPI.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) + // } Ebai2API = ebaiapi.New(beego.AppConfig.String("ebaiSource"), beego.AppConfig.String("ebaiSecret")) - ebaiStorePageCookieWMUSS2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS2", "") - ebaiStorePageCookieWMSTOKEN2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN2", "") - if ebaiStorePageCookieWMUSS2 != "" && ebaiStorePageCookieWMSTOKEN2 != "" { //&& ebaiStorePageCookieExdTOKEN != "" { - Ebai2API.SetCookie("WMUSS", ebaiStorePageCookieWMUSS2) - Ebai2API.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN2) - // Ebai2API.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) - } + // ebaiStorePageCookieWMUSS2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS2", "") + // ebaiStorePageCookieWMSTOKEN2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN2", "") + // if ebaiStorePageCookieWMUSS2 != "" && ebaiStorePageCookieWMSTOKEN2 != "" { //&& ebaiStorePageCookieExdTOKEN != "" { + // Ebai2API.SetCookie("WMUSS", ebaiStorePageCookieWMUSS2) + // Ebai2API.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN2) + // Ebai2API.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) + // } } else { EbaiAPI = nil Ebai2API = nil