1
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -4,6 +4,7 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -311,9 +312,31 @@ func TestShopAptitudeUpload(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShopDeliveryinfoGet(t *testing.T) {
|
||||
result, err := api.ShopDeliveryinfoGet("", 2233065959)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
vendorStoreID := "1128314567"
|
||||
store, err := api.ShopGet2("", utils.Str2Int64(vendorStoreID))
|
||||
globals.SugarLogger.Debugf("-:=%s", utils.Format4Output(store, false))
|
||||
globals.SugarLogger.Debugf("-:=%v", err)
|
||||
|
||||
list, err := api.ShopDeliveryinfoGet("", utils.Str2Int64(vendorStoreID))
|
||||
if err == nil && len(list) > 0 {
|
||||
deliveryRange := EbaiDeliveryRegion2Jx2(list[0])
|
||||
globals.SugarLogger.Debugf("-:=%s", deliveryRange)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
|
||||
}
|
||||
|
||||
func EbaiDeliveryRegion2Jx2(deliveryRegion map[string]interface{}) string {
|
||||
if len(deliveryRegion) > 0 {
|
||||
if deliveryRegion["delivery_areas"] == nil {
|
||||
return ""
|
||||
}
|
||||
region := deliveryRegion["delivery_areas"].([]interface{})[0].(map[string]interface{})["coordinates"].([]interface{})
|
||||
coords := make([]string, len(region))
|
||||
for k, v := range region {
|
||||
mapV := v.(map[string]interface{})
|
||||
coords[k] = fmt.Sprintf("%.6f,%.6f", utils.MustInterface2Float64(mapV["longitude"]), utils.MustInterface2Float64(mapV["latitude"]))
|
||||
}
|
||||
return strings.Join(coords, ";")
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user