xsdatalist.inc.php 8.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $storeid = $_COOKIE["storeid"];
  5. $start = strtotime(date("Y-m-d"));
  6. $end = strtotime(date("Y-m-d", strtotime("+1 day")));
  7. if (!$_GPC['page']) {
  8. $_GPC['page'] = 1;
  9. }
  10. $pageindex = max(1, intval($_GPC['page']));
  11. $pagesize = 15;
  12. if (!empty($_GPC['time'])) {
  13. $start = strtotime($_GPC['time']['start']);
  14. $end = strtotime($_GPC['time']['end']);
  15. }
  16. //echo date("Y-m-d",1523534891);die();
  17. if ($_GPC['ordertype'] == 1) {
  18. $sql = " select * from (select a.money as xsmoney,time from (select id,money,FROM_UNIXTIME(time) as time from" . tablename('zhtc_order') . " where uniacid={$_W['uniacid']} and state in (2,3,4,5,7) ) a where UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_storepaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_tzpaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_carpaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_yellowpaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all (select a.money as xsmoney,a.time from" . tablename('zhtc_fxlog') . " a" . " left join " . tablename("zhtc_user") . " b on b.id=a.user_id where b.uniacid={$_W['uniacid']} and a.money>0 and a.state=2 and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end}) ) xx order by xx.time desc";
  19. $total = pdo_fetchcolumn("SELECT count(*) from (select a.money as xsmoney,time from (select id,money,FROM_UNIXTIME(time) as time from" . tablename('zhtc_order') . " where uniacid={$_W['uniacid']} and state in (2,3,4,5,7)) a where UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_storepaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_tzpaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_carpaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all select money as xsmoney,time from" . tablename('zhtc_yellowpaylog') . " where uniacid={$_W['uniacid']} and money>0 and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} union all (select a.money as xsmoney,a.time from" . tablename('zhtc_fxlog') . " a" . " left join " . tablename("zhtc_user") . " b on b.id=a.user_id where b.uniacid={$_W['uniacid']} and a.money>0 and a.state=2 and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end}) ) aa ");
  20. } elseif ($_GPC['ordertype'] == 2) {
  21. $sql = "select a.money as xsmoney,a.time,a.note,b.id,c.name from" . tablename('zhtc_tzpaylog') . " a" . " left join " . tablename("zhtc_information") . " b on b.id=a.tz_id " . " left join " . tablename("zhtc_user") . " c on b.user_id=c.id where a.uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end} and a.note!='红包福利' order by a.id DESC";
  22. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_tzpaylog') . " where uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} and note!='红包福利'");
  23. } elseif ($_GPC['ordertype'] == 3) {
  24. $sql = "select a.money as xsmoney,a.time,a.note,b.id,c.name from" . tablename('zhtc_storepaylog') . " a" . " left join " . tablename("zhtc_store") . " b on b.id=a.store_id " . " left join " . tablename("zhtc_user") . " c on b.user_id=c.id where a.uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end} order by a.id DESC";
  25. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_storepaylog') . " where uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} ");
  26. } elseif ($_GPC['ordertype'] == 4) {
  27. $sql = "select a.money as xsmoney,a.time,a.note,b.id,c.name from" . tablename('zhtc_tzpaylog') . " a" . " left join " . tablename("zhtc_information") . " b on b.id=a.tz_id " . " left join " . tablename("zhtc_user") . " c on b.user_id=c.id where a.uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end} and a.note='红包福利' order by a.id DESC";
  28. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_tzpaylog') . " where uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end} and note='红包福利'");
  29. } elseif ($_GPC['ordertype'] == 5) {
  30. $sql = "select a.note,a.money as xsmoney,a.time,b.name as level_name,c.name from" . tablename('zhtc_fxlog') . " a" . " left join " . tablename("zhtc_fxlevel") . " b on b.id=a.level " . " left join " . tablename("zhtc_user") . " c on a.user_id=c.id where c.uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end} and a.state=2 order by a.id DESC";
  31. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_fxlog') . " a" . " left join " . tablename("zhtc_fxlevel") . " b on b.id=a.level " . " left join " . tablename("zhtc_user") . " c on a.user_id=c.id where c.uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end} and a.state=2");
  32. } elseif ($_GPC['ordertype'] == 6) {
  33. $sql = " select a.money as xsmoney,a.time,a.id,b.name from " . tablename('zhtc_order') . " a" . " left join " . tablename("zhtc_user") . " b on b.id=a.user_id where a.uniacid={$_W['uniacid']} and a.state in (2,3,4,5,7) and a.time < " . $end . " and a.time >= " . $start;
  34. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_order') . " where uniacid={$_W['uniacid']} and state in (2,3,4,5,7) and time < " . $end . " and time >= " . $start);
  35. } elseif ($_GPC['ordertype'] == 7) {
  36. $sql = "select a.money as xsmoney,a.time,b.id,c.name from" . tablename('zhtc_yellowpaylog') . " a" . " left join " . tablename("zhtc_yellowstore") . " b on b.id=a.hy_id " . " left join " . tablename("zhtc_user") . " c on b.user_id=c.id where a.uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end} order by a.id DESC";
  37. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_yellowpaylog') . " where uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end}");
  38. } elseif ($_GPC['ordertype'] == 8) {
  39. $sql = "select a.money as xsmoney,a.time,b.id,c.name from" . tablename('zhtc_carpaylog') . " a" . " left join " . tablename("zhtc_car") . " b on b.id=a.car_id " . " left join " . tablename("zhtc_user") . " c on b.user_id=c.id where a.uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(a.time)>={$start} and UNIX_TIMESTAMP(a.time)<{$end} order by a.id DESC";
  40. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_carpaylog') . " where uniacid={$_W['uniacid']} and UNIX_TIMESTAMP(time)>={$start} and UNIX_TIMESTAMP(time)<{$end}");
  41. } elseif ($_GPC['ordertype'] == 9) {
  42. $sql = "select a.money as xsmoney,from_unixtime(a.time) as time,a.user_id as pay_user_id,b.name as pay_name,a.post_id,d.name as ftname,c.user_id as ftuser_id from" . tablename('zhtc_call') . " a" . " left join " . tablename("zhtc_user") . " b on b.id=a.user_id " . " left join " . tablename("zhtc_information") . " c on a.post_id=c.id left join " . tablename("zhtc_user") . " d on c.user_id=d.id where a.uniacid={$_W['uniacid']} and a.state=2 and a.time>={$start} and a.time<{$end} order by a.id DESC";
  43. $total = pdo_fetchcolumn("SELECT count(*) from " . tablename('zhtc_call') . " where uniacid={$_W['uniacid']} and state=2 and time>={$start} and time<{$end}");
  44. }
  45. $select_sql = $sql . " LIMIT " . ($pageindex - 1) * $pagesize . "," . $pagesize;
  46. $xsinfo = pdo_fetchall($select_sql);
  47. //print_R($xsinfo);die();
  48. $pager = pagination($total, $pageindex, $pagesize);
  49. include $this->template('web/xsdatalist');