Commit 60a5552d authored by hujun's avatar hujun

where

parent 6522307a
...@@ -6,6 +6,7 @@ use app\api\extend\Basic; ...@@ -6,6 +6,7 @@ use app\api\extend\Basic;
use app\api_broker\service\PushMessageService; use app\api_broker\service\PushMessageService;
use app\model\Applies; use app\model\Applies;
use app\model\AppointWatchShop; use app\model\AppointWatchShop;
use app\model\ASite;
use app\model\Evaluate; use app\model\Evaluate;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesImgs; use app\model\GHousesImgs;
...@@ -54,7 +55,7 @@ class AppointmentTime extends Basic ...@@ -54,7 +55,7 @@ class AppointmentTime extends Basic
public function addAppointmentSeeShop() public function addAppointmentSeeShop()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( $params = array(
"user_id" => 116, "user_id" => 116,
"house_id" => 49, "house_id" => 49,
"house_title" => "楼盘1", "house_title" => "楼盘1",
...@@ -62,7 +63,7 @@ class AppointmentTime extends Basic ...@@ -62,7 +63,7 @@ class AppointmentTime extends Basic
"phone" => "13817616312", "phone" => "13817616312",
"expect_time" => time() + 1000, "expect_time" => time() + 1000,
"other_require" => "没有其他要求" "other_require" => "没有其他要求"
);*/ );
//todo 验证楼盘信息 //todo 验证楼盘信息
if (isset($params["house_id"]) && isset($params["house_title"])) { if (isset($params["house_id"]) && isset($params["house_title"])) {
...@@ -82,8 +83,13 @@ class AppointmentTime extends Basic ...@@ -82,8 +83,13 @@ class AppointmentTime extends Basic
if (!isset($params["expect_time"]) || $params['expect_time'] <= time()) { if (!isset($params["expect_time"]) || $params['expect_time'] <= time()) {
return $this->response("101", "预约时间为空,或者小于当前时间"); return $this->response("101", "预约时间为空,或者小于当前时间");
} }
$m_user = new Users(); $m_user = new Users();
$appoint_agent_id = $m_user->getAgentBySiteIdCity('c.id', ['a.id'=>$this->userId,'d.city'=>$houseInfo['city']]); $m_site = new ASite();
$site_id = $m_site->getSiteById('id', ['city'=>$this->user_city]);
$user_where['a.id'] = $this->userId;
$user_where['b.site_id'] = $site_id;
$appoint_agent_id = $m_user->getAgentByCity('c.id', $user_where);
if (empty($appoint_agent_id['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]);
......
...@@ -78,7 +78,7 @@ class WatchShop extends Basic ...@@ -78,7 +78,7 @@ class WatchShop extends Basic
} }
if ($params['check_status'] == 2) { if ($params['check_status'] == 2) {
$where['a.appoint_agent_id'] = $where['d.agent_id'] = $this->userId; $where['a.appoint_agent_id'] = $this->userId;
$data['list'] = $applies->getAppointWatchOurList($pageNo, $pageSize, 'id DESC', 'a.*', $where); $data['list'] = $applies->getAppointWatchOurList($pageNo, $pageSize, 'id DESC', 'a.*', $where);
$data['total'] = $applies->getAppointWatchOurTotal($where); $data['total'] = $applies->getAppointWatchOurTotal($where);
} }
......
...@@ -1095,13 +1095,13 @@ class Users extends Model ...@@ -1095,13 +1095,13 @@ class Users extends Model
* @param $params * @param $params
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
*/ */
public function getAgentBySiteIdCity($field, $params){ public function getAgentByCity($field, $params){
$params['b.is_del'] = 0;
return Db::name($this->table) return Db::name($this->table)
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("u_user_agent b","a.id = b.user_id","left") ->join("u_user_agent b","a.id = b.user_id","left")
->join("a_agents c", "a.agent_id=b.id", "left") ->join("a_agents c", "a.agent_id=b.id", "left")
->join('a_site d', 'c.site_id = d.id', 'left')
->where($params) ->where($params)
->limit(1) ->limit(1)
->select(); ->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