- 去掉GetStores的坐标转(转换至百度坐标要百度API,高德不行)
This commit is contained in:
@@ -404,9 +404,29 @@ func GetStores(ctx *jxcontext.Context, keyword string, params map[string]interfa
|
||||
retVal.Stores = retVal.Stores[offset : offset+pageSize]
|
||||
}
|
||||
if needConver2Baidu {
|
||||
for _, v := range storeList {
|
||||
v.FloatLng, v.FloatLat, _ = api.AutonaviAPI.CoordinateConvert(v.FloatLng, v.FloatLat, autonavi.CoordSysBaidu)
|
||||
}
|
||||
task := tasksch.NewParallelTask("坐标转换", tasksch.NewParallelConfig().SetParallelCount(4).SetBatchSize(autonavi.MaxConvertCount), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
var coords []*autonavi.Coordinate
|
||||
for _, v := range batchItemList {
|
||||
store := v.(*StoreExt)
|
||||
coords = append(coords, &autonavi.Coordinate{
|
||||
Lng: store.FloatLng,
|
||||
Lat: store.FloatLat,
|
||||
})
|
||||
}
|
||||
coords, err = api.AutonaviAPI.BatchCoordinateConvert(coords, autonavi.CoordSysBaidu)
|
||||
if err == nil {
|
||||
for k, v := range batchItemList {
|
||||
store := v.(*StoreExt)
|
||||
coord := coords[k]
|
||||
store.FloatLng = coord.Lng
|
||||
store.FloatLat = coord.Lat
|
||||
}
|
||||
}
|
||||
return retVal, err
|
||||
}, retVal.Stores)
|
||||
task.Run()
|
||||
task.GetResult(0)
|
||||
}
|
||||
// if mapLimit {
|
||||
// retVal.TotalCount = len(retVal.Stores)
|
||||
|
||||
Reference in New Issue
Block a user