Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -175,15 +175,15 @@ func CreateOrUpdateAll(vendorOrgCode string, storeID, vendorStoreID, deliveryFee
|
|||||||
//if len(bindWarehouseAndFence) == 0 || utils.IsNil(bindWarehouseAndFence) { //未绑定仓库以及电子围栏
|
//if len(bindWarehouseAndFence) == 0 || utils.IsNil(bindWarehouseAndFence) { //未绑定仓库以及电子围栏
|
||||||
//(1)创建仓库
|
//(1)创建仓库
|
||||||
warehouseID, err := CreateWarehouse(vendorOrgCode, storeID)
|
warehouseID, err := CreateWarehouse(vendorOrgCode, storeID)
|
||||||
if err != nil || warehouseID == 0 || utils.IsNil(warehouseID) {
|
if err != nil || len(warehouseID) == 0 || utils.IsNil(warehouseID) {
|
||||||
globals.SugarLogger.Debugf("门店(%d) 创建仓库失败:%v", storeID, err)
|
globals.SugarLogger.Debugf("门店(%d) 创建仓库失败:%v", storeID, err)
|
||||||
errList.AddErr(fmt.Errorf("门店(%d) 创建仓库失败:%v", storeID, err))
|
errList.AddErr(fmt.Errorf("门店(%d) 创建仓库失败:%v", storeID, err))
|
||||||
} else { //绑定
|
} else { //绑定
|
||||||
if err = BindStoreWarehouse(vendorOrgCode, utils.Int64ToStr(storeID), vendorStoreID); err != nil { //仓库绑定通过自定义外部ID
|
if err = BindStoreWarehouse(vendorOrgCode, utils.Int64ToStr(storeID), vendorStoreID); err != nil { //仓库绑定通过自定义外部ID
|
||||||
globals.SugarLogger.Debugf("门店(%d) 绑定仓库:%d 失败:%v", storeID, warehouseID, err)
|
globals.SugarLogger.Debugf("门店(%d) 绑定仓库:%s 失败:%v", storeID, warehouseID, err)
|
||||||
errList.AddErr(fmt.Errorf("门店(%d) 绑定仓库:%d 失败:%v", storeID, warehouseID, err))
|
errList.AddErr(fmt.Errorf("门店(%d) 绑定仓库:%s 失败:%v", storeID, warehouseID, err))
|
||||||
} else {
|
} else {
|
||||||
FreightTemplate.WarehouseID = warehouseID
|
FreightTemplate.WarehouseID = utils.Str2Int64(warehouseID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//(2)创建电子围栏
|
//(2)创建电子围栏
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// /warehouse/create 创建单个区域仓
|
// /warehouse/create 创建单个区域仓
|
||||||
func CreateWarehouse(appOrgCode string, storeID int64) (warehouseID int64, err error) {
|
func CreateWarehouse(appOrgCode string, storeID int64) (warehouseID string, err error) {
|
||||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), int(storeID), 0, "")
|
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), int(storeID), 0, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("获取门店本地信息失败:%v", err)
|
return "", fmt.Errorf("获取门店本地信息失败:%v", err)
|
||||||
}
|
}
|
||||||
param := &warehouse_create_request.WarehouseCreateParam{
|
param := &warehouse_create_request.WarehouseCreateParam{
|
||||||
OutWarehouseId: utils.Int64ToStr(storeID), //本地storeID绑定
|
OutWarehouseId: utils.Int64ToStr(storeID), //本地storeID绑定
|
||||||
@@ -49,9 +49,9 @@ func CreateWarehouse(appOrgCode string, storeID int64) (warehouseID int64, err e
|
|||||||
}
|
}
|
||||||
resp, err := getAPI(appOrgCode, 0, "").CreateWarehouse(param)
|
resp, err := getAPI(appOrgCode, 0, "").CreateWarehouse(param)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("创建单个区域仓失败:%v", err)
|
return "", fmt.Errorf("创建单个区域仓失败:%v", err)
|
||||||
}
|
}
|
||||||
return resp.Data, nil
|
return resp.WarehouseId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// /warehouse/createBatch 批量创建区域仓
|
// /warehouse/createBatch 批量创建区域仓
|
||||||
@@ -146,7 +146,7 @@ func CreateFenceByStore(appOrgCode string, storeID int64) (fenceID string, err e
|
|||||||
tempStr := strings.Split(localStore.DeliveryRange, ";")
|
tempStr := strings.Split(localStore.DeliveryRange, ";")
|
||||||
for v := len(tempStr) - 1; v >= 0; v-- {
|
for v := len(tempStr) - 1; v >= 0; v-- {
|
||||||
s2 := strings.Split(tempStr[v], ",")
|
s2 := strings.Split(tempStr[v], ",")
|
||||||
globals.SugarLogger.Debugf("len==%d\n,2[0]==%s\n", len(s2), s2[0])
|
globals.SugarLogger.Debugf("len==%d\n,s2[0]==%s\n,s2==%s", len(s2), s2[0], s2)
|
||||||
tLng, err1 := strconv.ParseFloat(s2[0], 64)
|
tLng, err1 := strconv.ParseFloat(s2[0], 64)
|
||||||
tLat, err2 := strconv.ParseFloat(s2[1], 64)
|
tLat, err2 := strconv.ParseFloat(s2[1], 64)
|
||||||
if err1 != nil || err2 != nil {
|
if err1 != nil || err2 != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user