Commit e3b5fc21 authored by clone's avatar clone

bug

parent 9bf9397f
...@@ -61,7 +61,7 @@ class User extends Basic ...@@ -61,7 +61,7 @@ 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
...@@ -70,69 +70,86 @@ class User extends Basic ...@@ -70,69 +70,86 @@ class User extends Basic
"money_end" => 10000,//租金 "money_end" => 10000,//租金
"start_time" => "2016-05-25", "start_time" => "2016-05-25",
"end_time" => "2018-05-30", "end_time" => "2018-05-30",
"user_id" => 1,
"user_name" => "12312",
"user_phone" => "138171212",
"follow_content" => "1",
"pageNo" => 1, "pageNo" => 1,
"agent_id" => 5741, "agent_id" => 5741,
"pageSize" => 15, "pageSize" => 15,
"status" => -1, "status" => -1,
);*/ );
$field = "id as user_id,sex,user_name,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip"; $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";
$conditions = []; $conditions = [];
$is_show = true;
$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["city"] = trim($this->city); $conditions["a.city"] = trim($this->city);
if (isset($params['user_status'])) { if (isset($params['user_status'])) {
$conditions['user_status'] = $params['user_status']; $conditions['a.user_status'] = $params['user_status'];
} else { } else {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
if (isset($params['user_id'])) {
$conditions['a.id'] = $params['user_id'];
}
if (isset($params['user_name'])) {
$conditions['a.user_name'] = array( "like", "%" . trim($params['user_name']) . "%" );
}
if (isset($params['user_phone'])) {
$conditions['a.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['industry_type'] = array( "like", "%" . trim($params['yetai']) . "%" ); $conditions['a.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['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 ) ); $conditions['a.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['area_demand'] = array( 'egt', $area_start ); $conditions['a.area_demand'] = array( 'egt', $area_start );
$conditions['area_demand'] = array( 'egt', $area_start ); $conditions['a.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['price_demand'] = array( 'between', array( $price_start, $price_end ) ); $conditions['a.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['price_demand'] = array( 'egt', $price_start ); $conditions['a.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['create_time'] = array( 'between', array( $start_time, $end_time ) ); $conditions['a.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['create_time'] = array( 'lt', $time_ ); $conditions['a.create_time'] = array( 'lt', $time_ );
} }
if (isset($params['status'])) { if (isset($params['status'])) {
$conditions['status'] = $params['status']; $conditions['a.status'] = $params['status'];
} }
//传了经纪人id则表示我的客户 //传了经纪人id则表示我的客户
if (isset($params["agent_id"])) { if (isset($params["agent_id"])) {
$conditions['agent_id'] = $params['agent_id']; $conditions['a.agent_id'] = $params['agent_id'];
$is_show = false;
} }
...@@ -140,9 +157,11 @@ class User extends Basic ...@@ -140,9 +157,11 @@ class User extends Basic
if (empty($userList)) { if (empty($userList)) {
return $this->response("200", "此条件没有找到数据"); return $this->response("200", "此条件没有找到数据");
} }
if($is_show){
$clientService = new ClientService();
$list = []; $list = [];
if (isset($params["agent_id"])) {
$list = $userList;
} else {
$clientService = new ClientService();
foreach ($userList as $k => $v) { foreach ($userList as $k => $v) {
$is_show = $clientService->dialTotal($v["user_id"]); $is_show = $clientService->dialTotal($v["user_id"]);
if ($is_show) { if ($is_show) {
...@@ -153,7 +172,7 @@ class User extends Basic ...@@ -153,7 +172,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'] = $userList; $data['user_date'] = $list;
return $this->response("200", 'request success', $data); return $this->response("200", 'request success', $data);
} }
......
...@@ -358,10 +358,10 @@ class Users extends Model ...@@ -358,10 +358,10 @@ class Users extends Model
if ($data['referrer_source'] == 20) { if ($data['referrer_source'] == 20) {
$agent = new AAgents(); $agent = new AAgents();
$referrer_user = $agent->field('name,phone')->find($data['user_id']); $referrer_user = $agent->field('name,phone')->find($data['user_id']);
$data['referrer_user'] = $referrer_user['name'] .'-'.$referrer_user['phone']; $data['referrer_user'] = $referrer_user['name'] . '-' . $referrer_user['phone'];
} elseif ($data['referrer_source'] == 10) { } elseif ($data['referrer_source'] == 10) {
$referrer_user = $this->field('user_name,user_phone')->find($data['user_id']); $referrer_user = $this->field('user_name,user_phone')->find($data['user_id']);
$data['referrer_user'] = $referrer_user['user_name'] .'-'.$referrer_user['user_phone']; $data['referrer_user'] = $referrer_user['user_name'] . '-' . $referrer_user['user_phone'];
} }
unset($data['other_pic']); unset($data['other_pic']);
...@@ -560,6 +560,8 @@ class Users extends Model ...@@ -560,6 +560,8 @@ class Users extends Model
{ {
$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)
...@@ -631,6 +633,7 @@ class Users extends Model ...@@ -631,6 +633,7 @@ class Users extends Model
->where($params) ->where($params)
->select(); ->select();
} }
public function getAgentByReferrer($field, $params) public function getAgentByReferrer($field, $params)
{ {
$result = Db::name($this->table) $result = Db::name($this->table)
...@@ -722,7 +725,7 @@ class Users extends Model ...@@ -722,7 +725,7 @@ class Users extends Model
$where_ = []; $where_ = [];
if (isset($params["buyer_id"])) { if (isset($params["buyer_id"])) {
$where_["buyer_id"] = $params["buyer_id"]; $where_["buyer_id"] = $params["buyer_id"];
}else{//防止传入错误参数修改掉大面积数据此字段必填 } else {//防止传入错误参数修改掉大面积数据此字段必填
return 0; return 0;
} }
if (isset($params["user_id"])) { if (isset($params["user_id"])) {
...@@ -741,14 +744,14 @@ class Users extends Model ...@@ -741,14 +744,14 @@ class Users extends Model
$data = $this $data = $this
->field($fields) ->field($fields)
->alias("a") ->alias("a")
->join("u_wx_info b","a.buyer_id=b.id","left") ->join("u_wx_info b", "a.buyer_id=b.id", "left")
->where($where_) ->where($where_)
->select(); ->select();
return $data; return $data;
} }
public function getLastOrNextUserID($where,$field,$limit,$order) public function getLastOrNextUserID($where, $field, $limit, $order)
{ {
$return = Db::name($this->table) $return = Db::name($this->table)
......
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