Commit 5297f22d authored by clone's avatar clone

bug

parent 936276b9
......@@ -88,7 +88,7 @@ class User extends Basic
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$conditions["city"] = trim($this->city)?trim($this->city):'上海市';
$conditions["city"] = trim($this->city) ? trim($this->city) : '上海市';
if (isset($params['user_status'])) {
$conditions['user_status'] = $params['user_status'];
......@@ -150,36 +150,26 @@ class User extends Basic
if (empty($userList)) {
return $this->response("200", "此条件没有找到数据");
}
$list = [];
if (isset($params["agent_id"]) || isset($params["id"]) || isset($params["user_phone"])) {
$list = $userList;
} else {
$clientService = new ClientService();
foreach ($userList as $k => $v) {
$sign_call = 0;
$is_show = $clientService->dialTotal($v["user_id"]);
if ($is_show) {
array_push($list, $v);
}
}
$sign_call = 1;
}
foreach ($list as $k => $v) {
//判断客户是否超过24小时保护期间 0:保护器内 1:超过保护期
/* $ser = new UserExpiredTimeService();
$res = $ser->getExpiredTimeByUser($v["user_id"]);
$list[$k]['is_outstrip_twenty_four_hours']=$res ? 0 : 1 ;*/
$is_outstrip_twenty_four_hours = 0;
if((time() - strtotime($v['create_time'])) > (60*60*24)){
if ((time() - strtotime($v['create_time'])) > (60 * 60 * 24)) {
$is_outstrip_twenty_four_hours = 1;
}
$list[$k]['is_outstrip_twenty_four_hours']=$is_outstrip_twenty_four_hours;
$userList[$k]['sign_call'] = $sign_call;
$userList[$k]['is_outstrip_twenty_four_hours'] = $is_outstrip_twenty_four_hours;
}
$vip_services = new VipService();
$data['examine_vip'] = $vip_services->vip($this->agentId);
$data['user_date'] = $list;
$data['user_date'] = $userList;
$data['total_page'] = count($userList);
return $this->response("200", 'request success', $data);
}
......@@ -215,20 +205,20 @@ class User extends Basic
$where['a.status'] = -1;
}
} else {
$where['a.status'] = ['<>', 1];
$where['a.status'] = [ '<>', 1 ];
}
//客户手机号
if (!empty($params['phone'])) {
$if_search_user = true;
//$where[0] = ['EXP','a.user_phone LIKE "%'.$this->params['phone'].'%" or a.user_nick LIKE "%'.$this->params['phone'].'%"'];
$where['a.user_phone'] = ['LIKE','%'.$params['phone'].'%'];
$where['a.user_phone'] = [ 'LIKE', '%' . $params['phone'] . '%' ];
}
if (!empty($params['user_nick'])) {
$if_search_user = true;
//$where[0] = ['EXP','a.user_phone LIKE "%'.$this->params['phone'].'%" or a.user_nick LIKE "%'.$this->params['phone'].'%"'];
$where['a.user_name'] = ['LIKE','%'.$params['user_nick'].'%'];
$where['a.user_name'] = [ 'LIKE', '%' . $params['user_nick'] . '%' ];
}
//是否公客
......@@ -236,13 +226,13 @@ class User extends Basic
if ($params['public_user'] == 1) {
$where['a.agent_id'] = 0;
} else {
$where['a.agent_id'] = ['>', 0];
$where['a.agent_id'] = [ '>', 0 ];
}
}
//邀请人
if (!empty($params['invite_phone'])) {
$where['a.referrer_id'] = ['NOT NULL']; //覆盖上面的值
$where['a.referrer_id'] = [ 'NOT NULL' ]; //覆盖上面的值
$referrer_id = $this->userModel->findUserByPhone('id', $params['invite_phone']);
$where['a.referrer_id'] = $referrer_id['id'];//覆盖上面的值
$where['referrer_source'] = 10;
......@@ -251,12 +241,12 @@ class User extends Basic
//创建开始时间
if (!empty($params['start_date']) && empty($params['end_date'])) {
$where['a.create_time'] = ['> time', $params['start_date'] . '00:00:00'];
}elseif (!empty($params['end_date']) && empty($params['start_date'])) {
$where['a.create_time'] = ['< time', $params['end_date'] . '23:59:59'];
}elseif (!empty($params['start_date']) && !empty($params['end_date'])) {
$where['a.create_time'] = ['between time', [$params['start_date']. ' 00:00:00', $params['end_date'] . ' 23:59:59']];
}else{
$where['a.create_time'] = [ '> time', $params['start_date'] . '00:00:00' ];
} elseif (!empty($params['end_date']) && empty($params['start_date'])) {
$where['a.create_time'] = [ '< time', $params['end_date'] . '23:59:59' ];
} elseif (!empty($params['start_date']) && !empty($params['end_date'])) {
$where['a.create_time'] = [ 'between time', [ $params['start_date'] . ' 00:00:00', $params['end_date'] . ' 23:59:59' ] ];
} else {
if (empty($params['id']) && empty($params['phone'])) {
$time_ = date('Y-m-d H:i:s', strtotime("-1 day"));
$where['a.create_time'] = array( 'lt', $time_ );
......@@ -265,19 +255,19 @@ class User extends Basic
//跟进结束时间
if (!empty($params['follow_start']) && empty($params['follow_end'])) {
$where['b.create_time'] = ['> time',$params['follow_start']. ' 00:00:00'];
$where['b.create_time'] = [ '> time', $params['follow_start'] . ' 00:00:00' ];
$type = 2;
}
//跟进时间
if (!empty($params['follow_end']) && empty($params['follow_start'])) {
$where['b.create_time'] = ['< time',$params['follow_end']. ' 23:59:59'];
$where['b.create_time'] = [ '< time', $params['follow_end'] . ' 23:59:59' ];
$type = 2;
}
//跟进时间
if (!empty($params['follow_start']) && !empty($params['follow_end'])) {
$where['b.create_time'] = ['between time', [$params['follow_start']. ' 00:00:00', $params['follow_end'] . ' 23:59:59']];
$where['b.create_time'] = [ 'between time', [ $params['follow_start'] . ' 00:00:00', $params['follow_end'] . ' 23:59:59' ] ];
$type = 2;
}
......@@ -290,9 +280,9 @@ class User extends Basic
//是否登录过
if (!empty($params['login_status']) && $params['login_status'] != -1) {
if ($params['login_status'] == 1) {
$where[] = ['EXP', 'a.first_login_time IS NOT NULL OR a.last_login_time IS NOT NULL'];
$where[] = [ 'EXP', 'a.first_login_time IS NOT NULL OR a.last_login_time IS NOT NULL' ];
} else {
$where['a.first_login_time'] = ['NULL'];
$where['a.first_login_time'] = [ 'NULL' ];
}
}
......@@ -303,17 +293,17 @@ class User extends Basic
//注册时间
if (!empty($params['registration_start']) && empty($params['registration_end'])) {
$where['a.registration_time'] = ['< time',$params['registration_start']. ' 23:59:59'];
$where['a.registration_time'] = [ '< time', $params['registration_start'] . ' 23:59:59' ];
}
//注册时间
if (!empty($params['registration_end']) && empty($params['registration_start'])) {
$where['a.registration_time'] = ['< time',$params['registration_end']. ' 23:59:59'];
$where['a.registration_time'] = [ '< time', $params['registration_end'] . ' 23:59:59' ];
}
//注册时间
if (!empty($params['registration_start']) && !empty($params['registration_end'])) {
$where['a.registration_time'] = ['between time', [$params['registration_start']. ' 00:00:00', $params['registration_end'] . ' 23:59:59']];
$where['a.registration_time'] = [ 'between time', [ $params['registration_start'] . ' 00:00:00', $params['registration_end'] . ' 23:59:59' ] ];
$type = 2;
}
......@@ -326,13 +316,16 @@ class User extends Basic
if (!empty($params['area_type'])) {
switch ($params['area_type']) {
case 1 :
$where['a.area_demand'] = ['<=', 30];break;
$where['a.area_demand'] = [ '<=', 30 ];
break;
case 2 :
$where['a.area_demand'] = ['between', [30,60]];break;
$where['a.area_demand'] = [ 'between', [ 30, 60 ] ];
break;
case 4 :
$where['a.area_demand'] = ['between', [60,100]];break;
$where['a.area_demand'] = [ 'between', [ 60, 100 ] ];
break;
default :
$where['a.area_demand'] = ['>', 100];
$where['a.area_demand'] = [ '>', 100 ];
}
}
......@@ -340,11 +333,13 @@ class User extends Basic
if (!empty($params['price_type'])) {
switch ($params['price_type']) {
case 1 :
$where['a.price_demand'] = ['<=', 10000];break;
$where['a.price_demand'] = [ '<=', 10000 ];
break;
case 2 :
$where['a.price_demand'] = ['between', [10000,30000]];break;
$where['a.price_demand'] = [ 'between', [ 10000, 30000 ] ];
break;
default :
$where['a.price_demand'] = ['>', 30000];
$where['a.price_demand'] = [ '>', 30000 ];
}
}
......@@ -408,7 +403,7 @@ class User extends Basic
}
if (!empty($params['first_login_start']) && !empty($params['first_login_end'])) {
$where['a.first_login_time'] = ['between time', [$params['first_login_start'] . ' 00:00:00', $where['a.first_login_time'] = $params['first_login_end'] . ' 23:59:59']];
$where['a.first_login_time'] = [ 'between time', [ $params['first_login_start'] . ' 00:00:00', $where['a.first_login_time'] = $params['first_login_end'] . ' 23:59:59' ] ];
}
if (isset($params['vip']) && $params['vip'] != -1) {
......@@ -425,9 +420,9 @@ class User extends Basic
if (!empty($params['city'])) {
$where['a.city'] = $params['city'];
}else{
} else {
// 判断是 杭州还是上海
$where['a.city'] = trim($this->city)? trim($this->city) :'上海市';
$where['a.city'] = trim($this->city) ? trim($this->city) : '上海市';
}
if (!empty($params['disc'])) {
......@@ -435,8 +430,6 @@ class User extends Basic
}
if ($params['type'] == 'last') {
$where['id'] = [ 'gt', $params['user_id'] ];
$order = 'id asc';
......@@ -447,34 +440,34 @@ class User extends Basic
}
$field = 'id,user_nick,agent_id,vip,create_time';
$user = new Users();
$user_res = $user->getLastOrNextUserID($where, $field, $limit = 1, $order,$type);
$user_res = $user->getLastOrNextUserID($where, $field, $limit = 1, $order, $type);
if (!$user_res) {
return $this->response("201", "查无数据", ['user_id'=>$params['user_id']]);
return $this->response("201", "查无数据", [ 'user_id' => $params['user_id'] ]);
}
// 判断当天被拨打是否超过5次
$clientService = new ClientService();
if (!$clientService->dialTotal($user_res[0]['id'])) {
return $this->response("201", "当天被拨打超过5次", ['user_id'=>$user_res[0]['id']]);
return $this->response("201", "当天被拨打超过5次", [ 'user_id' => $user_res[0]['id'] ]);
}
//如果非客方
if($user_res[0]['agent_id'] != $params['agent_id']){
if ($user_res[0]['agent_id'] != $params['agent_id']) {
// 判断是否vip客户,如果是 只有是当前经纪人自己的客户才能查看
//vip客户 0:否 1:是
$vip_services = new VipService();
$examine_vip= $vip_services->vip($params['agent_id']);
$examine_vip = $vip_services->vip($params['agent_id']);
if (($user_res[0]['vip'] == 1)) {
if (($examine_vip == 1)) {
return $this->response("201", "vip 非客方", ['user_id'=>$user_res[0]['id']]);
return $this->response("201", "vip 非客方", [ 'user_id' => $user_res[0]['id'] ]);
}
}
// 判断是否24小时保护期内
if((time() - strtotime($user_res[0]['create_time'])) < (60*60*24)){
return $this->response("201", "24小时保护期内", ['user_id'=>$user_res[0]['id']]);
if ((time() - strtotime($user_res[0]['create_time'])) < (60 * 60 * 24)) {
return $this->response("201", "24小时保护期内", [ 'user_id' => $user_res[0]['id'] ]);
}
}
......@@ -515,20 +508,19 @@ class User extends Basic
// );
$last_month = date("Y-m-d", strtotime("-1 month"));
if (!empty($this->params['start_date']) && empty($this->params['end_date'])) {
if (strtotime($last_month) > strtotime($this->params['start_date'])) {
$where['a.create_time'] = ['> time', $last_month. ' 00:00:00'];
$where['a.create_time'] = [ '> time', $last_month . ' 00:00:00' ];
} else {
$where['a.create_time'] = ['> time', $this->params['start_date']. ' 00:00:00'];
$where['a.create_time'] = [ '> time', $this->params['start_date'] . ' 00:00:00' ];
}
} else {
$where['a.create_time'] = ['> time', $last_month. ' 00:00:00'];
$where['a.create_time'] = [ '> time', $last_month . ' 00:00:00' ];
}
if (!empty($this->params['end_date']) && empty($this->params['start_date'])) {
$where['a.create_time'] = ['< time', $this->params['end_date']. ' 23:59:59'];;
$where['a.create_time'] = [ '< time', $this->params['end_date'] . ' 23:59:59' ];;
}
if (!empty($this->params['end_date']) && !empty($this->params['start_date'])) {
......@@ -537,11 +529,11 @@ class User extends Basic
} else {
$start_date = $this->params['start_date'];
}
$where['a.create_time'] = ['between',[$start_date.' 00:00:00',$this->params['end_date']. ' 23:59:59']];
$where['a.create_time'] = [ 'between', [ $start_date . ' 00:00:00', $this->params['end_date'] . ' 23:59:59' ] ];
}
if (!empty($this->params['content'])) {
$where['a.content'] = ['LIKE',"%{$this->params['content']}%"];
$where['a.content'] = [ 'LIKE', "%{$this->params['content']}%" ];
}
//跟进人名字
......@@ -549,7 +541,7 @@ class User extends Basic
if (mb_strlen($this->params['remark_name']) < 2) {
// return $this->response(101, '名字长度不足2位');
}
$agent_where['a.name'] = ['LIKE', '%'.$this->params['remark_name'].'%'];
$agent_where['a.name'] = [ 'LIKE', '%' . $this->params['remark_name'] . '%' ];
}
//跟进人手机号
......@@ -589,13 +581,13 @@ class User extends Basic
if (empty($agent_id_arr)) {
$data['data']['list'] = [];
return $this->response(200,'', $data); //处理经纪人空数据
return $this->response(200, '', $data); //处理经纪人空数据
} else {
$agent_id = [];
foreach ($agent_id_arr as $K=>$v) {
foreach ($agent_id_arr as $K => $v) {
$agent_id[] = $v['id'];
}
$where['a.agent_id'] = ['in', $agent_id];
$where['a.agent_id'] = [ 'in', $agent_id ];
}
}
......@@ -613,7 +605,7 @@ class User extends Basic
$model_res = $model->getLastOrNextUserIDPhoneFollowP($where, $field, $limit = 1, $order);
if (!$model_res) {
return $this->response("201", "查无数据", ['id'=>$params['id']]);
return $this->response("201", "查无数据", [ 'id' => $params['id'] ]);
}
// 判断当天被拨打是否超过5次
......@@ -623,22 +615,22 @@ class User extends Basic
// }
//如果非客方
if($model_res[0]['agent_id'] != $params['agent_id']){
if ($model_res[0]['agent_id'] != $params['agent_id']) {
// 判断是否vip客户,如果是 只有是当前经纪人自己的客户才能查看
//vip客户 0:否 1:是
$vip_services = new VipService();
$examine_vip= $vip_services->vip($params['agent_id']);
$examine_vip = $vip_services->vip($params['agent_id']);
if (($model_res[0]['vip'] == 1)) {
if (($examine_vip == 1)) {
return $this->response("201", "vip 非客方", ['id'=>$model_res[0]['id']]);
return $this->response("201", "vip 非客方", [ 'id' => $model_res[0]['id'] ]);
}
}
// 判断是否24小时保护期内
if((time() - strtotime($model_res[0]['create_time'])) < (60*60*24)){
return $this->response("201", "24小时保护期内", ['id'=>$model_res[0]['id']]);
if ((time() - strtotime($model_res[0]['create_time'])) < (60 * 60 * 24)) {
return $this->response("201", "24小时保护期内", [ 'id' => $model_res[0]['id'] ]);
}
}
// dump($model_res);exit();
......@@ -650,7 +642,7 @@ class User extends Basic
} else {
$start_date = $this->params['start_date'];
}
$where['a.create_time'] = ['between',[$start_date.' 00:00:00',$this->params['end_date']. ' 23:59:59']];
$where['a.create_time'] = [ 'between', [ $start_date . ' 00:00:00', $this->params['end_date'] . ' 23:59:59' ] ];
}
$field = 'max(a.id) as max_id';
$order = 'a.id asc';
......
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