123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- include_once dirname(__FILE__) . '/../main.php';
- $GET = query_paras();
- $date = $GET['date'];
- $date1 = $GET['date1'];
- $isnew = $GET['isnew'];
- $isold = $GET['isold'];
- $islost = $GET['islost'];
- $pageNumber = $GET['pageNumber'];
- $pageSize = $GET['pageSize'];
- $start = ($pageNumber - 1) * $pageSize;
- $count = 0;
- $arr = array();
- $tabName = 'tab_rolename';
- if ($isnew > 0) { // 新增
- $count = daoInst()->select('*')->from($tabName)
- ->where('ts')->ge($date . " 00:00:00")
- ->andWhere('ts')->le($date1 . " 23:59:59")
- ->count();
- $arr = daoInst()->select('*')->from($tabName)
- ->where('ts')->ge($date . " 00:00:00")
- ->andWhere('ts')->le($date1 . " 23:59:59")
- ->limit($start . "," . $pageSize)
- ->fetch_array();
- } else if ($isold > 0) { // 留存
- $count = daoInst()->select('*')->from($tabName)
- ->where('lastlogin')->ge($date . " 00:00:00")
- ->andWhere('lastlogin')->le($date1 . " 23:59:59")
- ->count();
- $arr = daoInst()->select('*')->from($tabName)
- ->where('lastlogin')->ge($date . " 00:00:00")
- ->andWhere('lastlogin')->le($date1 . " 23:59:59")
- ->limit($start . "," . $pageSize)
- ->fetch_array();
- } else if ($islost > 0) { // 流失
- $count = daoInst()->select('*')->from($tabName)
- ->where('lastlogin')->ge($date . " 00:00:00")
- ->andWhere('lastlogin')->le($date1 . " 23:59:59")
- ->andWhere('to_days(from_unixtime(`ts`))')->eq('to_days(from_unixtime(`lastlogin`))')
- ->count();
- $arr = daoInst()->select('*')->from($tabName)
- ->where('lastlogin')->ge($date . " 00:00:00")
- ->andWhere('lastlogin')->le($date1 . " 23:59:59")
- ->andWhere('to_days(from_unixtime(`ts`))')->eq('to_days(from_unixtime(`lastlogin`))')
- ->limit($start . "," . $pageSize)
- ->fetch_array();
- }
- $result = new stdClass();
- $result->total = $count;
- $result->rows = $arr;
- echo json_encode($result);
|