Console.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. namespace Manage\Plugin;
  3. use Dever;
  4. class Console
  5. {
  6. public function data()
  7. {
  8. if (Dever::load('manage/auth')->checkFunc('console.index', 'edit', '控制台数据概览')) {
  9. $where['start'] = Dever::maketime(date('Y-m-d 00:00:00'));
  10. $where['end'] = Dever::maketime(date('Y-m-d 23:59:59'));
  11. $where['status'] = '1,2,3,4,5,6';
  12. $today_sell_cash = Dever::db('shop/sell_order')->getCashNum($where);
  13. $today_sell_order = Dever::db('shop/sell_order')->getOrderNum($where);
  14. $where['status'] = '1,2,3,4,5,6';
  15. $today_buy_cash = Dever::db('shop/buy_order')->getCashNum($where);
  16. $today_buy_order = Dever::db('shop/buy_order')->getOrderNum($where);
  17. $today_user = Dever::db('passport/user')->total($where);
  18. $user = Dever::db('passport/user')->total();
  19. $shop = Dever::db('shop/info')->total();
  20. $factory = Dever::db('factory/info')->total();
  21. $store = Dever::db('store/info')->total();
  22. $total = 0;
  23. $data[] = array
  24. (
  25. 'name' => '当日销售额',
  26. 'num' => $today_sell_cash['total'] ? round($today_sell_cash['total'], 2) : 0,
  27. 'href' => '#',
  28. );
  29. $data[] = array
  30. (
  31. 'name' => '销售订单量',
  32. 'num' => $today_sell_order,
  33. 'href' => '#',
  34. );
  35. $data[] = array
  36. (
  37. 'name' => '采购额',
  38. 'num' => $today_buy_cash['total'] ? round($today_buy_cash['total'], 2) : 0,
  39. 'href' => '#',
  40. );
  41. $data[] = array
  42. (
  43. 'name' => '采购订单量',
  44. 'num' => $today_buy_order,
  45. 'href' => '#',
  46. );
  47. $data[] = array
  48. (
  49. 'name' => '当日用户新增',
  50. 'num' => $today_user,
  51. 'href' => '#',
  52. );
  53. $data[] = array
  54. (
  55. 'name' => '用户总量',
  56. 'num' => $user,
  57. 'href' => '#',
  58. );
  59. $data[] = array
  60. (
  61. 'name' => '门店数',
  62. 'num' => $shop,
  63. 'href' => '#',
  64. );
  65. $data[] = array
  66. (
  67. 'name' => '仓库数/工厂数',
  68. 'num' => $store . ' / ' . $factory,
  69. 'href' => '#',
  70. );
  71. return $data;
  72. } else {
  73. return array();
  74. }
  75. }
  76. }