main.php 1.1 KB

12345678910111213141516171819202122232425
  1. <?php
  2. namespace WY\app\controller\agent;
  3. use WY\app\libs\Controller;
  4. use WY\app\model\Bill;
  5. if (!defined('WY_ROOT')) {
  6. exit;
  7. }
  8. class main extends CheckUser
  9. {
  10. public function index()
  11. {
  12. $where = array('fields' => 'is_state=? and cid=?', 'values' => array('1', '2'));
  13. $notice = $this->model()->select()->from('arlist')->limit(10)->where($where)->orderby('id desc')->fetchAll();
  14. $bill = new Bill();
  15. $income = $bill->beforeAgentIncome($_SESSION['login_agentid'], 0);
  16. $unpaid = $income + $this->userData['unpaid'];
  17. $where = array('fields' => 'agentid=? and is_state<? and addtime>=?', 'values' => array($_SESSION['login_agentid'], 2, strtotime(date('Y-m-d'))));
  18. $today_orders = $this->model()->select()->from('orders')->where($where)->count();
  19. $today_income = $bill->todayAgentIncome($_SESSION['login_agentid'], 0);
  20. $unpaid += $today_income;
  21. $data = array('title' => '代理首页', 'notice' => $notice, 'today_orders' => $today_orders, 'today_income' => $today_income, 'unpaid' => $unpaid);
  22. $this->put('index.php', $data);
  23. }
  24. }