userinfo['OperaterID']; $agent_phone = $this->userinfo['phone']; $page = 0; if (isset($_GET['PageIndex'])) { $page = ($_GET['PageIndex'] - 1) * 50; } $where = []; $where_str = ' (UserCode='.$agent_phone.' OR agent_id='.$agent_id.') '; //处理筛选 if($get_data['UserId'] != 0){ $where['UserId'] = $get_data['UserId']; } if(!empty($get_data['ProductIds'])){ $where['ProductId'] = $get_data['ProductIds']; } if(!empty($get_data['PackageNames'])){ $where['PackageName'] = $get_data['PackageNames']; } if(!empty($get_data['accountTypes'])){ $where['AccountType'] = $get_data['accountTypes']; } if (!empty($_GET['Btime'])){ $date1 = date('Y-m-d', strtotime($_GET['Btime'])); $date2 = date('Y-m-d', strtotime($_GET['Etime'])); $where_str .= " AND EndTime>='" . $date1 . "' and EndTime<='" . $date2 . "' "; } if (!empty($_GET['Bktime'])){ if (mb_strlen($where_str)>0){ $where_str .= ' AND '; } $date1 = date('Y-m-d', strtotime($_GET['Bktime'])); $date2 = date('Y-m-d', strtotime($_GET['Ektime'])); $where_str .= " StartTime>='" . $date1 . "' and StartTime<='" . $date2 . "' "; } if (!empty($get_data['keyWord'])){ $where['Account'] = ['like','%'.$get_data['keyWord'].'%']; } $account_model = new ProductAccountModel; $list = $account_model->getAgentListPage($where,$where_str, '*', 'id desc', "$page,50"); foreach ($list as &$info){ $endtime = strtotime($info['EndTime']); if($endtime <= time()){ $info['RestTime'] = '已过期'; } else { $day = ceil(($endtime - time())/86400); $info['RestTime'] = $day.'天'; } $info['UserCode'] = $info['UserPhone']?$info['UserPhone']:$info['UserCode']; } $data = [ 'Code' => 10000, 'Data' => $list, 'Message' => '', 'TotalCount' => (int)$account_model->getCount($where)['count'], ]; echo json_encode($data); } }