银豹cookie
This commit is contained in:
@@ -167,11 +167,7 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrg
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetStoreAllCategories(ctx *jxcontext.Context, storeID int, vendorStoreID string) (cats []*partner.BareCategoryInfo, err error) {
|
||||
vendorOrgCode, err := getVendorOrgCode(storeID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
remoteCats, err := api.YinBaoAPI.LoadCategorysWithOption(vendorOrgCode)
|
||||
remoteCats, err := api.YinBaoAPI.LoadCategorysWithOption(vendorStoreID)
|
||||
if err == nil {
|
||||
cats = convertVendorCatList(remoteCats)
|
||||
}
|
||||
@@ -181,17 +177,13 @@ 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 {
|
||||
buildYbApiCookie(ctx)
|
||||
vendorOrgCode, err := getVendorOrgCode(storeID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var (
|
||||
catName = utils.FilterEmoji(storeCat.Name)
|
||||
parentCatName = utils.FilterEmoji(storeCat.ParentCatName)
|
||||
)
|
||||
fmt.Println("test1111111111111111111111", api.YinBaoAPI.GetCookie(".POSPALAUTH30220"))
|
||||
fmt.Println("test22222222222222222222", api.YinBaoAPI.GetCookie("pageOpenCount"))
|
||||
vendorCatID, err := api.YinBaoAPI.AddNewCategory(vendorOrgCode, catName, parentCatName)
|
||||
vendorCatID, err := api.YinBaoAPI.AddNewCategory(vendorStoreID, catName, parentCatName)
|
||||
if err == nil {
|
||||
storeCat.VendorCatID = vendorCatID
|
||||
}
|
||||
@@ -216,15 +208,11 @@ func buildYbApiCookie(ctx *jxcontext.Context) {
|
||||
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
|
||||
}
|
||||
var (
|
||||
catName = utils.FilterEmoji(storeCat.Name)
|
||||
parentCatName = utils.FilterEmoji(storeCat.ParentCatName)
|
||||
)
|
||||
err = api.YinBaoAPI.UpdateCategory(vendorOrgCode, storeCat.VendorCatID, catName, parentCatName)
|
||||
err = api.YinBaoAPI.UpdateCategory(vendorStoreID, storeCat.VendorCatID, catName, parentCatName)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -232,11 +220,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
|
||||
}
|
||||
err = api.YinBaoAPI.DeleteCategory(vendorOrgCode, []string{vendorCatID})
|
||||
err = api.YinBaoAPI.DeleteCategory(vendorStoreID, []string{vendorCatID})
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -369,17 +353,6 @@ func buildYbConfigs(storeID int) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func getVendorOrgCode(storeID int) (vendorOrgCode string, err error) {
|
||||
if storeID == 0 {
|
||||
return "", fmt.Errorf("门店ID不能为空!平台:[%v]", model.VendorIDYB)
|
||||
}
|
||||
store, err := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDYB)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return store.VendorOrgCode, err
|
||||
}
|
||||
|
||||
func convertVendorCatList(remoteCats []*yinbaoapi.LoadCategorysWithOptionResult) (cats []*partner.BareCategoryInfo) {
|
||||
for _, rCat := range remoteCats {
|
||||
cat := &partner.BareCategoryInfo{
|
||||
|
||||
Reference in New Issue
Block a user