spend_list.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. defined('IN_PHPCMS') or exit('No permission resources.');
  3. pc_base::load_app_class('foreground','member');
  4. pc_base::load_sys_class('format', '', 0);
  5. pc_base::load_sys_class('form', '', 0);
  6. class spend_list extends foreground {
  7. private $spend_db;
  8. function __construct() {
  9. if (!module_exists(ROUTE_M)) showmessage(L('module_not_exists'));
  10. $this->spend_db = pc_base::load_model('pay_spend_model');
  11. parent::__construct();
  12. }
  13. public function init() {
  14. $page = isset($_GET['page']) && intval($_GET['page']) ? intval($_GET['page']) : 1;
  15. $userid = param::get_cookie('_userid');
  16. $sql = " `userid` = '$userid'";
  17. if (isset($_GET['dosubmit'])) {
  18. $type = isset($_GET['type']) && intval($_GET['type']) ? intval($_GET['type']) : '';
  19. $endtime = isset($_GET['endtime']) && trim($_GET['endtime']) ? strtotime(trim($_GET['endtime'])) : '';
  20. $starttime = isset($_GET['starttime']) && trim($_GET['starttime']) ? strtotime(trim($_GET['starttime'])) : '';
  21. if (!empty($starttime) && empty($endtime)) {
  22. $endtime = SYS_TIME;
  23. }
  24. if (!empty($starttime) && !empty($endtime) && $endtime < $starttime) {
  25. showmessage(L('wrong_time_over_time_to_time_less_than'));
  26. }
  27. if (!empty($starttime)) {
  28. $sql .= $sql ? " AND `creat_at` BETWEEN '$starttime' AND '$endtime' " : " `creat_at` BETWEEN '$starttime' AND '$endtime' ";
  29. }
  30. if (!empty($type)) {
  31. $sql .= $sql ? " AND `type` = '$type' " : " `type` = '$type'";
  32. }
  33. }
  34. $list = $this->spend_db->listinfo($sql, '`id` desc', $page);
  35. $pages = $this->spend_db->pages;
  36. include template('pay', 'spend_list');
  37. }
  38. }