Commit d526563f authored by clone's avatar clone

bug

parent 45807a9a
...@@ -61,9 +61,9 @@ class User extends Basic ...@@ -61,9 +61,9 @@ class User extends Basic
public function searchUser() public function searchUser()
{ {
$params = $this->params; $params = $this->params;
/*$params = array( $params = array(
"user_status" => 0,//客户状态(0:求租;1:已租;-1:无效) "user_status" => 0,//客户状态(0:求租;1:已租;-1:无效)
"yetai" => "休闲娱乐", /* "yetai" => "休闲娱乐",
"area_start" => 1,//面积起始范围 room_area2 "area_start" => 1,//面积起始范围 room_area2
"area_end" => 65,//面积结束范围 "area_end" => 65,//面积结束范围
"money_start" => 1,//租金 price2 "money_start" => 1,//租金 price2
...@@ -72,88 +72,83 @@ class User extends Basic ...@@ -72,88 +72,83 @@ class User extends Basic
"end_time" => "2018-05-30", "end_time" => "2018-05-30",
"user_id" => 1, "user_id" => 1,
"user_name" => "12312", "user_name" => "12312",
"user_phone" => "138171212", "user_phone" => "138171212",*/
"follow_content" => "1",
"pageNo" => 1, "pageNo" => 1,
"agent_id" => 5741,//传经纪人id代表我得客户 //"agent_id" => 5741,//传经纪人id代表我得客户
"pageSize" => 15, "pageSize" => 15,
"status" => -1, "status" => -1,
);*/ );
$field = "a.id as user_id,a.sex,a.user_name,a.user_phone,a.user_status,a.agent_id,a.create_time,a.industry_type,a.price_demand,a.area_demand,a.vip"; $field = "id as user_id,sex,user_name,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip";
$conditions = []; $conditions = [];
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo']; $pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize']; $pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$conditions["a.city"] = trim($this->city); $conditions["city"] = trim($this->city);
if (isset($params['user_status'])) { if (isset($params['user_status'])) {
$conditions['a.user_status'] = $params['user_status']; $conditions['user_status'] = $params['user_status'];
} else { } else {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
if (isset($params['user_id'])) { if (isset($params['user_id'])) {
$conditions['a.id'] = $params['user_id']; $conditions['id'] = $params['user_id'];
} }
if (isset($params['user_name'])) { if (isset($params['user_name'])) {
$conditions['a.user_name'] = array( "like", "%" . trim($params['user_name']) . "%" ); $conditions['user_name'] = array( "like", "%" . trim($params['user_name']) . "%" );
} }
if (isset($params['user_phone'])) { if (isset($params['user_phone'])) {
$conditions['a.user_phone'] = array( "like", "%" . trim($params['user_phone']) . "%" ); $conditions['user_phone'] = array( "like", "%" . trim($params['user_phone']) . "%" );
}
if (isset($params['follow_content'])) {
$conditions['b.content'] = array( "like", "%" . trim($params['follow_content']) . "%" );
} }
if (isset($params['yetai'])) { if (isset($params['yetai'])) {
$conditions['a.industry_type'] = array( "like", "%" . trim($params['yetai']) . "%" ); $conditions['industry_type'] = array( "like", "%" . trim($params['yetai']) . "%" );
} }
$area_start = isset($params['area_start']) ? $params['area_start'] : -1; $area_start = isset($params['area_start']) ? $params['area_start'] : -1;
$area_end = isset($params['area_end']) ? $params['area_end'] : -1; $area_end = isset($params['area_end']) ? $params['area_end'] : -1;
if ($area_start >= 0 && $area_end >= 0) { //面积 if ($area_start >= 0 && $area_end >= 0) { //面积
$conditions['a.area_demand'] = array( 'between', array( $area_start, $area_end ) ); $conditions['area_demand'] = array( 'between', array( $area_start, $area_end ) );
$conditions['a.area_demand'] = array( 'between', array( $area_start, $area_end ) ); $conditions['area_demand'] = array( 'between', array( $area_start, $area_end ) );
} else if ($area_start >= 0 && $area_end < 0) { //100米以上不用传结束面积 } else if ($area_start >= 0 && $area_end < 0) { //100米以上不用传结束面积
$conditions['a.area_demand'] = array( 'egt', $area_start ); $conditions['area_demand'] = array( 'egt', $area_start );
$conditions['a.area_demand'] = array( 'egt', $area_start ); $conditions['area_demand'] = array( 'egt', $area_start );
} }
$price_start = isset($params['money_start']) ? $params['money_start'] : -1; $price_start = isset($params['money_start']) ? $params['money_start'] : -1;
$price_end = isset($params['money_end']) ? $params['money_end'] : -1; $price_end = isset($params['money_end']) ? $params['money_end'] : -1;
if ($price_start >= 0 && $price_end >= 0) { //金额 if ($price_start >= 0 && $price_end >= 0) { //金额
$conditions['a.price_demand'] = array( 'between', array( $price_start, $price_end ) ); $conditions['price_demand'] = array( 'between', array( $price_start, $price_end ) );
} else if ($price_start >= 0 && $price_end < 0) { } else if ($price_start >= 0 && $price_end < 0) {
$conditions['a.price_demand'] = array( 'egt', $price_start ); $conditions['price_demand'] = array( 'egt', $price_start );
} }
if (isset($params['start_time']) && isset($params['end_time'])) { if (isset($params['start_time']) && isset($params['end_time'])) {
$start_time = date('Y-m-d H:i:s', $params['start_time']); $start_time = date('Y-m-d H:i:s', $params['start_time']);
$end_time = date('Y-m-d H:i:s', $params['end_time']); $end_time = date('Y-m-d H:i:s', $params['end_time']);
$conditions['a.create_time'] = array( 'between', array( $start_time, $end_time ) ); $conditions['create_time'] = array( 'between', array( $start_time, $end_time ) );
} else { } else {
$time_ = date('Y-m-d H:i:s', strtotime("-1 day")); $time_ = date('Y-m-d H:i:s', strtotime("-1 day"));
$conditions['a.create_time'] = array( 'lt', $time_ ); $conditions['create_time'] = array( 'lt', $time_ );
} }
if (isset($params['status'])) { if (isset($params['status'])) {
$conditions['a.status'] = $params['status']; $conditions['status'] = $params['status'];
} }
//传了经纪人id则表示我的客户 //传了经纪人id则表示我的客户
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$conditions['a.agent_id'] = $params['agent_id']; $conditions['agent_id'] = $params['agent_id'];
} }
$userList = $this->userModel->selectUserList($field, $conditions, $pageNo, $pageSize, "a.id desc"); $userList = $this->userModel->selectUserList($field, $conditions, $pageNo, $pageSize, "id desc");
if (empty($userList)) { if (empty($userList)) {
return $this->response("200", "此条件没有找到数据"); return $this->response("200", "此条件没有找到数据");
} }
...@@ -171,7 +166,7 @@ class User extends Basic ...@@ -171,7 +166,7 @@ class User extends Basic
} }
$vip_services = new VipService(); $vip_services = new VipService();
$data['examine_vip'] = $vip_services->vip($this->agentId); // $data['examine_vip'] = $vip_services->vip($this->agentId);
$data['user_date'] = $list; $data['user_date'] = $list;
return $this->response("200", 'request success', $data); return $this->response("200", 'request success', $data);
} }
......
...@@ -556,12 +556,10 @@ class Users extends Model ...@@ -556,12 +556,10 @@ class Users extends Model
->select(); ->select();
} }
public function selectUserList($field, $params, $pageNo, $pageSize, $order = " a.id desc") public function selectUserList($field, $params, $pageNo, $pageSize, $order = " id desc")
{ {
$result = Db::table($this->table) $result = Db::table($this->table)
->field($field) ->field($field)
->alias("a")
->join("u_phone_follow_up b", "a.id = b.user_id", "left")
->where($params) ->where($params)
->order($order) ->order($order)
->page($pageNo) ->page($pageNo)
......
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