Commit 7e9e55c0 authored by clone's avatar clone

bug

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