Commit f39d740b authored by hujun's avatar hujun

修改用户列表

parent b6cfe8ca
...@@ -20,79 +20,83 @@ use think\Session; ...@@ -20,79 +20,83 @@ use think\Session;
class Remark extends Basic class Remark extends Basic
{ {
/**
* 跟进主界面
*
* @return \think\response\View
*/
public function remarkFollowIndex(){
return view('remark_follow_index');
}
//跟进主界面 /**
public function remarkFollowIndex(){ * 跟进列表
return view('remark_follow_index'); *
}
/**跟进列表
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function RemarkFollowList(){ public function RemarkFollowList(){
$table= new Remarks; $table= new Remarks;
$data['status'] = 200; $data['status'] = 200;
$data['msg'] = ''; $data['msg'] = '';
//获取当前模块可操作按钮start******************************** //获取当前模块可操作按钮start********************************
$userRule = Session::get('userRule'); $userRule = Session::get('userRule');
$data['cz']=$userRule['cz']; $data['cz']=$userRule['cz'];
//获取当前模块可操作按钮end********************************** //获取当前模块可操作按钮end**********************************
$params = $this->request->param(); $params = $this->request->param();
//获取操作权限 //获取操作权限
$userRule=Session::get('userRule'); $userRule=Session::get('userRule');
$data['userRule']=$userRule; $data['userRule']=$userRule;
$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'];
//条件 //条件
$where="r.isinstatus=1 and r.content like '%【跟进】%' "; $where="r.isinstatus=1 and r.content like '%【跟进】%' ";
//--查询条件 //--查询条件
//----跟进内容 //----跟进内容
if(!empty($params['content'])){ if(!empty($params['content'])){
$where.=" and r.content like '%{$params['content']}%'"; $where.=" and r.content like '%{$params['content']}%'";
} }
//----客户手机号 //----客户手机号
if(!empty($params['phone'])){ if(!empty($params['phone'])){
$where.=" and a.phpone like '%{$params['phone']}%'"; $where.=" and a.phpone like '%{$params['phone']}%'";
} }
//----客户姓名 //----客户姓名
if(!empty($params['customer'])){ if(!empty($params['customer'])){
$where.=" and a.customer like '%{$params['customer']}%'"; $where.=" and a.customer like '%{$params['customer']}%'";
} }
//----时间选择 //----时间选择
if(!empty($params['start_time']) && !empty($params['end_time'])){ if(!empty($params['start_time']) && !empty($params['end_time'])){
$where .= " and r.created (BETWEEN '{$params['start_time']} 00:00:00' and '{$params['start_time']} 23:59:59')"; $where .= " and r.created (BETWEEN '{$params['start_time']} 00:00:00' and '{$params['start_time']} 23:59:59')";
}else if(!empty($params['start_time']) && empty($params['end_time'])){ }else if(!empty($params['start_time']) && empty($params['end_time'])){
$where .= " and '{$params['start_time']} 00:00:00' <= r.created "; $where .= " and '{$params['start_time']} 00:00:00' <= r.created ";
}else if(empty($params['start_time']) && !empty($params['end_time'])){ }else if(empty($params['start_time']) && !empty($params['end_time'])){
$where .= " and '{$params['end_time']} 00:00:00' >= r.created "; $where .= " and '{$params['end_time']} 00:00:00' >= r.created ";
} }
$field = "r.id,r.apply_id,r.shopuser_id,r.content,r.house_id,r.created,r.admin, $field = "r.id,r.apply_id,r.shopuser_id,r.content,r.house_id,r.created,r.admin,
a.customer,a.phpone,a.sex, a.customer,a.phpone,a.sex,
a2.realname"; a2.realname";
$order = 'r.id asc'; $order = 'r.id asc';
$join = [ $join = [
['applies a', ' a.id=r.apply_id','left'], ['applies a', ' a.id=r.apply_id','left'],
['agents a2','a2.id=r.shopuser_id','left'] ['agents a2','a2.id=r.shopuser_id','left']
]; ];
$data['list'] = $table->getListJoin($pageNo, $pageSize,$order,$field,$join, $where); $data['list'] = $table->getListJoin($pageNo, $pageSize,$order,$field,$join, $where);
$data['total'] = $table->getTotal2($join,$where); $data['total'] = $table->getTotal2($join,$where);
// prt($list);//转化arr // prt($list);//转化arr
//prt(collection($list)->toArray());//转化arr //prt(collection($list)->toArray());//转化arr
return $this->response(200,'成功',$data); return $this->response(200,'成功',$data);
}
}
/** /**
* @return \think\Response * @return \think\Response
...@@ -100,29 +104,29 @@ class Remark extends Basic ...@@ -100,29 +104,29 @@ class Remark extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function contentList(){ /**
$table= new Remarks; * @return \think\Response
$data['status'] = 200; * @throws \think\db\exception\DataNotFoundException
$data['msg'] = ''; * @throws \think\db\exception\ModelNotFoundException
$params = $this->request->param(); * @throws \think\exception\DbException
$applyId=$params['apply_id']; */
if($applyId){ public function contentList(){
//条件 $table= new Remarks;
$field='id,apply_id,shopuser_id,content,house_id,created,admin,'; $data['status'] = 200;
$where="isinstatus=1 and content like '%【跟进】%' and apply_id='{$applyId}'"; $data['msg'] = '';
$data['list'] = $table->field($field)->where($where)->select(); $params = $this->request->param();
$applyId=$params['apply_id'];
}else{ if($applyId){
return $this->response(100,'失败,没有apply_id',$data); //条件
$field='id,apply_id,shopuser_id,content,house_id,created,admin,';
$where="isinstatus=1 and content like '%【跟进】%' and apply_id='{$applyId}'";
$data['list'] = $table->field($field)->where($where)->select();
}else{
return $this->response(100,'失败,没有apply_id',$data);
}
return $this->response(200,'成功',$data);
} }
return $this->response(200,'成功',$data);
}
/** /**
* 客户动态展示加搜索加客户详情 * 客户动态展示加搜索加客户详情
* *
...@@ -134,14 +138,7 @@ class Remark extends Basic ...@@ -134,14 +138,7 @@ class Remark extends Basic
public function useraction_search() public function useraction_search()
{ {
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $params = $this->params;
$params['user_id'] ='1';
// if (!isset($params['user_id'])) {
// return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]);
// }
$searchdate = $params['searchdate']; $searchdate = $params['searchdate'];
$pagenum = isset($params['pagenum']) ? $params['pagenum'] : 1; $pagenum = isset($params['pagenum']) ? $params['pagenum'] : 1;
$pagesize = 15; $pagesize = 15;
...@@ -149,46 +146,33 @@ class Remark extends Basic ...@@ -149,46 +146,33 @@ class Remark extends Basic
$UPhoneFollowPp = new UPhoneFollowPp(); $UPhoneFollowPp = new UPhoneFollowPp();
// 查询电话跟进数据 // 查询电话跟进数据
$UPhoneFollowPp_res=$UPhoneFollowPp->select_useraction_search($user_id,$searchdate); $UPhoneFollowPp_res = $UPhoneFollowPp->select_useraction_search($user_id,$searchdate);
//var_dump($UPhoneFollowPp_res);
/*dump($total);
var_dump($user_res);
exit;*/
//dump($UPhoneFollowPp_res);
foreach($UPhoneFollowPp_res as $k=>$v){ foreach($UPhoneFollowPp_res as $k=>$v){
$table= new AAgents(); $table = new AAgents();
$Agents_res =$table->Agents_res($v['agent_id']); $Agents_res = $table->Agents_res($v['agent_id']);
//dump($Agents_res); $UPhoneFollowPp_res[$k]['agentinfo'] = $Agents_res?$Agents_res['store_name'].'-'.$Agents_res['name']:'未知';
$UPhoneFollowPp_res[$k]['agentinfo']=$Agents_res?$Agents_res['store_name'].'-'.$Agents_res['name']:'未知'; $UPhoneFollowPp_res[$k]['user_pic'] = AGENTHEADERIMGURL.$Agents_res['img'];
$UPhoneFollowPp_res[$k]['user_pic']=AGENTHEADERIMGURL.$Agents_res['img']; $UPhoneFollowPp_res[$k]['label'] = '';
$UPhoneFollowPp_res[$k]['label']='';
//dump($v['labels_id']);
//电话跟进标签 //电话跟进标签
if($v['labels_id']){ if($v['labels_id']){
$table= new ULabels(); $table= new ULabels();
$table_res =$table->get_labelsname($v['labels_id']); $table_res = $table->get_labelsname($v['labels_id']);
//dump($table_res); $UPhoneFollowPp_res[$k]['label'] = $table_res[0]['name'];
//exit;
$UPhoneFollowPp_res[$k]['label']=$table_res[0]['name'];
} }
} }
$user = new Users(); $user = new Users();
$user_res =$user->useraction_search_user_res($user_id); $user_res = $user->useraction_search_user_res($user_id);
//dump($user_res); $user_res['user_pic'] = HEADERIMGURL.$user_res['user_pic'];
$user_res['user_pic']=HEADERIMGURL.$user_res['user_pic']; $table = new AAgents();
$table= new AAgents(); $Agents_res = $table->Agents_res($user_res['agent_id']);
$Agents_res =$table->Agents_res($user_res['agent_id']);
//dump($Agents_res); $user_res['agentinfo'] = $Agents_res?$Agents_res['name'].'/'.$Agents_res['phone']:'未知';
$user_res['agentinfo']=$Agents_res?$Agents_res['name'].'/'.$Agents_res['phone']:'未知';
$records = new GOperatingRecords(); $records = new GOperatingRecords();
$records_result = $records->user_history($user_id); $records_result = $records->user_history($user_id);
//dump($records_result);
//dump($user_id);
return $this->response("200", "success!", ['user_info'=>$user_res,'user_date'=>$UPhoneFollowPp_res,'user_history'=>$records_result]); return $this->response("200", "success!", ['user_info'=>$user_res,'user_date'=>$UPhoneFollowPp_res,'user_history'=>$records_result]);
} }
...@@ -257,6 +241,4 @@ class Remark extends Basic ...@@ -257,6 +241,4 @@ class Remark extends Basic
//dump($total); //dump($total);
return $this->response("200", "success!", ['user_date'=>$UPhoneFollowPp_res,'pagenum'=>$pagenum,'total'=>$total]); return $this->response("200", "success!", ['user_date'=>$UPhoneFollowPp_res,'pagenum'=>$pagenum,'total'=>$total]);
} }
} }
\ No newline at end of file
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