1
This commit is contained in:
@@ -203,7 +203,7 @@ func CreateOrUpdateAll(vendorOrgCode string, storeID, vendorStoreID, deliveryFee
|
||||
//(2)电子围栏
|
||||
if len(bind[utils.Int64ToStr(storeID)][0].OutFenceIds) > 0 {
|
||||
tempFenceID := bind[utils.Int64ToStr(storeID)][0].OutFenceIds[0]
|
||||
if err1 := UpdateFenceByStore(vendorOrgCode, tempFenceID, int(vendorStoreID)); err1 != nil {
|
||||
if err1 := UpdateFenceByStore(vendorOrgCode, tempFenceID, utils.Int64ToStr(storeID)); err1 != nil {
|
||||
errList.AddErr(fmt.Errorf("平台门店(%d),门店(%d)更新电子围栏失败:%v", vendorStoreID, storeID, err1))
|
||||
}
|
||||
FreightTemplate.FenceID = bind[utils.Int64ToStr(storeID)][0].OutFenceIds[0] //保存一个就足够
|
||||
@@ -369,7 +369,7 @@ func (P *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
} else if len(bind[storeInfo.VendorStoreID][0].OutFenceIds) > 0 {
|
||||
//默认更新第一个电子围栏
|
||||
outFenceID := bind[storeInfo.VendorStoreID][0].OutFenceIds[0]
|
||||
if err = UpdateFenceByStore(storeInfo.VendorOrgCode, outFenceID, storeID); err != nil {
|
||||
if err = UpdateFenceByStore(storeInfo.VendorOrgCode, outFenceID, utils.Int2Str(storeID)); err != nil {
|
||||
errList.AddErr(errors.New(fmt.Sprintf("更新电子围栏失败,原因:%v", err)))
|
||||
}
|
||||
FreightTemplate.FenceID = outFenceID
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tiktok_store
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -172,19 +173,23 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
||||
}
|
||||
}
|
||||
|
||||
// 通过门店更新电子围栏
|
||||
func UpdateFenceByStore(appOrgCode, outFenceID string, storeID int) error {
|
||||
// 通过围栏id更新电子围栏
|
||||
func UpdateFenceByStore(appOrgCode, outFenceID, storeID string) error {
|
||||
var (
|
||||
db *dao.DaoDB
|
||||
localStore *LocalStore
|
||||
vertex []warehouse_setFence_request.VerticesItem
|
||||
param = &warehouse_setFence_request.WarehouseSetFenceParam{}
|
||||
)
|
||||
localID, err := dao.GetStoreDetail(db, utils.Str2Int(storeID), 0, "")
|
||||
if err != nil {
|
||||
return errors.New("获取门店id失败")
|
||||
}
|
||||
sqlParam := []interface{}{}
|
||||
sqlStr := `SELECT t.lng,t.lat,t.delivery_range_type,t.delivery_range FROM store t`
|
||||
if storeID != 0 {
|
||||
if localID.Store.ID != 0 {
|
||||
sqlStr += " WHERE t.id = ? "
|
||||
sqlParam = append(sqlParam, storeID)
|
||||
sqlParam = append(sqlParam, localID.Store.ID)
|
||||
} else {
|
||||
return fmt.Errorf("storeID必填")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user