Commit 298f47ae authored by hujun's avatar hujun

预约楼盘客方

parent e26fc5bf
...@@ -67,7 +67,7 @@ class AppointmentTime extends Basic ...@@ -67,7 +67,7 @@ class AppointmentTime extends Basic
//todo 验证楼盘信息 //todo 验证楼盘信息
if (isset($params["house_id"]) && isset($params["house_title"])) { if (isset($params["house_id"]) && isset($params["house_title"])) {
$where_["id"] = $params["house_id"]; $where_["id"] = $params["house_id"];
$houseInfo = $this->houseInfoModel->getHouseDetail("id", $where_); $houseInfo = $this->houseInfoModel->getHouseDetail("id,city", $where_);
if (count($houseInfo) <= 0) { if (count($houseInfo) <= 0) {
return $this->response("101", "楼盘ID或楼盘名错误"); return $this->response("101", "楼盘ID或楼盘名错误");
} }
...@@ -83,10 +83,12 @@ class AppointmentTime extends Basic ...@@ -83,10 +83,12 @@ class AppointmentTime extends Basic
return $this->response("101", "预约时间为空,或者小于当前时间"); return $this->response("101", "预约时间为空,或者小于当前时间");
} }
$m_user = new Users(); $m_user = new Users();
$appoint_agent_id = $m_user->getUserByWhereValue('agent_id', ['id'=>$this->userId]); $appoint_agent_id = $m_user->getAgentBySiteIdCity('c.id', ['a.id'=>$this->userId,'d.city'=>$houseInfo['city']]);
if (empty($appoint_agent_id)) { if (empty($appoint_agent_id['id'])) {
$m_house_agent = new GHousesToAgents(); $m_house_agent = new GHousesToAgents();
$appoint_agent_id = $m_house_agent->getAgentHouseValue('agents_id',['houses_id'=>$params["house_id"],'type'=>2]); $appoint_agent_id = $m_house_agent->getAgentHouseValue('agents_id',['houses_id'=>$params["house_id"],'type'=>2]);
} else {
$appoint_agent_id = $appoint_agent_id['id'];
} }
$addPrams = array( $addPrams = array(
'expect_time' => date("Y-m-d H:i:s", $params["expect_time"] / 1000), 'expect_time' => date("Y-m-d H:i:s", $params["expect_time"] / 1000),
......
...@@ -1096,5 +1096,22 @@ class Users extends Model ...@@ -1096,5 +1096,22 @@ class Users extends Model
->limit(1) ->limit(1)
->select(); ->select();
} }
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
*/
public function getAgentBySiteIdCity($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")
->join('a_site d', 'c.site_id = d.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