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

44 lines
1.0 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Metrics\Examples\ServiceCard;
  3. use App\Models\ImsCjdcStore;
  4. use App\Models\LanzuMmInfo;
  5. use App\Models\LanzuStore;
  6. use Dcat\Admin\Admin;
  7. use Dcat\Admin\Widgets\Metrics\Card;
  8. class TotalStore extends Card
  9. {
  10. protected function init()
  11. {
  12. parent::init();
  13. $this->title = '商户数';
  14. $aud = Admin::user();
  15. $count = 0;
  16. if ($aud->isRole('lanzu_mm')){
  17. $mm = LanzuMmInfo::where('admin_user_id',$aud->id)->first();
  18. if ($mm){
  19. $count = ImsCjdcStore::where('mm_user_id',$mm->user_id)->count();
  20. }
  21. }elseif($aud->isRole('lanzu_mp')){
  22. $count = 0;
  23. }else{
  24. $count = ImsCjdcStore::count();
  25. }
  26. $this->content($count);
  27. }
  28. public function renderContent()
  29. {
  30. $content = parent::renderContent();
  31. return <<<HTML
  32. <div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
  33. <h2 class="ml-1 font-large-1">{$content}</h2>
  34. </div>
  35. HTML;
  36. }
  37. }