Commit aa7c672d authored by zw's avatar zw

地图找房

parent a0650666
......@@ -3,6 +3,7 @@
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\model\GHouses;
use think\Request;
/**
......@@ -14,20 +15,28 @@ use think\Request;
*/
class MapFindHouse extends Basic
{
private $gHousesModel;
public function __construct(Request $request = null)
{
parent::__construct($request);
$this->gHousesModel = new GHouses();
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getShopListByMap()
{
$params = $this->params;
$params = array(
/* $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);
......@@ -40,16 +49,18 @@ class MapFindHouse extends Basic
$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"]){
/*switch ($params["grade"]){
case 1:
break;
case 2:
break;
case 3:
break;
default:
}
}*/
$field = "id,internal_title,longitude,latitude";
$result = $this->gHousesModel->getHousesListByMap( $field, $conditions);
return $this->response("200","success",$result);
}
......
......@@ -949,6 +949,22 @@ class GHouses extends BaseModel
->select();
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
function getHousesListByMap( $field, $params)
{
return Db::table($this->table)
->field($field)
->where($params)
->select();
}
/**
* @param $params
* @param $spTagsArr
......
......@@ -516,6 +516,7 @@ Route::group('broker', [
'inviteList' => [ 'api_broker/Client/inviteList', [ 'method' => 'get' ] ], //邀请记录
//商铺
'getShopList' => [ 'api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ],
'getShopListByMap' => [ 'api_broker/MapFindHouse/getShopListByMap', [ 'method' => 'get|post' ] ],
'getShopDetail' => [ 'api_broker/Shop/getShopDetail', [ 'method' => 'get' ] ],
'addShopFollowUp' => [ 'api_broker/Shop/addShopFollowUp', [ 'method' => 'post' ] ], //新增商铺跟进记录
......
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