This commit is contained in:
邹宗楠
2025-02-07 11:17:12 +08:00
parent eaaf58cb23
commit 5ba7ff7938
11 changed files with 205 additions and 65 deletions

File diff suppressed because one or more lines are too long

View File

@@ -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 ""
}