|
|
@ -2,10 +2,15 @@ |
|
|
|
|
|
|
|
|
namespace App\Controller\v3; |
|
|
namespace App\Controller\v3; |
|
|
|
|
|
|
|
|
|
|
|
use App\Constants\v3\ErrorCode; |
|
|
use App\Controller\BaseController; |
|
|
use App\Controller\BaseController; |
|
|
|
|
|
use App\Exception\ErrorCodeException; |
|
|
use App\Model\v3\Market; |
|
|
use App\Model\v3\Market; |
|
|
use App\Service\v3\Interfaces\LocationServiceInterface; |
|
|
use App\Service\v3\Interfaces\LocationServiceInterface; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
|
|
use Hyperf\Validation\Contract\ValidatorFactoryInterface; |
|
|
|
|
|
use Hyperf\Validation\ValidationException; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 定位相关 |
|
|
* 定位相关 |
|
|
* Class LocationController |
|
|
* Class LocationController |
|
|
@ -19,6 +24,12 @@ class LocationController extends BaseController |
|
|
*/ |
|
|
*/ |
|
|
protected $locationService; |
|
|
protected $locationService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Inject() |
|
|
|
|
|
* @var ValidatorFactoryInterface |
|
|
|
|
|
*/ |
|
|
|
|
|
protected $validationFactory; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 获取当前用户定位最近的市场 |
|
|
* 获取当前用户定位最近的市场 |
|
|
* 1.用户上报经纬度数据 |
|
|
* 1.用户上报经纬度数据 |
|
|
@ -47,4 +58,27 @@ class LocationController extends BaseController |
|
|
|
|
|
|
|
|
return $this->success($ret); |
|
|
return $this->success($ret); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function addrSuggestion() |
|
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
$validator = $this->validationFactory->make( |
|
|
|
|
|
$this->request->all(), |
|
|
|
|
|
['keyword' => 'required|nonempty'], |
|
|
|
|
|
['keyword.*' => '关键字不能为空或undefined等'] |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if ($validator->fails()){ |
|
|
|
|
|
throw new ValidationException($validator); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$keyword = $this->request->input('keyword'); |
|
|
|
|
|
$marketId = $this->request->input('market_id'); |
|
|
|
|
|
$page = $this->request->input('page'); |
|
|
|
|
|
$pageSize = $this->request->input('pagesize'); |
|
|
|
|
|
|
|
|
|
|
|
$res = $this->locationService->placeSuggestion($keyword, $marketId, $page, $pageSize); |
|
|
|
|
|
|
|
|
|
|
|
return $this->success($res); |
|
|
|
|
|
} |
|
|
} |
|
|
} |