main.php 2.9 KB

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace WY\app\controller\derpay;
  3. use WY\app\libs\Controller;
  4. if (!defined('WY_ROOT')) {
  5. exit;
  6. }
  7. class main extends CheckAdmin
  8. {
  9. public function index()
  10. {
  11. $tx['tcount'] = $this->model()->select()->from('payments')->where(array('fields' => 'is_state=? and ship_type=? and addtime>=? and addtime<=?', 'values' => array(0, 1, strtotime(date('Y-m-d')), time())))->count();
  12. $tx['tmoney'] = $this->model()->select(array('money' => 'money'))->from('payments')->where(array('fields' => 'is_state=? and ship_type=? and addtime>=? and addtime<=?', 'values' => array(0, 1, strtotime(date('Y-m-d')), time())))->sum();
  13. $tx['ycount'] = $this->model()->select()->from('payments')->where(array('fields' => 'is_state=? and ship_type=? and addtime>=? and addtime<=?', 'values' => array(0, 1, strtotime(date('Y-m-d')) - 60 * 60 * 24, strtotime(date('Y-m-d') . ' 23:59:59') - 60 * 60 * 24)))->count();
  14. $tx['ymoney'] = $this->model()->select(array('money' => 'money'))->from('payments')->where(array('fields' => 'is_state=? and ship_type=? and addtime>=? and addtime<=?', 'values' => array(0, 1, strtotime(date('Y-m-d')) - 60 * 60 * 24, strtotime(date('Y-m-d') . ' 23:59:59') - 60 * 60 * 24)))->sum();
  15. $user['tcount'] = $this->model()->select()->from('users')->where(array('fields' => 'addtime>=? and addtime<=?', 'values' => array(strtotime(date('Y-m-d')), time())))->count();
  16. $user['ycount'] = $this->model()->select()->from('users')->where(array('fields' => 'addtime>=? and addtime<=?', 'values' => array(strtotime(date('Y-m-d')) - 60 * 60 * 24, strtotime(date('Y-m-d') . ' 23:59:59') - 60 * 60 * 24)))->count();
  17. $user['unverify'] = $this->model()->select()->from('users')->where(array('fields' => 'is_state=?', 'values' => array(0)))->count();
  18. $user['agent'] = $this->model()->select()->from('users')->where(array('fields' => 'is_agent=?', 'values' => array(1)))->count();
  19. $order['tcount'] = $this->model()->select()->from('orders')->where(array('fields' => 'addtime>=? and addtime<=?', 'values' => array(strtotime(date('Y-m-d')), time())))->count();
  20. $order['unpaid'] = $this->model()->select()->from('orders')->where(array('fields' => 'is_state=? and addtime>=? and addtime<=?', 'values' => array(0, strtotime(date('Y-m-d')), time())))->count();
  21. $order['paid'] = $this->model()->select()->from('orders')->where(array('fields' => 'is_state=? and addtime>=? and addtime<=?', 'values' => array(1, strtotime(date('Y-m-d')), time())))->count();
  22. $order['ycount'] = $this->model()->select()->from('orders')->where(array('fields' => 'addtime>=? and addtime<=?', 'values' => array(strtotime(date('Y-m-d')) - 60 * 60 * 24, strtotime(date('Y-m-d') . ' 23:59:59') - 60 * 60 * 24)))->count();
  23. $data = array('title' => '后台管理中心', 'tx' => $tx, 'user' => $user, 'order' => $order);
  24. $this->put('index.php', $data);
  25. }
  26. }