链街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.

136 lines
4.6 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. $column->row(new Examples\Community\TotalAmount(Admin::user()->id,Type::BALANCE_USER_TYPE_MM));
  67. });
  68. $row->column(3, function (Column $column) {
  69. $column->row(new Examples\ServiceCard\TotalStore());
  70. });
  71. });
  72. }
  73. protected function lanzu_biz(Content $content)
  74. {
  75. return $content->header('控制面板')
  76. ->description('欢迎回到懒族后台')
  77. ->body(function (Row $row) {
  78. $row->column(4, function (Column $column) {
  79. $column->row(new Examples\ServiceCard\TotalMp());
  80. });
  81. $row->column(4, function (Column $column) {
  82. $column->row(new Examples\Community\TotalCommunity());
  83. });
  84. $row->column(4, function (Column $column) {
  85. $column->row(new Examples\Community\TotalUser());
  86. });
  87. });
  88. }
  89. protected function lanzu_cs(Content $content)
  90. {
  91. return $content->header('控制面板')
  92. ->description('欢迎回到懒族后台')
  93. ->body(function (Row $row) {
  94. $row->column(4, function (Column $column) {
  95. $column->row(new Examples\Community\TotalUser());
  96. });
  97. $row->column(4, function (Column $column) {
  98. $column->row(new Examples\Community\TotalAmount(Admin::user()->id,Type::BALANCE_USER_TYPE_CS));
  99. });
  100. });
  101. }
  102. protected function market_service(Content $content)
  103. {
  104. return $content->header('控制面板')
  105. ->description('欢迎回到懒族后台')
  106. ->body(function (Row $row) {
  107. $row->column(4, function (Column $column) {
  108. $column->row(new Examples\Order\OrderData('number','订单数'));
  109. });
  110. $row->column(4, function (Column $column) {
  111. $column->row(new Examples\Order\OrderData('amount','订单金额'));
  112. });
  113. });
  114. }
  115. }