日期:2014-05-16 浏览次数:20648 次
项目实例:
!defined('PATH_ADMIN') && exit('Forbidden'); class mod_gcdownload { public static function get_gcdownload_datalist($start = 0,$rowsperpage = PAGE_ROWS, $datestart = '',$dateend = '',$ver = '',$coopid = '',$subcoopid = '',$sortfield = '', $sorttype = '', $pid = 123456789, $plat = 'abcdefg'){ $sql = ''; $condition = empty($datestart) ? " WHERE 1=1 " : " WHERE t.statistics_date >= '$datestart' AND t.statistics_date <= '$dateend'"; if($ver) { $condition .= " AND t.edition='$ver'"; } if($coopid) { $condition .= " AND t.suco_coopid=$coopid"; } if($subcoopid) { $condition .= " AND t.suco_subcoopid=$subcoopid"; } if($sortfield && $sorttype){ $condition .= " ORDER BY t.{$sortfield} {$sorttype} NULLS LAST"; }elseif($sortfield){ $condition .= " ORDER BY t.{$sortfield} desc NULLS LAST"; }else{ $condition .= " ORDER BY t.statistics_date desc NULLS LAST"; } $finish = $start + $rowsperpage; $joinsqlcollection = "(SELECT tc.coop_name, tsc.suco_name, tsc.suco_coopid,tsc.suco_subcoopid, s.edition, s.new_user, d.one_user, d.three_user, d.seven_user, s.statistics_date FROM (((pdt_stat_newuser_{$pid}_{$plat} s LEFT JOIN pdt_days_dl_remain_{$pid}_{$plat} d ON s.statistics_date=d.new_date AND s.subcoopid=d.subcoopid AND s.edition=d.edition )LEFT JOIN tbl_subcooperator@JTUSER1.NET@JTINFO tsc ON s.subcoopid=tsc.suco_subcoopid) LEFT JOIN tbl_cooperator@JTUSER1.NET@JTINFO tc ON tsc.suco_coopid=tc.coop_id))"; $sql = "SELECT * FROM (SELECT tb_A.*, ROWNUM AS rn FROM (SELECT t.* FROM $joinsqlcollection t {$condition} ) tb_A WHERE ROWNUM <= {$finish} ) tb_B WHERE tb_B.rn>{$start} "; $countsql = "SELECT COUNT(*) AS totalrows, SUM(t.new_user) AS totalnewusr,SUM(t.one_user) AS totaloneusr,SUM(t.three_user) AS totalthreeusr,SUM(t.seven_user) AS totalsevenusr FROM $joinsqlcollection t {$condition} "; $db = oralceinit(1); $stidquery = $db-