链街Dcat后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
4.9 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Admin\Metrics\Examples;
  4. use App\Http\Controllers\Controller;
  5. use Dcat\Admin\Controllers\Dashboard;
  6. use Dcat\Admin\Layout\Column;
  7. use Dcat\Admin\Layout\Content;
  8. use Dcat\Admin\Layout\Row;
  9. use Dcat\Admin\Admin;
  10. class HomeController extends Controller
  11. {
  12. public function index(Content $content)
  13. {
  14. if (Admin::user()->isRole('lanzu_business')) {
  15. return $this->lanzu_biz($content);
  16. } elseif (Admin::user()->isRole('lanzu_mp')) {
  17. return $this->lanzu_mp($content);
  18. } elseif (Admin::user()->isRole('lanzu_mm')) {
  19. return $this->lanzu_mm($content);
  20. } elseif (Admin::user()->isRole('lanzu_cs')) {
  21. return $this->lanzu_cs($content);
  22. } elseif (Admin::user()->isRole('market_service')) {
  23. return $this->market_service($content);
  24. }
  25. return $this->default($content);
  26. }
  27. protected function default(Content $content)
  28. {
  29. return $content
  30. ->header('Dashboard')
  31. ->description('Description...')
  32. ->body(function (Row $row) {
  33. $row->column(6, function (Column $column) {
  34. $column->row(Dashboard::title());
  35. $column->row(new Examples\Tickets());
  36. });
  37. $row->column(6, function (Column $column) {
  38. $column->row(function (Row $row) {
  39. $row->column(6, new Examples\NewUsers());
  40. $row->column(6, new Examples\NewDevices());
  41. });
  42. $column->row(new Examples\Sessions());
  43. $column->row(new Examples\ProductOrders());
  44. });
  45. });
  46. }
  47. protected function lanzu_mp(Content $content)
  48. {
  49. return $content->header('控制面板')
  50. ->description('欢迎回到懒族后台')
  51. ->body(function (Row $row) {
  52. $row->column(4, function (Column $column) {
  53. $column->row(new Examples\Community\TotalAmount(Admin::user()->id,Type::BALANCE_USER_TYPE_MP));
  54. });
  55. $row->column(4, function (Column $column) {
  56. $column->row(new Examples\ServiceCard\TotalMm());
  57. });
  58. });
  59. }
  60. protected function lanzu_mm(Content $content)
  61. {
  62. return $content->header('控制面板')
  63. ->description('欢迎回到懒族后台')
  64. ->body(function (Row $row) {
  65. $row->column(3, function (Column $column) {
  66. <<<<<<< .mine
  67. $column->row(new Examples\Community\TotalAmount(Admin::user()->id,Type::BALANCE_USER_TYPE_MM));
  68. =======
  69. $column->row(new Examples\Community\TotalAmount(Admin::user()->id, 2));
  70. >>>>>>> .theirs
  71. });
  72. $row->column(3, function (Column $column) {
  73. $column->row(new Examples\ServiceCard\TotalStore());
  74. });
  75. });
  76. }
  77. protected function lanzu_biz(Content $content)
  78. {
  79. return $content->header('控制面板')
  80. ->description('欢迎回到懒族后台')
  81. ->body(function (Row $row) {
  82. $row->column(4, function (Column $column) {
  83. $column->row(new Examples\ServiceCard\TotalMp());
  84. });
  85. $row->column(4, function (Column $column) {
  86. $column->row(new Examples\Community\TotalCommunity());
  87. });
  88. $row->column(4, function (Column $column) {
  89. $column->row(new Examples\Community\TotalUser());
  90. });
  91. });
  92. }
  93. protected function lanzu_cs(Content $content)
  94. {
  95. return $content->header('控制面板')
  96. ->description('欢迎回到懒族后台')
  97. ->body(function (Row $row) {
  98. $row->column(4, function (Column $column) {
  99. $column->row(new Examples\Community\TotalUser());
  100. });
  101. $row->column(4, function (Column $column) {
  102. <<<<<<< .mine
  103. $column->row(new Examples\Community\TotalAmount(Admin::user()->id,Type::BALANCE_USER_TYPE_CS));
  104. =======
  105. $column->row(new Examples\Community\TotalAmount(Admin::user()->id, 3));
  106. >>>>>>> .theirs
  107. });
  108. });
  109. }
  110. protected function market_service(Content $content)
  111. {
  112. return $content->header('控制面板')
  113. ->description('欢迎回到懒族后台')
  114. ->body(function (Row $row) {
  115. $row->column(4, function (Column $column) {
  116. $column->row(new Examples\Order\OrderData('number','订单数'));
  117. });
  118. $row->column(4, function (Column $column) {
  119. $column->row(new Examples\Order\OrderData('amount','订单金额'));
  120. });
  121. });
  122. }
  123. }