银豹cookie

This commit is contained in:
苏尹岚
2020-03-26 16:56:48 +08:00
parent d81fce30af
commit b6ee19a92f
2 changed files with 19 additions and 7 deletions

View File

@@ -248,9 +248,7 @@ func Init() {
if configs, err := dao.QueryConfigs(dao.GetDB(), "jd2StorePageCookie", model.ConfigTypeCookie, ""); err == nil {
jd2StorePageCookie = configs[0].Value
}
if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil {
yinbaoCookie = configs[0].Value
}
if globals.Jd2OrgCode != "" {
api.Jd2API.SetJdCookie(jd2StorePageCookie)
}
@@ -265,7 +263,6 @@ func Init() {
api.JdAPI.SetJdCookie(JdStorePageCookie)
api.JdPageAPI.SetCookie(jdapi.AccessStorePageCookieName, JdStorePageCookie)
api.JdPageAPI.SetCookie(jdapi.AccessStorePageCookieName2, JdStorePageCookie)
api.YinBaoAPI.SetCookie(".POSPALAUTH30220", yinbaoCookie)
}
func syncStoreSku() {

View File

@@ -4,6 +4,8 @@ import (
"fmt"
"regexp"
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
"git.rosy.net.cn/baseapi/platformapi/yinbaoapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
@@ -178,9 +180,7 @@ func (p *PurchaseHandler) GetStoreAllCategories(ctx *jxcontext.Context, storeID
func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
if globals.EnableYbStoreWrite {
api.YinBaoAPI.SetCookie("pageOpenCount", utils.Int2Str(api.YinBaoAPI.GetPageCount()))
fmt.Println("test11111111111111111111111111111111111111", api.YinBaoAPI.GetPageCount())
fmt.Println("test11111111111111111111111111111111111111", api.YinBaoAPI.GetCookie(".POSPALAUTH30220"))
buildYbApiCookie(ctx)
vendorOrgCode, err := getVendorOrgCode(storeID)
if err != nil {
return err
@@ -198,8 +198,22 @@ func (p *PurchaseHandler) CreateStoreCategory(ctx *jxcontext.Context, storeID in
return err
}
func buildYbApiCookie(ctx *jxcontext.Context) {
yinbaoCookiePageCount := ""
if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil {
yinbaoCookie := configs[0].Value
api.YinBaoAPI.SetCookie(".POSPALAUTH30220", yinbaoCookie)
if configs2, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookiePageCount", model.ConfigTypeCookie, ""); err == nil {
yinbaoCookiePageCount = configs2[0].Value
api.YinBaoAPI.SetCookie("pageOpenCount", yinbaoCookiePageCount)
}
}
cms.UpdateConfig(ctx, "yinbaoCookiePageCount", "Cookie", utils.Int64ToStr(utils.Str2Int64(yinbaoCookiePageCount)+1))
}
func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeCat *dao.SkuStoreCatInfo) (err error) {
if globals.EnableYbStoreWrite {
buildYbApiCookie(ctx)
vendorOrgCode, err := getVendorOrgCode(storeID)
if err != nil {
return err
@@ -215,6 +229,7 @@ func (p *PurchaseHandler) UpdateStoreCategory(ctx *jxcontext.Context, storeID in
func (p *PurchaseHandler) DeleteStoreCategory(ctx *jxcontext.Context, storeID int, vendorStoreID, vendorCatID string, level int) (err error) {
if globals.EnableYbStoreWrite {
buildYbApiCookie(ctx)
vendorOrgCode, err := getVendorOrgCode(storeID)
if err != nil {
return err