From 3c53d5426fda23d4bcf1ff98fee8d8d3ff72657d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Fri, 27 Oct 2023 18:32:43 +0800 Subject: [PATCH] 1 --- business/jxstore/cms/cms.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/business/jxstore/cms/cms.go b/business/jxstore/cms/cms.go index b50931c56..45560ab16 100644 --- a/business/jxstore/cms/cms.go +++ b/business/jxstore/cms/cms.go @@ -738,12 +738,13 @@ func GetCyclingLine(sLng, sLat, uLng, uLat float64) (polyLineList []string, dist return nil, 0, 0, err } - distance = int64(path.Routes[0].Distance) // 距离 - duration = int64(path.Routes[0].Duration) // 时间 + if path != nil && len(path.Routes) != 0 { + distance = int64(path.Routes[0].Distance) // 距离 + duration = int64(path.Routes[0].Duration) // 时间 - for _, v := range path.Routes[0].Steps { - polyLineList = append(polyLineList, strings.Split(v.Path, ";")...) + for _, v := range path.Routes[0].Steps { + polyLineList = append(polyLineList, strings.Split(v.Path, ";")...) + } } - return }