Commit 36c1c999 authored by clone's avatar clone

bug

parent 61ee8b32
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\ClientService;
use app\api_broker\service\PushMessageService; use app\api_broker\service\PushMessageService;
use app\model\AAgents; use app\model\AAgents;
use app\model\ULabels; use app\model\ULabels;
...@@ -25,7 +24,7 @@ class Client extends Basic ...@@ -25,7 +24,7 @@ class Client extends Basic
protected $user; protected $user;
protected $data = []; protected $data = [];
protected $code = 200; protected $code = 200;
protected $msg = ''; protected $msg = '';
function __construct($request = null) function __construct($request = null)
{ {
...@@ -33,8 +32,7 @@ class Client extends Basic ...@@ -33,8 +32,7 @@ class Client extends Basic
$this->user = new Users(); $this->user = new Users();
} }
public function selectUser() public function selectUser(){
{
} }
...@@ -46,8 +44,7 @@ class Client extends Basic ...@@ -46,8 +44,7 @@ class Client extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function editClient() public function editClient() {
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
if (empty($this->params['user_name'])) { if (empty($this->params['user_name'])) {
...@@ -67,15 +64,15 @@ class Client extends Basic ...@@ -67,15 +64,15 @@ class Client extends Basic
//是否修改客方 //是否修改客方
if ($this->params['agents_id'] != $user_agent_id['agent_id']) { if ($this->params['agents_id'] != $user_agent_id['agent_id']) {
$agent = new AAgents(); $agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']); $agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '修改为' . $agent_data['name'] . '-' . $agent_data['phone']; $remark = '修改为'.$agent_data['name'].'-'.$agent_data['phone'];
$push = new PushMessageService(); $push = new PushMessageService();
$ccr_agent_data = $agent->getAgentInfo('name,phone', $this->params['ccr_id']); $ccr_agent_data = $agent->getAgentInfo('name,phone', $this->params['ccr_id']);
$content = "【{$ccr_agent_data['name']}-{$ccr_agent_data['phone']}修改了{$user_agent_id['user_name']}(id:{$user_agent_id['id']})客方】"; $content = "【{$ccr_agent_data['name']}-{$ccr_agent_data['phone']}修改了{$user_agent_id['user_name']}(id:{$user_agent_id['id']})客方】";
$push->pushMessageById($user_agent_id['agent_id'], '客方修改', $content, 'user_info', $user_agent_id['id']); $push->pushMessageById($user_agent_id['agent_id'], '客方修改', $content, 'user_info', $user_agent_id['id']);
$this->operating_records($this->params['ccr_id'], $type = 3, $remark, 0, $this->params['id']); $this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$this->params['id']);
} }
} else { } else {
$table = new AAgents(); $table = new AAgents();
...@@ -84,26 +81,23 @@ class Client extends Basic ...@@ -84,26 +81,23 @@ class Client extends Basic
$data['start'] = $this->user->edit($this->params); $data['start'] = $this->user->edit($this->params);
if ($data['start'] > 0) { if ($data['start'] > 0) {
$data['id'] = $this->user->id; $data['id']= $this->user->id;
$agent_data = $table->getAgentInfo('name,phone', $this->params['agents_id']); $agent_data = $table->getAgentInfo('name,phone',$this->params['agents_id']);
$remark = '新增为' . $agent_data['name'] . '-' . $agent_data['phone']; $remark = '新增为'. $agent_data['name'].'-'.$agent_data['phone'];
$this->operating_records($this->params['ccr_id'], $type = 3, $remark, 0, $data['id']); $this->operating_records($this->params['ccr_id'], $type=3, $remark,0,$data['id']);
} }
} }
switch ($data['start']) { switch ($data['start']) {
case -1 : case -1 :
$this->code = 101; $this->code = 101;
$this->msg = '该用户已存在'; $this->msg = '该用户已存在';break;
break;
case -2 : case -2 :
$this->code = 101; $this->code = 101;
$this->msg = '此号码为虚拟号码'; $this->msg = '此号码为虚拟号码';break;
break;
case -3 : case -3 :
$this->code = 101; $this->code = 101;
$this->msg = '没有新增VIP权限'; $this->msg = '没有新增VIP权限';break;
break;
} }
} else { } else {
...@@ -125,32 +119,31 @@ class Client extends Basic ...@@ -125,32 +119,31 @@ class Client extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function agentSearch() public function agentSearch(){
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$agent = new AAgents(); $agent = new AAgents();
$data['msg'] = ''; $data['msg'] = '';
$params = $this->request->param(); $params = $this->request->param();
$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 = 'status <> 2'; $where = 'status <> 2';
if ($this->params['search']) { if ($this->params['search']) {
$where .= ' AND concat(phone,name) like "%' . $this->params['search'] . '%"'; $where .= ' AND concat(phone,name) like "%'.$this->params['search'].'%"';
} }
if ($this->params['level']) { if ($this->params['level']) {
$where .= ' AND level in (' . $this->params['level'] . ')'; $where .= ' AND level in ('.$this->params['level'].')';
} }
if ($where) { if ($where) {
$field = 'id,name as realname,phone'; $field = 'id,name as realname,phone';
$data['list'] = $agent->getList($pageNo, $pageSize, 'id DESC', $field, '', $where); $data['list'] = $agent->getList($pageNo, $pageSize, 'id DESC', $field, '',$where);
$total = $agent->getTotal($where); $total = $agent->getTotal($where);
$data['total'] = ceil($total / $pageSize); $data['total'] = ceil($total / $pageSize);
$data['page'] = $pageNo; $data['page'] = $pageNo;
$msg = '成功'; $msg = '成功';
} else { } else {
$msg = '没有经纪人信息'; $msg = '没有经纪人信息';
} }
...@@ -164,81 +157,73 @@ class Client extends Basic ...@@ -164,81 +157,73 @@ class Client extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function agentUserTb() public function agentUserTb(){
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$table = new Users; $table = new Users;
$data['msg'] = ''; $data['msg'] = '';
$time = date("Y-m-d H:i:s", time());//当前时间 $time = date("Y-m-d H:i:s",time());//当前时间
$params = $this->request->param(); $params = $this->request->param();
/*$params['type'] = 0; /*$params['type'] = 0;
$params['agent_id'] = '5741';*/ $params['agent_id'] = '5741';*/
if (empty($params['agent_id'])) { if(empty($params['agent_id'])){
return $this->response(100, '参数不全'); return $this->response(100,'参数不全');
} }
$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'];
$type = $params['type'] ? $params['type'] : 0; $type = $params['type']? $params['type'] : 0;
//条件 //条件
//time_minute_diff 时间差(分)48小时内增加的【拥有经纪人】的客户为--受保护客户 //time_minute_diff 时间差(分)48小时内增加的【拥有经纪人】的客户为--受保护客户
$field = [ 'id as user_id', 'user_name', 'user_phone', 'agent_id', 'referrer_id', 'create_time', "TIMESTAMPDIFF(MINUTE,create_time,'{$time}')as time_minute_diff", 'vip' ]; $field = ['id as user_id','user_name','user_phone','agent_id','referrer_id','create_time',"TIMESTAMPDIFF(MINUTE,create_time,'{$time}')as time_minute_diff",'vip'];
$where = " agent_id in({$params['agent_id']}) and user_status={$type}"; $where = " agent_id in({$params['agent_id']}) and user_status={$type}";
if (!empty($params['search'])) { if(!empty($params['search'])){
//搜索客户--可以搜索自己的客户and 不在保护期的客户 //搜索客户--可以搜索自己的客户and 不在保护期的客户
// $where = " (agent_id in(0,{$params['agent_id']}) or agent_id is null or TIMESTAMPDIFF(MINUTE,create_time,'{$time}') > 2880 ) // $where = " (agent_id in(0,{$params['agent_id']}) or agent_id is null or TIMESTAMPDIFF(MINUTE,create_time,'{$time}') > 2880 )
// and ( user_nick like '%{$params['search']}%' or user_phone like '%{$params['search']}%' ) "; // and ( user_nick like '%{$params['search']}%' or user_phone like '%{$params['search']}%' ) ";
$where = "agent_id in({$params['agent_id']} ) $where = "agent_id in({$params['agent_id']} )
and ( user_name like '%{$params['search']}%' or user_phone like '%{$params['search']}%' ) "; and ( user_name like '%{$params['search']}%' or user_phone like '%{$params['search']}%' ) ";
$data['search'] = $params['search']; $data['search'] = $params['search'];
} }
$list = $table->getAgentUserTb($pageNo, $pageSize, 'id desc', $field, $where);
$clientService = new ClientService();
foreach ($list as $k=>$v){
$is_show = $clientService->dialTotal($v["user_id"]);
if (!$is_show) {
unset($list[$k]);
}
}
$data['list'] = $table->getAgentUserTb($pageNo, $pageSize,'id desc',$field, $where);
$data['list'] = array_merge($list); $total = $table->getMyUserCount($where);
$total = $table->getMyUserCount($where);
$data['total'] = ceil($total / $pageSize); $data['total'] = ceil($total / $pageSize);
$data['page'] = $pageNo; $data['page'] = $pageNo;
$vip_services = new VipService(); $vip_services = new VipService();
$data['examine_vip'] = $vip_services->vip($params['agent_id']); $data['examine_vip'] = $vip_services->vip($params['agent_id']);
return $this->response(200, '成功', $data); return $this->response(200,'成功',$data);
} }
/**搜索客户跟进 /**搜索客户跟进
* @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 agentUserFollow() public function agentUserFollow(){
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$table = new UPhoneFollowPp; $table= new UPhoneFollowPp;
$data['msg'] = ''; $data['msg'] = '';
$params = $this->request->param(); $params = $this->request->param();
$time = date("Y-m-d H:i:s", time());//当前时间 $time=date("Y-m-d H:i:s",time());//当前时间
$search = $params['search']; $search=$params['search'];
if (empty($params['agent_id'])) { if(empty($params['agent_id'])){
return $this->response(100, '参数不全'); return $this->response(100,'参数不全');
} }
$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'];
$field = [ 'f.id', $field=['f.id',
'f.user_id', 'f.user_id',
'f.agent_id', 'f.agent_id',
'f.content', 'f.content',
...@@ -249,20 +234,20 @@ class Client extends Basic ...@@ -249,20 +234,20 @@ class Client extends Basic
"TIMESTAMPDIFF(MINUTE,f.create_time,'{$time}')as time_minute_diff" "TIMESTAMPDIFF(MINUTE,f.create_time,'{$time}')as time_minute_diff"
]; ];
//$where="(u.agent_id in(0,{$params['agent_id']}) or f.user_id is null or TIMESTAMPDIFF(MINUTE,u.create_time,'{$time}') > 2880 ) "; //$where="(u.agent_id in(0,{$params['agent_id']}) or f.user_id is null or TIMESTAMPDIFF(MINUTE,u.create_time,'{$time}') > 2880 ) ";
$where = "(u.agent_id in(0,{$params['agent_id']}) or f.user_id is null or TIMESTAMPDIFF(MINUTE,u.create_time,'{$time}') > 0 ) "; $where="(u.agent_id in(0,{$params['agent_id']}) or f.user_id is null or TIMESTAMPDIFF(MINUTE,u.create_time,'{$time}') > 0 ) ";
if (!empty($search)) { if(!empty($search)){
$where .= " and f.content like '%$search%' "; $where.=" and f.content like '%$search%' ";
$data['search'] = $search; $data['search']=$search;
} }
$group = " f.id "; $group=" f.id ";
$join = [ [ 'agents a', 'a.id=f.agent_id', 'left' ], $join=[['agents a','a.id=f.agent_id','left'],
[ 'u_users u', 'u.id=f.user_id', 'left' ], ]; ['u_users u','u.id=f.user_id','left'],];
$order = "id desc"; $order="id desc";
$data['list'] = $table->getSearch($pageNo, $pageSize, $order, $field, $join, $where, $group); $data['list']=$table->getSearch($pageNo, $pageSize,$order,$field,$join, $where,$group);
$total = $table->getUserAgentTotal($where, $join); $total=$table->getUserAgentTotal($where,$join);
$data['total'] = ceil($total / $pageSize); $data['total'] =ceil($total / $pageSize);
$data['page'] = $pageNo; $data['page']=$pageNo;
return $this->response(200, '成功', $data); return $this->response(200,'成功',$data);
} }
...@@ -274,25 +259,25 @@ class Client extends Basic ...@@ -274,25 +259,25 @@ class Client extends Basic
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getULabelsListApp() public function getULabelsListApp() {
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$result['code'] = 200; $result['code'] = 200;
$result['msg'] = ''; $result['msg'] = '';
$table = New ULabels; $table = New ULabels;
$where['type'] = 1; $where['type'] = 1;
$result['data']['list'] = $table->uleList($where); $result['data']['list'] = $table->uleList($where);
return $this->response($result['code'], $result['msg'], $result['data']); return $this->response($result['code'], $result['msg'], $result['data']);
} }
/** /**
* 全部客户 * 全部客户
*/ */
public function all_user() public function all_user() {
{
header('Access-Control-Allow-Origin:*'); header('Access-Control-Allow-Origin:*');
$params = $this->params; $Two_days_ago = date("Y-m-d h:i:s",strtotime("-2 day"));
$params = $this->params;
#测试数据 #测试数据
// $params['phone_or_name'] = '666' ; // $params['phone_or_name'] = '666' ;
...@@ -306,83 +291,94 @@ class Client extends Basic ...@@ -306,83 +291,94 @@ class Client extends Basic
return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]); return $this->response("300", "参数不全", [ 'remote_groupid' => '' ]);
} }
$phone_or_name = empty($params['phone_or_name']) ? "" : trim($params['phone_or_name']); $phone_or_name = empty($params['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;
$user_id = $params['user_id']; $user_id = $params['user_id'];
$type = $params['type']; $type = $params['type'];
$search_type = $params['search_type'];#无:'';客户电话:0;客户姓名:1;跟进:2 ; 编号:3; $search_type = $params['search_type'];#无:'';客户电话:0;客户姓名:1;跟进:2 ; 编号:3;
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_name'] = [ 'LIKE', '%' . $phone_or_name . '%' ]; $conditions['user_name'] = ['LIKE', '%'.$phone_or_name.'%'];
} elseif ($search_type == '3') {//客户 } elseif ($search_type == '3'){//客户
$conditions['id'] = $phone_or_name; $conditions['id'] = $phone_or_name;
} }
if ($search_type != '2') { if ($search_type != '2')
{
//全部客户 //全部客户
if ($search_type == '') { if($search_type == ''){
if ($type == '0') {//求租:0 ;已租:1 数据库0:求租;1:已租;-1:无效 if($type == '0')
$conditions['user_status'] = 0; {//求租:0 ;已租:1 数据库0:求租;1:已租;-1:无效
} else { $conditions['user_status'] = 0;
$conditions['user_status'] = 1; }else{
$conditions['user_status'] = 1;
} }
} }
$user = new Users(); $user = new Users();
$conditions['status'] = [ '<', 2 ]; $conditions['status'] = ['<', 2];
$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);
} 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);
} }
if ($search_type != '2') { if($search_type!='2')
{
//全部客户数据处理 //全部客户数据处理
foreach ($user_res as $k => $v) { foreach($user_res as $k=>$v)
$label = []; {
$user_res[$k]['user_name'] = $v['user_name'] ? $v['user_name'] : '未知'; $label = [];
if ($user_id == $v['agent_id']) { $user_res[$k]['user_name'] = $v['user_name']?$v['user_name']:'未知';
if($user_id == $v['agent_id'])
{
$label[] = '我的'; $label[] = '我的';
} }
/*if((strtotime(date("Y-m-d h:i:s")) - strtotime($v['create_time'])) < 172800)
{
$label[] = '保护期内';
}*/
//无效客户不显示标签 //无效客户不显示标签
if ($v['user_status'] != -1) { if($v['user_status'] != -1){
$user_res[$k]['label'] = implode(',', $label); $user_res[$k]['label'] = implode(',',$label);
} }
} }
} else {//跟进数据处理 }else{//跟进数据处理
foreach ($user_res as $k => $v) { foreach($user_res as $k=>$v)
$user_res[$k]['time'] = tranTime($v['create_time']); {
$table = new AAgents(); $user_res[$k]['time']=tranTime($v['create_time']);
$Agents_res = $table->Agents_res($v['agent_id']); $table= new AAgents();
$Agents_res = $table->Agents_res($v['agent_id']);
//dump($Agents_res); //dump($Agents_res);
$user_res[$k]['agentinfo'] = $Agents_res ? $Agents_res['name'] . '-' . $Agents_res['name'] : '未知'; $user_res[$k]['agentinfo'] =$Agents_res ? $Agents_res['name'].'-'.$Agents_res['name'] : '未知';
$user_res[$k]['agentshopname'] = $Agents_res['store_name'] ? $Agents_res['store_name'] : ''; $user_res[$k]['agentshopname'] =$Agents_res['store_name'] ? $Agents_res['store_name'] : '';
$user_res[$k]['realname'] = $Agents_res['name'] ? $Agents_res['name'] : ''; $user_res[$k]['realname'] =$Agents_res['name'] ? $Agents_res['name'] : '';
$user_res[$k]['user_pic'] = AGENTHEADERIMGURL . $Agents_res['img']; $user_res[$k]['user_pic'] =AGENTHEADERIMGURL.$Agents_res['img'];
} }
} }
$total = intval($total / $pagesize) + (($total % $pagesize == 0) ? 0 : 1); $total = intval($total / $pagesize) + (($total % $pagesize == 0) ? 0 : 1);
$data['user_date'] = $user_res; $data['user_date'] = $user_res;
$data['pagenum'] = $pagenum; $data['pagenum'] = $pagenum;
$data['total'] = $total; $data['total'] = $total;
$data['search_type'] = $search_type; $data['search_type'] = $search_type;
$vip_services = new VipService(); $vip_services = new VipService();
$data['examine_vip'] = $vip_services->vip($params['user_id']); $data['examine_vip'] = $vip_services->vip($params['user_id']);
return $this->response("200", "success!", $data); return $this->response("200", "success!", $data);
} }
/** /**
* 邀请记录 * 邀请记录
* *
...@@ -391,27 +387,26 @@ class Client extends Basic ...@@ -391,27 +387,26 @@ class Client extends Basic
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function inviteList() public function inviteList() {
{
$data['status'] = 101; $data['status'] = 101;
$data['data'] = array(); $data['data'] = array();
$data['msg'] = ''; $data['msg'] = '';
if (empty($this->agentId)) { if (empty($this->agentId)) {
return $this->response($data['status'], 'id is null'); return $this->response($data['status'],'id is null');
} }
$params = $this->params; $params = $this->params;
$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['status'] = 0; $where['status'] = 0;
$where['referrer_id'] = $this->agentId; $where['referrer_id'] = $this->agentId;
$where['referrer_source'] = 20; $where['referrer_source'] = 20;
$fields = 'user_nick,user_phone,user_pic,other_pic,registration_time as create_time'; $fields = 'user_nick,user_phone,user_pic,other_pic,registration_time as create_time';
$data['data'] = $this->user->getUserForInviteList($pageNo, $pageSize, $where, $fields); $data['data'] = $this->user->getUserForInviteList($pageNo, $pageSize,$where, $fields);
foreach ($data['data'] as $k => $v) { foreach ($data['data'] as $k=>$v) {
$data['data'][$k]['user_pic'] = !empty($v['user_pic']) ? HEADERIMGURL . $v['user_pic'] : $v['other_pic']; $data['data'][$k]['user_pic'] = !empty($v['user_pic']) ? HEADERIMGURL.$v['user_pic'] : $v['other_pic'] ;
$data['data'][$k]['user_phone'] = hide_customer_phone($v['user_phone']); $data['data'][$k]['user_phone'] = hide_customer_phone($v['user_phone']);
$data['data'][$k]['create_time'] = date('Y-m-d', strtotime($v['create_time'])); $data['data'][$k]['create_time'] = date('Y-m-d', strtotime($v['create_time']));
} }
$data['status'] = 200; $data['status'] = 200;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace app\api_broker\controller; namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\ClientService;
use app\api_broker\service\VipService; use app\api_broker\service\VipService;
use app\model\Users; use app\model\Users;
use think\Request; use think\Request;
...@@ -73,7 +74,7 @@ class User extends Basic ...@@ -73,7 +74,7 @@ class User extends Basic
"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 = "id as user_id,sex,user_name,user_phone,user_status,agent_id,create_time,industry_type,price_demand,area_demand,vip";
$conditions = []; $conditions = [];
...@@ -82,7 +83,7 @@ class User extends Basic ...@@ -82,7 +83,7 @@ class User extends Basic
if (isset($params['user_status'])) { if (isset($params['user_status'])) {
$conditions['user_status'] = $params['user_status']; $conditions['user_status'] = $params['user_status'];
}else{ } else {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
...@@ -94,10 +95,10 @@ class User extends Basic ...@@ -94,10 +95,10 @@ class User extends Basic
$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['area_demand'] = array( 'between', array( $area_start, $area_end ) );
$conditions['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['area_demand'] = array( 'egt', $area_start ); $conditions['area_demand'] = array( 'egt', $area_start );
$conditions['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;
...@@ -108,23 +109,29 @@ class User extends Basic ...@@ -108,23 +109,29 @@ class User extends Basic
} }
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['create_time'] = array( 'between', array( $start_time, $end_time ) );
} }
if (isset($params['status'])) { if (isset($params['status'])) {
$conditions['status'] = $params['status'] ; $conditions['status'] = $params['status'];
} }
$userList = $this->userModel->selectUserList($field, $conditions,$pageNo, $pageSize, "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", "此条件没有找到数据");
} }
$vip_services = new VipService(); $clientService = new ClientService();
$data['examine_vip'] = $vip_services->vip($params['user_id']); foreach ($userList as $k => $v) {
$data['user_date'] = $userList; $is_show = $clientService->dialTotal($v["user_id"]);
if (!$is_show) {
unset($userList[$k]);
}
}
$vip_services = new VipService();
$data['examine_vip'] = $vip_services->vip($params['user_id']);
$data['user_date'] = array_merge($userList);
return $this->response("200", 'request success', $data); return $this->response("200", 'request success', $data);
} }
......
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