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

43 lines
1.0 KiB

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