Commit c6b55424 authored by zw's avatar zw

获取经纪人的站点列表

parent fbb32af7
......@@ -101,6 +101,8 @@ class Report extends Basic
/**
* 获取报备列表
* @return \think\Response
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function reportList()
{
......@@ -130,13 +132,13 @@ class Report extends Basic
} else {
return $this->response("200", "request null");
}
}
/**
* 获取报备列表 pc
*
* @return \think\Response
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function reportListForPc()
{
......
......@@ -9,6 +9,7 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\model\AAgents;
use app\model\ASite;
use think\Request;
......@@ -16,11 +17,13 @@ class Site extends Basic
{
protected $aSite;
protected $aAgentModel;
public function __construct($request = null)
{
parent::__construct($request);
$this->aSite = new ASite();
$this->aAgentModel = new AAgents();
}
......@@ -35,10 +38,6 @@ class Site extends Basic
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
"id" => 5740
);*/
$field = 'id,name,city,is_del';
$get_params['is_del'] = 0;
......@@ -47,5 +46,31 @@ class Site extends Basic
return $this->response("200", "成功", $res);
}
/**
* 获取经纪人有哪些站点的账号
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentSiteList()
{
$params = $this->params;
/*$params = array(
"agent_phone" => "13817616471"
);*/
if(empty($params["agent_phone"])){
return $this->response("101","请求参数错误");
}
$field = 'a.id,a.site_id,b.city';
$get_params['b.is_del'] = 0;
$get_params['a.phone'] = $params["agent_phone"];
$site_city = $this->aAgentModel->getAgentSiteList($get_params, $field);
return $this->response("200", "success", $site_city);
}
}
\ No newline at end of file
......@@ -1398,4 +1398,22 @@ class AAgents extends BaseModel
->where($where)
->find();
}
/**
* @param $where
* @param $fields
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentSiteList($where, $fields)
{
return $this->field($fields)
->alias('a')
->join('a_site b', 'a.site_id=b.id', 'left')
->where($where)
->find();
}
}
\ No newline at end of file
......@@ -663,6 +663,8 @@ Route::group('broker', [
//站点相关
'getSiteListApp' => [ 'api_broker/Site/getSiteList', [ 'method' => 'POST|GET' ] ], //获取站点列表 朱伟 2018-10-18
'getAgentSiteList' => [ 'api_broker/Site/getAgentSiteList', [ 'method' => 'POST|GET' ] ], //获取经纪人站点列表
]);
//Route::miss('api/index/miss');//处理错误的url
\ 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