Commit bdc55579 authored by zhuwei's avatar zhuwei

1

parent 9b22d9f8
...@@ -174,8 +174,10 @@ class Performance extends Basic ...@@ -174,8 +174,10 @@ class Performance extends Basic
Log::write($params, 'storeOrAgentSort'); //记录日志 Log::write($params, 'storeOrAgentSort'); //记录日志
//城市选择 //城市选择
$site_id = $params["site_id"] ? $params["site_id"] : ''; $site_id = $params["site_id"] ? $params["site_id"] : '';
$district_id = isset($params["district_id"]) && $params["district_id"] ? $params["district_id"] : '';
try { try {
$result = $this->service_->storeSortByDistrictId($params["agent_id"], $params["is_store"], $params["start_time"], $params["end_time"] . " 23:59:59", $site_id); $result = $this->service_->storeSortByDistrictId($params["agent_id"], $params["is_store"],
$params["start_time"], $params["end_time"] . " 23:59:59", $site_id,$district_id);
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} catch (Exception $exception) { } catch (Exception $exception) {
......
...@@ -366,9 +366,10 @@ class PerformanceService ...@@ -366,9 +366,10 @@ class PerformanceService
* @param $is_store * @param $is_store
* @param $start_time * @param $start_time
* @param $end_time * @param $end_time
* @return array|false|null|\PDOStatement|string|\think\Collection * @param $site_id
* @return false|null|\PDOStatement|string|\think\Collection
*/ */
public function storeSortByDistrictId($agent_id, $is_store, $start_time, $end_time,$site_id) public function storeSortByDistrictId($agent_id, $is_store, $start_time, $end_time,$site_id,$district_id)
{ {
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", [ "id" => $agent_id ]); $result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", [ "id" => $agent_id ]);
...@@ -378,7 +379,7 @@ class PerformanceService ...@@ -378,7 +379,7 @@ class PerformanceService
} }
$verify = new VerifyService(); $verify = new VerifyService();
$agent_ids = $verify->getAgentsByWhere($agent_id); $agent_ids = $verify->getAgentsByWhere($agent_id,$district_id);
$params["a.agent_id"] = array( "in", $agent_ids ); $params["a.agent_id"] = array( "in", $agent_ids );
if (!empty($site_id)) { if (!empty($site_id)) {
$where['a.disc'] = $site_id; $where['a.disc'] = $site_id;
......
...@@ -177,13 +177,17 @@ class VerifyService ...@@ -177,13 +177,17 @@ class VerifyService
/** /**
* 经纪人身份验证 获取经纪人 不区分状态 * 经纪人身份验证 获取经纪人 不区分状态
* @param $agent_id * @param $agent_id
* @param $district_id
* @return null|string * @return null|string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function getAgentsByWhere($agent_id) public function getAgentsByWhere($agent_id,$district_id)
{ {
if ($district_id) {
//存在区域id直接查分部信息
$ids = $this->getAgentsIdByDistrictId();
return $ids;
}
$params["id"] = $agent_id; $params["id"] = $agent_id;
$result = $this->agentModel->getAgentsByKeyword("id,store_id,district_id,level", $params); $result = $this->agentModel->getAgentsByKeyword("id,store_id,district_id,level", $params);
if (count($result) > 0) { if (count($result) > 0) {
...@@ -215,6 +219,19 @@ class VerifyService ...@@ -215,6 +219,19 @@ class VerifyService
return null; return null;
} }
public function getAgentsIdByDistrictId(){
$arr_list = $this->agentModel->getAgentsByKeyword("id", ["district_id" => $district_id]);
$ids = "";
if (count($arr_list) > 0) {
foreach ($arr_list as $item) {
$ids .= $item["id"] . ",";
}
$ids = rtrim($ids, ",");
return $ids;
}
return null;
}
/** /**
* @param $id * @param $id
......
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