Commit 9d6ae8b3 authored by zw's avatar zw

huancun

parent 94de1030
......@@ -374,7 +374,7 @@ class PerformanceService
}
$verify = new VerifyService();
$agent_ids = $verify->getAgentsByAgentId($agent_id);
$agent_ids = $verify->getAgentsByWhere($agent_id);
$params["a.agent_id"] = array( "in", $agent_ids );
if (!empty($site_id)) {
$where['a.disc'] = $site_id;
......
......@@ -59,6 +59,50 @@ class VerifyService
return null;
}
/**
* 经纪人身份验证 获取经纪人
* @param $agent_id
* @return null|string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getAgentsByWhere($agent_id)
{
$params["id"] = $agent_id;
$result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", $params);
if (count($result) > 0) {
$arr_list = [];
switch ($result[0]["level"]) {
case 10:
return $result[0]["id"];
case 20:
$arr_list = $this->agentModel->searchAgentsByKeyword("id", [ "store_id" => $result[0]["store_id"],
"status" => "-1" ]);
break;
case 30:
case 40:
$arr_list = $this->agentModel->searchAgentsByKeyword("id", [ "district_id" => $result[0]["district_id"],
"status" => "-1" ]);
break;
default:
return $agent_id;
break;
}
$ids = "";
if (count($arr_list) > 0) {
foreach ($arr_list as $item) {
$ids .= $item["id"] . ",";
}
}
$ids = rtrim($ids, ",");
return $ids;
}
return null;
}
public function getAgentsByAgentIdPcInfo($id, $type)
{
$arr_list = [];
......
......@@ -664,9 +664,11 @@ class AAgents extends BaseModel
*/
public function searchAgentsByKeyword($field, $params)
{
$params["status"] = array("in","0,3");
if(isset($params["status"]) && $params["status"] == "-1"){
unset($params["status"]);
}else{
$params["status"] = array("in","0,3");
}
$result = Db::table($this->table)
->field($field)
->where($params)
......
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