- remove JdRange2JxRange and JxRange2JdRange

This commit is contained in:
gazebo
2018-09-21 09:36:36 +08:00
parent b58530ecd2
commit 49a2d30f0e
2 changed files with 29 additions and 32 deletions

View File

@@ -1,9 +1,6 @@
package jd
import (
"fmt"
"strings"
"git.rosy.net.cn/jx-callback/business/jxcallback/scheduler"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/model/dao"
@@ -67,7 +64,7 @@ func (p *PurchaseHandler) ReadStore(vendorStoreID string) (*model.Store, error)
if err = err2; err == nil {
retVal.DeliveryRangeType = int8(utils.MustInterface2Int64(result["deliveryRangeType"]))
if retVal.DeliveryRangeType == model.DeliveryRangeTypePolygon {
retVal.DeliveryRange = JdRange2JxRange(utils.Interface2String(result["deliveryRange"]))
retVal.DeliveryRange = utils.Interface2String(result["deliveryRange"])
} else {
retVal.DeliveryRange = utils.Int64ToStr(utils.MustInterface2Int64(result["deliveryRangeRadius"]))
}
@@ -111,7 +108,7 @@ func (p *PurchaseHandler) UpdateStore(storeID int, userName string) (err error)
"county": store.JdDistrictCode,
}
if store.DeliveryRangeType == model.DeliveryRangeTypePolygon {
params["coordinatePoints"] = JxRange2JdRange(store.DeliveryRange)
params["coordinatePoints"] = store.DeliveryRange
} else {
params["deliveryRangeRadius"] = utils.Str2Int64(store.DeliveryRange)
}
@@ -182,33 +179,33 @@ func (p *PurchaseHandler) GetAllStoresFromRemote() ([]*model.Store, error) {
return nil, err
}
func JdRange2JxRange(jdRanges string) (jxRanges string) {
coords := strings.Split(jdRanges, ";")
intCoords := []string{}
for _, coord := range coords {
items := strings.Split(coord, ",")
if len(items) == 2 {
lng := jxutils.StandardCoordinate2Int(utils.Str2Float64(items[0]))
lat := jxutils.StandardCoordinate2Int(utils.Str2Float64(items[1]))
intCoords = append(intCoords, fmt.Sprintf("%d,%d", lng, lat))
}
}
return strings.Join(intCoords, ";")
}
// func JdRange2JxRange(jdRanges string) (jxRanges string) {
// coords := strings.Split(jdRanges, ";")
// intCoords := []string{}
// for _, coord := range coords {
// items := strings.Split(coord, ",")
// if len(items) == 2 {
// lng := jxutils.StandardCoordinate2Int(utils.Str2Float64(items[0]))
// lat := jxutils.StandardCoordinate2Int(utils.Str2Float64(items[1]))
// intCoords = append(intCoords, fmt.Sprintf("%d,%d", lng, lat))
// }
// }
// return strings.Join(intCoords, ";")
// }
func JxRange2JdRange(jxRanges string) (jdRanges string) {
coords := strings.Split(jxRanges, ";")
intCoords := []string{}
for _, coord := range coords {
items := strings.Split(coord, ",")
if len(items) == 2 {
lng := jxutils.IntCoordinate2Standard(int(utils.Str2Int64(items[0])))
lat := jxutils.IntCoordinate2Standard(int(utils.Str2Int64(items[1])))
intCoords = append(intCoords, fmt.Sprintf("%f,%f", lng, lat))
}
}
return strings.Join(intCoords, ";")
}
// func JxRange2JdRange(jxRanges string) (jdRanges string) {
// coords := strings.Split(jxRanges, ";")
// intCoords := []string{}
// for _, coord := range coords {
// items := strings.Split(coord, ",")
// if len(items) == 2 {
// lng := jxutils.IntCoordinate2Standard(int(utils.Str2Int64(items[0])))
// lat := jxutils.IntCoordinate2Standard(int(utils.Str2Int64(items[1])))
// intCoords = append(intCoords, fmt.Sprintf("%f,%f", lng, lat))
// }
// }
// return strings.Join(intCoords, ";")
// }
func JdDeliveryType2Jx(deliveryType int) int8 {
if deliveryType == 2938 {

View File

@@ -11,7 +11,7 @@ import (
)
// 京东到家,以有库存表示关注(认领)
func (p *PurchaseHandler) SyncStoreSku(storeID int, skuIDs []int, isForce bool, userName string) (err error) {
func (p *PurchaseHandler) SyncStoreSkus(storeID int, skuIDs []int, isForce bool, userName string) (err error) {
db := dao.GetDB()
var storeSkus []*model.StoreSkuBind
sqlParams := []interface{}{