初始版本
This commit is contained in:
75
server/app/coachapi/controller/CityController.php
Executable file
75
server/app/coachapi/controller/CityController.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
namespace app\coachapi\controller;
|
||||
use app\api\controller\BaseApiController;
|
||||
use app\coachapi\logic\CityLogic;
|
||||
|
||||
class CityController extends BaseCoachController
|
||||
{
|
||||
/**
|
||||
* @notes 获取城市列表
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author cjhao
|
||||
* @date 2024/10/6 17:50
|
||||
*/
|
||||
public function getCityLists()
|
||||
{
|
||||
$lists = (new CityLogic())->getCityLists();
|
||||
return $this->success('',$lists);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 搜索附近地址
|
||||
* @return \think\response\Json
|
||||
* @author ljj
|
||||
* @date 2024/7/23 上午11:21
|
||||
*/
|
||||
public function getNearbyLocation()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$result = (new CityLogic())->getNearbyLocation($params);
|
||||
if ($result['status'] !== 0) {
|
||||
return $this->fail($result['message']);
|
||||
}
|
||||
return $this->success('',$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 地级市列表
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author ljj
|
||||
* @date 2022/4/6 2:41 下午
|
||||
*/
|
||||
public function city()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$result = (new CityLogic())->city($params);
|
||||
return $this->success('获取成功',$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 逆地址解析(坐标位置描述)
|
||||
* @return \think\response\Json
|
||||
* @author ljj
|
||||
* @date 2022/10/13 2:44 下午
|
||||
* 本接口提供由经纬度到文字地址及相关位置信息的转换能力
|
||||
*/
|
||||
public function geocoderCoordinate()
|
||||
{
|
||||
$get = $this->request->get();
|
||||
if (!isset($get['location']) || $get['location'] == '') {
|
||||
return $this->fail('经纬度缺失');
|
||||
}
|
||||
|
||||
$result = (new CityLogic())->geocoderCoordinate($get);
|
||||
if ($result['status'] !== 0) {
|
||||
return $this->fail($result['message']);
|
||||
}
|
||||
return $this->success('',$result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user