绑定平台增加vendorstoreid 银豹
This commit is contained in:
@@ -1132,7 +1132,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
|
|||||||
} else if vendorID == model.VendorIDJX {
|
} else if vendorID == model.VendorIDJX {
|
||||||
ReCalculateJxPriceLight(db, ctx, storeID)
|
ReCalculateJxPriceLight(db, ctx, storeID)
|
||||||
} else if vendorID == model.VendorIDYB {
|
} else if vendorID == model.VendorIDYB {
|
||||||
err = checkAppIDAndAppKey(db, storeMap, storeID)
|
err = checkYbParams(db, storeMap, storeID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@@ -2877,10 +2877,11 @@ func DeletePrinterSeq(ctx *jxcontext.Context, storeIDs []int) (err error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkAppIDAndAppKey(db *dao.DaoDB, storeMap *model.StoreMap, storeID int) (err error) {
|
func checkYbParams(db *dao.DaoDB, storeMap *model.StoreMap, storeID int) (err error) {
|
||||||
var (
|
var (
|
||||||
appID = storeMap.YbAppID
|
appID = storeMap.YbAppID
|
||||||
appKey = storeMap.YbAppKey
|
appKey = storeMap.YbAppKey
|
||||||
|
yinbaoCookie string
|
||||||
)
|
)
|
||||||
if appID == "" {
|
if appID == "" {
|
||||||
return fmt.Errorf("绑定银豹平台必须输入appID!")
|
return fmt.Errorf("绑定银豹平台必须输入appID!")
|
||||||
@@ -2901,9 +2902,6 @@ func checkAppIDAndAppKey(db *dao.DaoDB, storeMap *model.StoreMap, storeID int) (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
storeMaps, err := dao.GetStoresMapList2(db, []int{model.VendorIDYB}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", false)
|
storeMaps, err := dao.GetStoresMapList2(db, []int{model.VendorIDYB}, nil, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", false)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
if len(storeMaps) > 0 {
|
if len(storeMaps) > 0 {
|
||||||
for _, v := range storeMaps {
|
for _, v := range storeMaps {
|
||||||
if v.YbAppID == appID {
|
if v.YbAppID == appID {
|
||||||
@@ -2914,5 +2912,22 @@ func checkAppIDAndAppKey(db *dao.DaoDB, storeMap *model.StoreMap, storeID int) (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stores, err := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, "")
|
||||||
|
if len(stores) > 0 {
|
||||||
|
if configs, err := dao.QueryConfigs(dao.GetDB(), "yinbaoCookie", model.ConfigTypeCookie, ""); err == nil {
|
||||||
|
yinbaoCookie = configs[0].Value
|
||||||
|
}
|
||||||
|
api.YinBaoAPI.SetCookie(".POSPALAUTH30220", yinbaoCookie)
|
||||||
|
result, err := api.YinBaoAPI.LoadSubStoresByUserIdDDLJson()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, v := range result {
|
||||||
|
if v.Company == stores[0].Name {
|
||||||
|
storeMap.VendorStoreID = utils.Int2Str(v.ID)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user