batch fence

This commit is contained in:
richboo111
2022-12-12 17:50:08 +08:00
parent 990014fa27
commit 5e34dc009c

View File

@@ -6034,27 +6034,20 @@ func AssistCreateFence(relInfo map[string][]tiktok_store.RelInfo) (string, error
globals.SugarLogger.Debugf("京西平台没有配送范围的门店ID=%s", endStr)
}
if bindFence, err := tiktok_store.GetWarehouseByStore(k, utils.Str2Int64(i.VendorStoreID)); err == nil && (len(bindFence) > 0 && len(bindFence[i.VendorStoreID][0].OutFenceIds) > 0) {
globals.SugarLogger.Debugf("i.VendorStoreID==========%s,i.StoreID==============%s", i.VendorStoreID, i.StoreID)
tempFenceID = bindFence[i.VendorStoreID][0].OutFenceIds[0]
globals.SugarLogger.Debugf("tempFenceID================%s", tempFenceID)
if err1 := tiktok_store.UpdateFenceByStore(k, tempFenceID, utils.Str2Int(i.VendorStoreID)); err1 != nil {
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s)更新电子围栏失败:%v", i.VendorStoreID, i.StoreID, err1))
}
} else {
if _, err := tiktok_store.CreateFenceByStore(k, tempStoreID); err != nil {
if fenceID, err := tiktok_store.CreateFenceByStore(k, tempStoreID); err != nil {
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s)创建电子围栏失败:%v", i.VendorStoreID, i.StoreID, err))
} else if len(fenceID) > 0 {
if err := tiktok_store.BindFenceByStore(k, tempVendorStoreID, []string{i.StoreID}); err != nil {
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s)绑定电子围栏失败:%v", i.VendorStoreID, i.StoreID, err))
}
}
//else if len(fenceID) > 0 {
// if err := tiktok_store.BindFenceByStore(k, tempVendorStoreID, []string{fenceID}); err != nil {
// errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s)绑定电子围栏失败:%v", i.VendorStoreID, i.StoreID, err))
// }
//}
}
if err := tiktok_store.BindFenceByStore(k, tempVendorStoreID, []string{i.StoreID}); err != nil {
errList.AddErr(fmt.Errorf("平台门店(%s),门店(%s)绑定电子围栏失败:%v", i.VendorStoreID, i.StoreID, err))
}
}
if err := dao.CreateEntity(db, FreightTemplate); err != nil {
if _, err1 := dao.UpdateEntity(db, FreightTemplate, "FenceID"); err1 != nil {
globals.SugarLogger.Debugf("db update storeID,vendorStoreID defeat on :%v", err1)