Commit 648724d6 authored by hujun's avatar hujun

修改客方跟进

parent 4bc5f77d
...@@ -245,13 +245,12 @@ class Client extends Basic ...@@ -245,13 +245,12 @@ class Client extends Basic
public function all_user() { public function all_user() {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$Two_days_ago = date("Y-m-d h:i:s",strtotime("-2 day")); $Two_days_ago = date("Y-m-d h:i:s",strtotime("-2 day"));
//dump($Two_days_ago);
$params = $this->params; $params = $this->params;
#测试数据 #测试数据
// $params['phone_or_name'] = '666' ; // $params['phone_or_name'] = '666' ;
// $params['pagenum'] = '1' ; // $params['pagenum'] = '1' ;
// $params['user_id'] = '10' ; // $params['user_id'] = 'user_id' ;
// $params['type'] = 0 ; // $params['type'] = 0 ;
// $params['search_type'] = '2' ; // $params['search_type'] = '2' ;
#测试数据 end #测试数据 end
...@@ -260,7 +259,6 @@ class Client extends Basic ...@@ -260,7 +259,6 @@ class Client extends Basic
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]); return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]);
} }
$phone_or_name = trim($params['phone_or_name']); $phone_or_name = trim($params['phone_or_name']);
$pagenum = isset($params['pagenum']) ? $params['pagenum'] : 1; $pagenum = isset($params['pagenum']) ? $params['pagenum'] : 1;
$pagesize = 15; $pagesize = 15;
...@@ -269,41 +267,40 @@ class Client extends Basic ...@@ -269,41 +267,40 @@ class Client extends Basic
$search_type = $params['search_type'];#无:'';客户电话:0;客户姓名:1;跟进:2; $search_type = $params['search_type'];#无:'';客户电话:0;客户姓名:1;跟进:2;
if($search_type == '0') if($search_type == '0')
{//客户电话 {
//客户电话
$conditions['user_phone'] = ['LIKE', $phone_or_name.'%']; $conditions['user_phone'] = ['LIKE', $phone_or_name.'%'];
}elseif ($search_type == '1'){//客户 }elseif ($search_type == '1'){//客户
$conditions['user_nick'] = ['LIKE', $phone_or_name.'%']; $conditions['user_nick'] = ['LIKE', $phone_or_name.'%'];
} }
if ($search_type != '2') if ($search_type != '2')
{//全部客户 {
//全部客户
if($search_type == ''){ if($search_type == ''){
if($type == '0') if($type == '0')
{//求租:0 ;已租:1 数据库0:求租;1:已租;-1:无效 {//求租:0 ;已租:1 数据库0:求租;1:已租;-1:无效
$conditions['user_status'] = 0; $conditions['user_status'] = 0;
}else{// }else{
$conditions['user_status'] = 1; $conditions['user_status'] = 1;
} }
} }
$user = new Users(); $user = new Users();
$user_res = $user->all_user($conditions,$pagesize,$pagenum); $user_res = $user->all_user($conditions,$pagesize,$pagenum);
$total = $user->all_user_count($conditions); $total = $user->all_user_count($conditions);
//dump($conditions);//exit; }else{
//跟进
}else{//跟进
$UPhoneFollowPp = new UPhoneFollowPp(); $UPhoneFollowPp = new UPhoneFollowPp();
$user_res = $UPhoneFollowPp->all_user_search($phone_or_name,$pagesize,$pagenum); $user_res = $UPhoneFollowPp->all_user_search($phone_or_name,$pagesize,$pagenum);
$total = $UPhoneFollowPp->all_user_search_count($phone_or_name); $total = $UPhoneFollowPp->all_user_search_count($phone_or_name);
//dump($total);exit;
} }
if($search_type!='2') if($search_type!='2')
{//全部客户数据处理 {
//全部客户数据处理
foreach($user_res as $k=>$v) foreach($user_res as $k=>$v)
{ {
$label=array(); $label = [];
//dump($v);exit;
$user_res[$k]['user_nick'] = $v['user_nick']?$v['user_nick']:'未知'; $user_res[$k]['user_nick'] = $v['user_nick']?$v['user_nick']:'未知';
if($user_id == $v['agent_id']) if($user_id == $v['agent_id'])
{ {
...@@ -314,6 +311,7 @@ class Client extends Basic ...@@ -314,6 +311,7 @@ class Client extends Basic
{ {
$label[] = '保护期内'; $label[] = '保护期内';
}*/ }*/
//无效客户不显示标签 //无效客户不显示标签
if($v['user_status'] != -1){ if($v['user_status'] != -1){
$user_res[$k]['label'] = implode(',',$label); $user_res[$k]['label'] = implode(',',$label);
...@@ -334,13 +332,13 @@ class Client extends Basic ...@@ -334,13 +332,13 @@ class Client extends Basic
} }
} }
/*dump($total);
var_dump($user_res);
exit;*/
$total = intval($total / $pagesize) + (($total % $pagesize == 0) ? 0 : 1); $total = intval($total / $pagesize) + (($total % $pagesize == 0) ? 0 : 1);
return $this->response("200", "success!", ['user_date'=>$user_res,'pagenum'=>$pagenum,'total'=>$total,'search_type'=>$search_type]); $data['user_date'] = $user_res;
$data['pagenum'] = $pagenum;
$data['total'] = $total;
$data['search_type'] = $search_type;
return $this->response("200", "success!", $data);
} }
/** /**
......
...@@ -198,6 +198,8 @@ class Member extends Basic{ ...@@ -198,6 +198,8 @@ class Member extends Basic{
$params['type'] = 1; $params['type'] = 1;
$params['user_status'] = $params['user_status']; $params['user_status'] = $params['user_status'];
$table->allowField(true)->save($params); $table->allowField(true)->save($params);
$user = new Users();
$user->update_user_status(['id'=>$params['user_id'],'user_status'=>$params['user_status']]);
return $this->response($status, $msg, $params); return $this->response($status, $msg, $params);
} }
......
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