- set ebai delivery_region when there is non nil value.
This commit is contained in:
@@ -280,11 +280,12 @@ func EbaiDeliveryRegion2Jx(deliveryRegion interface{}) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func JxDeliveryRegion2Ebai(store *model.Store) interface{} {
|
||||
func JxDeliveryRegion2Ebai(store *model.Store) (deliveryRegion interface{}) {
|
||||
rangeStr := strings.Trim(store.DeliveryRange, ";")
|
||||
if store.DeliveryRangeType == model.DeliveryRangeTypeRadius {
|
||||
rangeStr = jxutils.GetPolygonFromCircleStr(jxutils.IntCoordinate2Standard(store.Lng), jxutils.IntCoordinate2Standard(store.Lat), utils.Str2Float64(store.DeliveryRange), 8)
|
||||
}
|
||||
if rangeStr != "" {
|
||||
pointPairs := strings.Split(rangeStr, ";")
|
||||
region := make([]map[string]interface{}, 0)
|
||||
for _, v := range pointPairs {
|
||||
@@ -296,7 +297,7 @@ func JxDeliveryRegion2Ebai(store *model.Store) interface{} {
|
||||
})
|
||||
}
|
||||
}
|
||||
deliveryRegion := []interface{}{
|
||||
deliveryRegion = []interface{}{
|
||||
map[string]interface{}{
|
||||
"name": "主要配送区",
|
||||
"delivery_fee": 600,
|
||||
@@ -308,6 +309,7 @@ func JxDeliveryRegion2Ebai(store *model.Store) interface{} {
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
return deliveryRegion
|
||||
}
|
||||
|
||||
@@ -334,9 +336,11 @@ func genStoreMapFromStore(store *tEbaiStoreInfo) map[string]interface{} {
|
||||
"latitude": jxutils.IntCoordinate2Standard(store.Lat),
|
||||
"address": store.Address,
|
||||
"coord_type": ebaiapi.CoordTypeAutonavi, // 一直用高德
|
||||
"delivery_region": JxDeliveryRegion2Ebai(&store.Store),
|
||||
"business_time": JxBusinessTime2Ebai(&store.Store),
|
||||
}
|
||||
if deliveryRegion := JxDeliveryRegion2Ebai(&store.Store); deliveryRegion != nil {
|
||||
params["delivery_region"] = deliveryRegion
|
||||
}
|
||||
if store.VendorStoreID != "" {
|
||||
params["baidu_shop_id"] = store.VendorStoreID
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user