Commit 790e7e98 authored by clone's avatar clone

选择客方

parent 423b506b
......@@ -362,7 +362,7 @@ class OrderLog extends Basic
}
try {
$list = $this->service_->searchBargainAgents($params["type"], $params["order_id"]);
$list = $this->service_->searchBargainAgents($params["type"], $params["order_id"],$this->siteId);
if (count($list) > 0) {
return $this->response("200", "request success", $list);
} else {
......
......@@ -1562,9 +1562,13 @@ class OrderLogService
* 成交报告客户搜索
* @param $type
* @param $order_id
* @return false|null|\PDOStatement|string|\think\Collection
* @param $site_id
* @return false|\PDOStatement|string|\think\Collection|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function searchBargainAgents($type, $order_id)
public function searchBargainAgents($type, $order_id,$site_id)
{
$orderModel = new OrderModel();
$field = "a.id,a.order_no,a.house_id,a.house_title,b.id as report_id,b.user_id,c.user_nick,c.user_phone,
......@@ -1586,10 +1590,12 @@ class OrderLogService
$list = $houseAgents->getAgentsByHouseId($field, $params);
break;
case 2:
$fields = "c.id,c.phone,c.name";
$userModel = new Users();
$params["a.id"] = $result[0]["user_id"];
$params["b.status"] = 0;
$list = $userModel->getAgentByUserId($field, $params);
$params["c.status"] = 0;
$params["b.site_id"] = $site_id;
$list = $userModel->getAgentBySiteId($fields, $params);
break;
case 3: //反签 == 报备人
$reportModel = new OReportModel();
......
......@@ -1085,5 +1085,16 @@ class Users extends Model
return $result;
}
public function getAgentBySiteId($field, $params){
return Db::name($this->table)
->field($field)
->alias("a")
->join("u_user_agent b","a.id = b.user_id","left")
->join("a_agents c", "a.agent_id=b.id", "left")
->where($params)
->limit(1)
->select();
}
}
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