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);