Commit ed868571 authored by zw's avatar zw

地图找房

parent 88af4fe7
<?php
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use think\Request;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/10/17
* Time : 上午9:40
* Intro: 地图找房
*/
class MapFindHouse extends Basic
{
public function __construct(Request $request = null)
{
parent::__construct($request);
}
public function getShopListByMap()
{
$params = $this->params;
$params = array(
"first_spot" => "1223,1213123",
"second_spot" => "1223,1213123",
"grade" => 1,//1 市,2区,3街道
"source" => 1,//来源 1b端,2c端
);
$checkResult = $this->validate($params, "MapFindHouseValidate.getShopListByMap");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
$first_spot_arr = explode($params["first_spot"], ",");
$second_spot_arr = explode($params["second_spot"], ",");
if (count($first_spot_arr) < 2 || count($second_spot_arr) < 2) {
return $this->response("101", "坐标传入有误");
}
$conditions = [];
$conditions["longitude"] = array("between",array($first_spot_arr[0],$second_spot_arr[0]));
$conditions["latitude"] = array("between",array($first_spot_arr[1],$second_spot_arr[1]));
switch ($params["grade"]){
case 1:
break;
case 2:
break;
case 3:
break;
default:
}
}
}
\ No newline at end of file
<?php
namespace app\api_broker\validate;
use think\Validate;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/10/17
* Time : 上午10:19
* Intro:
*/
class MapFindHouseValidate extends Validate
{
protected $rule = [
'first_spot' => 'require',
'second_spot' => 'require',
'grade' => 'require|number|in:1,2,3',
'source' => 'require|number|in:1,2',
];
protected $message = [
'first_spot.require' => '坐标为必传字段',
'second_spot.require' => '坐标为必传字段',
'grade.require' => '级别为必传',
'grade.number' => '级别为必传',
'grade.in' => '级别参数错误',
'source.require' => '来源为必传',
'source.number' => '来源为必传',
'source.in' => '来源参数错误',
];
protected $scene = [
'getShopListByMap' => ['first_spot', 'second_spot', 'grade','source'],
];
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment