Commit aa7c672d authored by zw's avatar zw

地图找房

parent a0650666
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\model\GHouses;
use think\Request; use think\Request;
/** /**
...@@ -14,20 +15,28 @@ use think\Request; ...@@ -14,20 +15,28 @@ use think\Request;
*/ */
class MapFindHouse extends Basic class MapFindHouse extends Basic
{ {
private $gHousesModel;
public function __construct(Request $request = null) public function __construct(Request $request = null)
{ {
parent::__construct($request); 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() public function getShopListByMap()
{ {
$params = $this->params; $params = $this->params;
$params = array( /* $params = array(
"first_spot" => "1223,1213123", "first_spot" => "1223,1213123",
"second_spot" => "1223,1213123", "second_spot" => "1223,1213123",
"grade" => 1,//1 市,2区,3街道 "grade" => 1,//1 市,2区,3街道
"source" => 1,//来源 1b端,2c端 "source" => 1,//来源 1b端,2c端
); );*/
$checkResult = $this->validate($params, "MapFindHouseValidate.getShopListByMap"); $checkResult = $this->validate($params, "MapFindHouseValidate.getShopListByMap");
if (true !== $checkResult) { if (true !== $checkResult) {
return $this->response("101", $checkResult); return $this->response("101", $checkResult);
...@@ -40,16 +49,18 @@ class MapFindHouse extends Basic ...@@ -40,16 +49,18 @@ class MapFindHouse extends Basic
$conditions = []; $conditions = [];
$conditions["longitude"] = array("between",array($first_spot_arr[0],$second_spot_arr[0])); $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])); $conditions["latitude"] = array("between",array($first_spot_arr[1],$second_spot_arr[1]));
switch ($params["grade"]){ /*switch ($params["grade"]){
case 1: case 1:
break; break;
case 2: case 2:
break; break;
case 3: case 3:
break; break;
default: 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 ...@@ -949,6 +949,22 @@ class GHouses extends BaseModel
->select(); ->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 $params
* @param $spTagsArr * @param $spTagsArr
......
...@@ -516,6 +516,7 @@ Route::group('broker', [ ...@@ -516,6 +516,7 @@ Route::group('broker', [
'inviteList' => [ 'api_broker/Client/inviteList', [ 'method' => 'get' ] ], //邀请记录 'inviteList' => [ 'api_broker/Client/inviteList', [ 'method' => 'get' ] ], //邀请记录
//商铺 //商铺
'getShopList' => [ 'api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ], 'getShopList' => [ 'api_broker/Shop/getShopList', [ 'method' => 'get|post' ] ],
'getShopListByMap' => [ 'api_broker/MapFindHouse/getShopListByMap', [ 'method' => 'get|post' ] ],
'getShopDetail' => [ 'api_broker/Shop/getShopDetail', [ 'method' => 'get' ] ], 'getShopDetail' => [ 'api_broker/Shop/getShopDetail', [ 'method' => 'get' ] ],
'addShopFollowUp' => [ 'api_broker/Shop/addShopFollowUp', [ 'method' => 'post' ] ], //新增商铺跟进记录 '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