Commit 7e9e55c0 authored by clone's avatar clone

bug

parent c74fbe1d
...@@ -78,9 +78,9 @@ class Shop extends Basic ...@@ -78,9 +78,9 @@ class Shop extends Basic
"rent_price_end" => 10000,//租金 "rent_price_end" => 10000,//租金
"shop_sign" => "临近地铁,临近地铁2", "shop_sign" => "临近地铁,临近地铁2",
"agent_id" => 630, //添加经纪人id "agent_id" => 630, //添加经纪人id
"status" => 1, //1上架or2下架 "status" => 1, //1上架or2下架
"start_time" => "2018-05-25", "start_time" => "2018-05-25",
"end_time" => "2018-05-30", "end_time" => "2018-05-30",
"pageNo" => 1, "pageNo" => 1,
"pageSize" => 15 "pageSize" => 15
);*/ );*/
......
...@@ -77,8 +77,8 @@ class Shop extends Basic ...@@ -77,8 +77,8 @@ class Shop extends Basic
"end_time" => "2018-05-30", "end_time" => "2018-05-30",
"landlord_phone" => "17621970093", "landlord_phone" => "17621970093",
//新增于180919 //新增于180919
"p_district_id" => 1, "p_district_name" => "一部",
"p_store_id" => 1, "p_store_name" => "门店",
"p_agent_name" => "张三", "p_agent_name" => "张三",
...@@ -213,8 +213,11 @@ class Shop extends Basic ...@@ -213,8 +213,11 @@ class Shop extends Basic
return $this->response("200", "此条件没有找到数据"); return $this->response("200", "此条件没有找到数据");
} }
} elseif (isset($params['p_district_id']) && isset($params['p_store_id']) && isset($params['p_agent_name'])) { } elseif (isset($params['p_district_name']) || isset($params['p_store_name']) || isset($params['p_agent_name'])) {
$houseIds = $this->returnHouseIdByPanParty($params['p_district_id'], $params['p_store_id'], $params['p_agent_name']); $p_district_name = empty($params['p_district_name']) ? "" : $params['p_district_name'];
$p_store_name = empty($params['p_store_name']) ? "" : $params['p_store_name'];
$p_agent_name = empty($params['p_agent_name']) ? "" : $params['p_agent_name'];
$houseIds = $this->returnHouseIdByPanParty($p_district_name, $p_store_name, $p_agent_name);
if (empty($houseIds)) { if (empty($houseIds)) {
return $this->response("200", "此条件没有找到数据"); return $this->response("200", "此条件没有找到数据");
} }
...@@ -269,20 +272,39 @@ class Shop extends Basic ...@@ -269,20 +272,39 @@ class Shop extends Basic
return $ids; return $ids;
} }
private function returnHouseIdByPanParty($p_district_id, $p_store_id, $p_agent_name) private function returnHouseIdByPanParty($p_district_name, $p_store_name, $p_agent_name)
{ {
$agentModel = new AAgents(); $agentModel = new AAgents();
$params["district_id"] = $p_district_id; $params = [];
$params["store_id"] = $p_store_id; if ($p_district_name) {
$params["name"] = array( "like", "%" . trim($p_agent_name) . "%" ); $params["c.district_name"] = array( "like", "%" . trim($p_district_name) . "%" );
$agentArr = $agentModel->getAgentById("id", $params); }
$ids = ""; if ($p_store_name) {
$params["b.store_name"] = array( "like", "%" . trim($p_district_name) . "%" );
}
if ($p_agent_name) {
$params["a.name"] = array( "like", "%" . trim($p_district_name) . "%" );
}
$ids = "";
if (empty($params)) {
return $ids;
}
$agentArr = $agentModel->getAgentsInfoByShop("a.id", $params);
$agentIds = "";
if (count($agentArr) < 1) { if (count($agentArr) < 1) {
return $ids; return $ids;
} else {
foreach ($agentArr as $item) {
$agentIds .= $item["id"] . ",";
}
$agentIds = rtrim($agentIds, ",");
} }
$verifyService = new VerifyService(); $verifyService = new VerifyService();
$houseIds = $verifyService->getPanpartyByAgentId($agentArr[0]["id"]); $selectParams = array( "in", $agentIds );
$houseIds = $verifyService->getPanpartyByAgentId($selectParams);
if (count($houseIds) > 0) { if (count($houseIds) > 0) {
foreach ($houseIds as $item) { foreach ($houseIds as $item) {
$ids .= $item["house_id"] . ","; $ids .= $item["house_id"] . ",";
......
...@@ -28,7 +28,7 @@ class VerifyService ...@@ -28,7 +28,7 @@ class VerifyService
*/ */
public function getAgentsByAgentId($agent_id) public function getAgentsByAgentId($agent_id)
{ {
$params["id"] = $agent_id; $params["id"] = $agent_id;
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params); $result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params);
if (count($result) > 0) { if (count($result) > 0) {
$arr_list = []; $arr_list = [];
...@@ -118,8 +118,7 @@ class VerifyService ...@@ -118,8 +118,7 @@ class VerifyService
$params["a.agents_id"] = $agent_id; $params["a.agents_id"] = $agent_id;
$params["a.type"] = 2; $params["a.type"] = 2;
$params["a.is_del"] = 0; $params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params);
$house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,b.internal_title", $params);
$ids = ""; $ids = "";
if (count($house_arr) > 0) { if (count($house_arr) > 0) {
......
...@@ -529,6 +529,28 @@ class AAgents extends BaseModel ...@@ -529,6 +529,28 @@ class AAgents extends BaseModel
->select(); ->select();
return $result; return $result;
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsInfoByShop($field, $params)
{
$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($params)
->select();
return $result;
} }
/** /**
......
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