Cookie加入到数据库中

This commit is contained in:
苏尹岚
2020-03-02 14:44:35 +08:00
parent a6f264d6b6
commit 7b66a66f3e
3 changed files with 28 additions and 16 deletions

View File

@@ -108,7 +108,9 @@ var (
cancelPayTimeOutOrderList = localjx.GetHalfHoursList() cancelPayTimeOutOrderList = localjx.GetHalfHoursList()
ebaiStorePageCookieExdTOKEN string ebaiStorePageCookieExdTOKEN string
ebaiStorePageCookieWMUSS2 string
ebaiStorePageCookieWMSTOKEN2 string
) )
func GetImportantTaskID(taskName string) string { func GetImportantTaskID(taskName string) string {
@@ -206,8 +208,16 @@ func Init() {
if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieExdTOKEN", model.ConfigTypeSys, ""); err == nil { if configs, err := dao.QueryConfigs(dao.GetDB(), "ebaiStorePageCookieExdTOKEN", model.ConfigTypeSys, ""); err == nil {
ebaiStorePageCookieExdTOKEN = configs[0].Value 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.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() { func syncStoreSku() {

View File

@@ -7,6 +7,7 @@ const (
ConfigTypeBank = "Bank" ConfigTypeBank = "Bank"
ConfigTypeRole = "Role" ConfigTypeRole = "Role"
ConfigTypeJxStore = "JxStore" ConfigTypeJxStore = "JxStore"
ConfigTypeCookie = "Cookie"
) )
const ( const (
@@ -24,6 +25,7 @@ var (
ConfigTypeBank: "银行", ConfigTypeBank: "银行",
ConfigTypeRole: "角色", ConfigTypeRole: "角色",
ConfigTypeJxStore: "京西商城", ConfigTypeJxStore: "京西商城",
ConfigTypeCookie: "Cookie",
} }
) )

View File

@@ -127,22 +127,22 @@ func Init() {
} }
if !beego.AppConfig.DefaultBool("disableEbai", false) { if !beego.AppConfig.DefaultBool("disableEbai", false) {
EbaiAPI = ebaiapi.New(beego.AppConfig.String("ebaiSource"), beego.AppConfig.String("ebaiSecret")) EbaiAPI = ebaiapi.New(beego.AppConfig.String("ebaiSource"), beego.AppConfig.String("ebaiSecret"))
ebaiStorePageCookieWMUSS := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS", "") // ebaiStorePageCookieWMUSS := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS", "")
ebaiStorePageCookieWMSTOKEN := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN", "") // ebaiStorePageCookieWMSTOKEN := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN", "")
// ebaiStorePageCookieExdTOKEN := beego.AppConfig.DefaultString("ebaiStorePageCookieExdTOKEN", "") // ebaiStorePageCookieExdTOKEN := beego.AppConfig.DefaultString("ebaiStorePageCookieExdTOKEN", "")
if ebaiStorePageCookieWMUSS != "" && ebaiStorePageCookieWMSTOKEN != "" { //&& ebaiStorePageCookieExdTOKEN != "" { // if ebaiStorePageCookieWMUSS != "" && ebaiStorePageCookieWMSTOKEN != "" { //&& ebaiStorePageCookieExdTOKEN != "" {
EbaiAPI.SetCookie("WMUSS", ebaiStorePageCookieWMUSS) // EbaiAPI.SetCookie("WMUSS", ebaiStorePageCookieWMUSS)
EbaiAPI.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN) // EbaiAPI.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN)
// EbaiAPI.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) // EbaiAPI.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN)
} // }
Ebai2API = ebaiapi.New(beego.AppConfig.String("ebaiSource"), beego.AppConfig.String("ebaiSecret")) Ebai2API = ebaiapi.New(beego.AppConfig.String("ebaiSource"), beego.AppConfig.String("ebaiSecret"))
ebaiStorePageCookieWMUSS2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS2", "") // ebaiStorePageCookieWMUSS2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMUSS2", "")
ebaiStorePageCookieWMSTOKEN2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN2", "") // ebaiStorePageCookieWMSTOKEN2 := beego.AppConfig.DefaultString("ebaiStorePageCookieWMSTOKEN2", "")
if ebaiStorePageCookieWMUSS2 != "" && ebaiStorePageCookieWMSTOKEN2 != "" { //&& ebaiStorePageCookieExdTOKEN != "" { // if ebaiStorePageCookieWMUSS2 != "" && ebaiStorePageCookieWMSTOKEN2 != "" { //&& ebaiStorePageCookieExdTOKEN != "" {
Ebai2API.SetCookie("WMUSS", ebaiStorePageCookieWMUSS2) // Ebai2API.SetCookie("WMUSS", ebaiStorePageCookieWMUSS2)
Ebai2API.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN2) // Ebai2API.SetCookie("WMSTOKEN", ebaiStorePageCookieWMSTOKEN2)
// Ebai2API.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN) // Ebai2API.SetCookie("PASSPORT_DELIMONT_TOKEN", ebaiStorePageCookieExdTOKEN)
} // }
} else { } else {
EbaiAPI = nil EbaiAPI = nil
Ebai2API = nil Ebai2API = nil