From 0dca8a5d95831f1cd83a980f67e96bb34d660623 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 15:41:45 +0800 Subject: [PATCH] =?UTF-8?q?cookie=E8=AE=BE=E7=BD=AE=E5=9C=A8newconfig?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/cms.go | 1 + business/jxstore/misc/misc.go | 15 +++++++++++++++ conf/app.conf | 2 +- globals/api/api.go | 6 +++--- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index 03952ebe1..e6df5aa6c 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -297,6 +297,7 @@ func checkConfig(opFlag int, configType, key, value string) (err error) { err = checkSysConfig(key, value) } case model.ConfigTypeJxStore: + case model.ConfigTypeCookie: default: err = fmt.Errorf("当前只支持配置:%s, 传入的配置类型:%s", utils.Format4Output(model.ConfigTypeName, true), configType) } diff --git a/business/jxstore/misc/misc.go b/business/jxstore/misc/misc.go index 0ea33caeb..ac74fbe3a 100644 --- a/business/jxstore/misc/misc.go +++ b/business/jxstore/misc/misc.go @@ -111,6 +111,9 @@ var ( ebaiStorePageCookieExdTOKEN string ebaiStorePageCookieWMUSS2 string ebaiStorePageCookieWMSTOKEN2 string + ebaiStorePageCookieWMUSS string + ebaiStorePageCookieWMSTOKEN string + mtwmCookieStr string ) func GetImportantTaskID(taskName string) string { @@ -214,10 +217,22 @@ func Init() { if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieWMSTOKEN2", model.ConfigTypeCookie, ""); err == nil { ebaiStorePageCookieWMSTOKEN2 = configs[0].Value } + if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieWMUSS", model.ConfigTypeCookie, ""); err == nil { + ebaiStorePageCookieWMUSS = configs[0].Value + } + if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieWMSTOKEN", model.ConfigTypeCookie, ""); err == nil { + ebaiStorePageCookieWMSTOKEN = configs[0].Value + } + if configs, err := dao.QueryConfigs(dao.GetDB(), "mtwmCookieStr", model.ConfigTypeCookie, ""); err == nil { + mtwmCookieStr = configs[0].Value + } api.EbaiAPI.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) + api.EbaiAPI.SetCookie("WMUSS", ebaiStorePageCookieWMUSS) + api.EbaiAPI.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN) api.Ebai2API.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) api.Ebai2API.SetCookie("WMUSS", ebaiStorePageCookieWMUSS2) api.Ebai2API.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN2) + api.MtwmAPI.SetCookieWithStr(mtwmCookieStr) } func syncStoreSku() { diff --git a/conf/app.conf b/conf/app.conf index 0789648e9..d0b1aa10a 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -15,7 +15,7 @@ dadaAppSecret = "7f97d8f258b70b450f04e7ab274ed8f8" mtwmAppID = "589" mtwmSecret = "a81eb3df418d83d6a1a4b7c572156d2f" mtwmCallbackURL = "http://callback.jxc4.com" -mtwmCookieStr = "_lxsdk_cuid=16ddced5e9a95-0a65869c427a14-48714616-15f900-16ddced5e9b2b; _hc.v=cfebbfd1-79a7-9823-d8df-77e59646cb34.1571369610; _lxsdk=16ddced5e9a95-0a65869c427a14-48714616-15f900-16ddced5e9b2b; uuid_update=true; uuid=7b28e71504f5414e382b.1579155871.1.0.0; device_uuid=!64dedf83-b510-4910-8a31-b2b13d0bdd73; pushToken=00kRvxlerO15kB0dJFWDwYuctAoe04xGMNd0r3BqvLUA*; acctId=57396785; brandId=-1; wmPoiId=-1; isOfflineSelfOpen=0; city_id=0; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=false; bsid=OyqgRLyV54i9JKP0zRCI9jPyXc4UBU-6KReDAkPIwSlljhb97JPyFUIXfYQvhlJb6G1erzHQKbvtZ2pSWOYDxQ; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; igateApp=shangouepc; wpush_server_url=wss://wpush.meituan.com; token=0MScAPaSa57iwRpgpCmGLf21tiA4yU4Uy-nDZlv8wNWs*; shopCategory=food; set_info=%7B%22wmPoiId%22%3A-1%2C%22ignoreSetRouterProxy%22%3Atrue%7D; JSESSIONID=105dgww27nsy6yfp68q7wmcni; LX_SC_CONSTANT=c_shangou_online_e_znrurnrc; _lxsdk_s=17041b590ac-3d-689-a8c%7C%7C15" +# mtwmCookieStr = "_lxsdk_cuid=16ddced5e9a95-0a65869c427a14-48714616-15f900-16ddced5e9b2b; _hc.v=cfebbfd1-79a7-9823-d8df-77e59646cb34.1571369610; _lxsdk=16ddced5e9a95-0a65869c427a14-48714616-15f900-16ddced5e9b2b; uuid_update=true; uuid=7b28e71504f5414e382b.1579155871.1.0.0; device_uuid=!64dedf83-b510-4910-8a31-b2b13d0bdd73; pushToken=00kRvxlerO15kB0dJFWDwYuctAoe04xGMNd0r3BqvLUA*; acctId=57396785; brandId=-1; wmPoiId=-1; isOfflineSelfOpen=0; city_id=0; isChain=1; existBrandPoi=true; ignore_set_router_proxy=true; region_id=; region_version=0; newCategory=false; bsid=OyqgRLyV54i9JKP0zRCI9jPyXc4UBU-6KReDAkPIwSlljhb97JPyFUIXfYQvhlJb6G1erzHQKbvtZ2pSWOYDxQ; cityId=510100; provinceId=510000; city_location_id=0; location_id=0; igateApp=shangouepc; wpush_server_url=wss://wpush.meituan.com; token=0MScAPaSa57iwRpgpCmGLf21tiA4yU4Uy-nDZlv8wNWs*; shopCategory=food; set_info=%7B%22wmPoiId%22%3A-1%2C%22ignoreSetRouterProxy%22%3Atrue%7D; JSESSIONID=105dgww27nsy6yfp68q7wmcni; LX_SC_CONSTANT=c_shangou_online_e_znrurnrc; _lxsdk_s=17041b590ac-3d-689-a8c%7C%7C15" autonaviKey = "ef64f638f31e05cb7bde28790f7309fe" diff --git a/globals/api/api.go b/globals/api/api.go index 8491bf881..c79da4934 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -111,9 +111,9 @@ func Init() { } if !beego.AppConfig.DefaultBool("disableMtwm", false) { MtwmAPI = mtwmapi.New(beego.AppConfig.String("mtwmAppID"), beego.AppConfig.String("mtwmSecret"), beego.AppConfig.String("mtwmCallbackURL")) - if mtwmCookieStr := beego.AppConfig.DefaultString("mtwmCookieStr", ""); mtwmCookieStr != "" { - MtwmAPI.SetCookieWithStr(mtwmCookieStr) - } + // if mtwmCookieStr := beego.AppConfig.DefaultString("mtwmCookieStr", ""); mtwmCookieStr != "" { + // MtwmAPI.SetCookieWithStr(mtwmCookieStr) + // } } else { MtwmAPI = nil }