package shop.alien.second.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiSort;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import shop.alien.entity.result.R;
import shop.alien.second.config.GaoDeMapUtil;

import java.util.Map;

@Slf4j
@Api(tags = {"二手平台-高德"})
@ApiSort(9)
@CrossOrigin
@RestController
@RequestMapping("/second/gaode")
@RequiredArgsConstructor
public class SecondGaoDeController {

    private final GaoDeMapUtil gaodeMapUtil;

    @ApiOperation("获取城市与城市半径")
    @GetMapping("/queryCity")
    public R<Map<String, Object>> queryCity(
            @RequestParam(value = "longitude", required = false) String longitude,
            @RequestParam(value = "latitude", required = false) String latitude) {
        return R.data(gaodeMapUtil.getCityAndRadiusByLonAndLat(longitude, latitude), "查询成功");
    }

}
