From 29523503d8cc9b0aa8809d35d9bc092424927b3e Mon Sep 17 00:00:00 2001 From: richboo111 Date: Mon, 14 Aug 2023 10:31:17 +0800 Subject: [PATCH] 1 --- platformapi/tao_vegetable/store.go | 18 +++++++++++------- platformapi/tao_vegetable/store_test.go | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/platformapi/tao_vegetable/store.go b/platformapi/tao_vegetable/store.go index e79744f6..fa36cd9c 100644 --- a/platformapi/tao_vegetable/store.go +++ b/platformapi/tao_vegetable/store.go @@ -44,20 +44,24 @@ func (a *API) ShopUpdateStatus(storeID string, status int64) error { // ShopUpdateRange 更新渠道店销售范围 func (a *API) ShopUpdateRange(storeID string, points []Points) error { var ( - store = ability3156.NewAbility3156(&a.client) - tPoint []domain.AlibabaAelophyShopUpdaterangePoint + store = ability3156.NewAbility3156(&a.client) + tPoints []domain.AlibabaAelophyShopUpdaterangePoint + //tPoint domain.AlibabaAelophyShopUpdaterangePoint ) for _, v := range points { - tPoint = append(tPoint, domain.AlibabaAelophyShopUpdaterangePoint{ - Lat: &v.Lat, - Lng: &v.Lng, - }) + tLat := v.Lat + tLng := v.Lng + tPoint := domain.AlibabaAelophyShopUpdaterangePoint{ + Lat: &tLat, + Lng: &tLng, + } + tPoints = append(tPoints, tPoint) } resp, err := store.AlibabaAelophyShopUpdaterange(&request.AlibabaAelophyShopUpdaterangeRequest{ShopRangeUpdateRequest: &domain.AlibabaAelophyShopUpdaterangeShopRangeUpdateRequest{ StoreId: &storeID, ShopRanges: &[]domain.AlibabaAelophyShopUpdaterangeShopRange{ { - Points: &tPoint, + Points: &tPoints, }, }, ChannelSourceType: &chanType, diff --git a/platformapi/tao_vegetable/store_test.go b/platformapi/tao_vegetable/store_test.go index e494146a..cb4f02f6 100644 --- a/platformapi/tao_vegetable/store_test.go +++ b/platformapi/tao_vegetable/store_test.go @@ -109,7 +109,7 @@ func TestShopUpdateInfo(t *testing.T) { } func TestShopUpdateRange(t *testing.T) { - str := "116.508455,39.97171144419017;116.51455900796353,39.97130202157785;116.52047754873387,39.970086193839784;116.52603079044462,39.968100903286555;116.5310500006565,39.96540647196702;116.53538267320705,39.96208476881338;116.53889716203328,39.95823672209508;116.54148668117058,39.95397925276447;116.54307254939037,39.94944172187276;116.54360658088925,39.944762;116.54307254939037,39.940082278127235;116.54148668117058,39.935544747235525;116.53889716203328,39.931287277904914;116.53538267320705,39.92743923118662;116.5310500006565,39.92411752803297;116.52603079044462,39.92142309671344;116.52047754873387,39.91943780616021;116.51455900796353,39.918221978422146;116.508455,39.917812555809824;116.50235099203647,39.918221978422146;116.49643245126613,39.91943780616021;116.49087920955537,39.92142309671344;116.48585999934349,39.92411752803297;116.48152732679294,39.92743923118662;116.47801283796672,39.931287277904914;116.47542331882941,39.935544747235525;116.47383745060962,39.940082278127235;116.47330341911075,39.944762;116.47383745060962,39.94944172187276;116.47542331882941,39.95397925276447;116.47801283796672,39.95823672209508;116.48152732679294,39.96208476881338;116.48585999934349,39.96540647196702;116.49087920955537,39.968100903286555;116.49643245126613,39.970086193839784;116.50235099203647,39.97130202157785" + str := "116.270974,39.95063475899651;116.27727945007786,39.950211688963776;116.28339331224582,39.948955333634444;116.28912981989568,39.94690386672944;116.29431467214528,39.94411962103259;116.2987903298827,39.94068719444049;116.30242080251239,39.93671087949826;116.30509577996057,39.93231149452328;116.30673398439112,39.92762271260185;116.30728563979136,39.922787;116.30673398439112,39.91795128739815;116.30509577996057,39.913262505476716;116.30242080251239,39.90886312050174;116.2987903298827,39.90488680555951;116.29431467214528,39.90145437896741;116.28912981989568,39.89867013327056;116.28339331224582,39.896618666365555;116.27727945007786,39.89536231103622;116.270974,39.89493924100349;116.26466854992213,39.89536231103622;116.25855468775417,39.896618666365555;116.25281818010431,39.89867013327056;116.24763332785471,39.90145437896741;116.24315767011728,39.90488680555951;116.2395271974876,39.90886312050174;116.23685222003942,39.913262505476716;116.23521401560888,39.91795128739815;116.23466236020863,39.922787;116.23521401560888,39.92762271260185;116.23685222003942,39.93231149452328;116.2395271974876,39.93671087949826;116.24315767011728,39.94068719444049;116.24763332785471,39.94411962103259;116.25281818010431,39.94690386672944;116.25855468775417,39.948955333634444;116.26466854992213,39.950211688963776" temp := strings.Split(str, ";") points := make([]Points, 0) for _, v := range temp { @@ -120,7 +120,7 @@ func TestShopUpdateRange(t *testing.T) { } points = append(points, point) } - err := apiTao.ShopUpdateRange("JX668998", points) + err := apiTao.ShopUpdateRange("JX667321", points) fmt.Println(err) }