Commit 85494b6e authored by zw's avatar zw

经纪人搜索

parent b040ed78
......@@ -14,6 +14,7 @@ class AAgents extends BaseModel
{
protected $table = 'a_agents';
/**
* 返回经纪人和部门信息
*
......@@ -191,13 +192,16 @@ class AAgents extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function verifyUser($field,$join,$params)
public function verifyUser($field, $join, $params)
{
return $this->field($field)
$r = $this->field($field)
->alias('a')
->join($join)
->join($join)
->where($params)
->find();
//echo $this->getLastSql();
return $r;
}
/**
......@@ -325,17 +329,15 @@ class AAgents extends BaseModel
return $data;
}
/**
* 批量获取经纪人
*
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsByStoreId($params){
$result = Db::table($this->table)
public function getAgentsByStoreId($params)
{
$result = Db::table($this->table)
->field("id")
->where($params)
->select();
......@@ -343,20 +345,35 @@ class AAgents extends BaseModel
return $result;
}
/**
* 检查是否有权限
*
* @param $id
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function agentsAuth($id) {
return $this->alias('a')
->field('b.id')
->join('auth_group b','a.auth_group_id=b.id','left')
->where("FIND_IN_SET({$id},b.rules)")
->find();
public function getAgentsInfoByAgentId($field, $params)
{
$where_ = [];
if (isset($params["agent_id"])) {
$where_["a.id"] = $params["agent_id"];
}
$where_["a.status"] = 0;
$result = Db::table($this->table)
->field($field)
->alias("a")
->join("a_store b", "a.store_id = b.id", "left")
->join("a_district c", "a.district_id = c.id", "left")
->where($where_)
->select();
return $result;
}
public function searchAgentsByKeyword($field, $params)
{
$params["status"] = 0;
$result = Db::table($this->table)
->field($field)
->where($params)
->select();
return $result;
}
}
\ No newline at end of file
......@@ -302,6 +302,8 @@ Route::group('broker', [
'dayStatement' => ['api_broker/Statement/dayStatement', [ 'method' => 'get|post' ] ],
'searchAgents' => ['api_broker/OrderLog/searchAgents', [ 'method' => 'get|post' ] ],
'center' => ['api_broker/MyCenter/center', [ 'method' => 'get|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