ddscope
This commit is contained in:
@@ -1475,6 +1475,7 @@ func GetStoreVendorMaps(ctx *jxcontext.Context, db *dao.DaoDB, storeID int, vend
|
||||
|
||||
// todo 需要对字段做有效性检查
|
||||
func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vendorOrgCode string, storeID int, storeMap *model.StoreMap) (outStoreMap *model.StoreMap, err error) {
|
||||
errList := errlist.ErrList{}
|
||||
if storeID == 0 {
|
||||
return nil, fmt.Errorf("storeID不能为0")
|
||||
}
|
||||
@@ -1522,9 +1523,8 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
|
||||
}
|
||||
if vendorID == model.VendorIDDD { //抖店绑定店铺时 检查并补充创建
|
||||
globals.SugarLogger.Debugf("vendorID ==============%d", vendorID)
|
||||
err2 := tiktok_store.CreateOrUpdateAll(vendorOrgCode, int64(storeMap.StoreID), utils.Str2Int64(storeMap.VendorStoreID))
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
if str, err2 := tiktok_store.CreateOrUpdateAll(vendorOrgCode, int64(storeMap.StoreID), utils.Str2Int64(storeMap.VendorStoreID)); err2 != nil {
|
||||
errList.AddErr(fmt.Errorf("wrongAns=%s,err=%v", str, err2))
|
||||
}
|
||||
}
|
||||
} else if vendorID == model.VendorIDJX {
|
||||
@@ -1594,7 +1594,7 @@ func AddStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, vendorID int, vend
|
||||
}
|
||||
_, err = CurVendorSync.SyncStore(ctx, db, storeMap.VendorID, storeID, false, userName)
|
||||
_, err = CurVendorSync.FullSyncStoresSkus(ctx, db, []int{vendorID}, []int{storeID}, true, nil, true, true)
|
||||
return outStoreMap, err
|
||||
return outStoreMap, errors.New(fmt.Sprintf("errList=%s,err=%v", utils.Format4Output(errList, true), err))
|
||||
}
|
||||
|
||||
func DeleteStoreVendorMap(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, userName string) (num int64, err error) {
|
||||
@@ -5871,14 +5871,15 @@ func GetDDScope(ctx *jxcontext.Context, storeID int, vendorStoreID string) (ware
|
||||
return data, errors.New("storeID,vendorStoreID 必填")
|
||||
}
|
||||
storeMap, err := GetVendorOrgCode(ctx, dao.GetDB(), storeID, model.VendorIDDD, vendorStoreID)
|
||||
|
||||
if err != nil {
|
||||
return data, errors.New(fmt.Sprintf("获取vendorOrgCode失败,请检查数据或重试:%v", err))
|
||||
}
|
||||
bindWarehouse, err := tiktok_store.GetWarehouseByStore(storeMap.VendorOrgCode, int64(storeID))
|
||||
bindWarehouse, err := tiktok_store.GetWarehouseByStore(storeMap[0].VendorOrgCode, int64(storeID))
|
||||
if err != nil {
|
||||
return data, errors.New(fmt.Sprintf("获取门店(%d) 绑定fenceID失败:%v", storeID, err))
|
||||
}
|
||||
resp, err := tiktok_store.GetFence(storeMap.VendorOrgCode, bindWarehouse[0][utils.Str2Int(vendorStoreID)].OutFenceIds[0])
|
||||
resp, err := tiktok_store.GetFence(storeMap[0].VendorOrgCode, bindWarehouse[0][utils.Str2Int(vendorStoreID)].OutFenceIds[0])
|
||||
if err != nil {
|
||||
return data, err
|
||||
}
|
||||
@@ -5886,7 +5887,7 @@ func GetDDScope(ctx *jxcontext.Context, storeID int, vendorStoreID string) (ware
|
||||
}
|
||||
|
||||
//获取 VendorOrgCode
|
||||
func GetVendorOrgCode(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, vendorStoreID string) (storeMap *model.StoreMap, err error) {
|
||||
func GetVendorOrgCode(ctx *jxcontext.Context, db *dao.DaoDB, storeID, vendorID int, vendorStoreID string) (storeMap []*model.StoreMap, err error) {
|
||||
cond := map[string]interface{}{
|
||||
model.FieldStoreID: storeID,
|
||||
model.FieldVendorStoreID: vendorStoreID,
|
||||
|
||||
Reference in New Issue
Block a user