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

54 lines
1.4 KiB

5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Metrics\Examples\Community;
  3. use App\Models\LanzuUserBalance;
  4. use Dcat\Admin\Admin;
  5. use Dcat\Admin\Support\Helper;
  6. use Dcat\Admin\Widgets\Metrics\Card;
  7. class TotalAmount extends Card
  8. {
  9. protected $uid;
  10. protected $uType;
  11. public function __construct($uid, $uType)
  12. {
  13. $this->uid = $uid;
  14. $this->uType =$uType;
  15. parent::__construct('可提现金额(元)');
  16. }
  17. protected function init()
  18. {
  19. parent::init();
  20. $this->content(LanzuUserBalance::getBalance($this->uid, $this->uType));
  21. }
  22. /**
  23. * 渲染卡片内容
  24. * @return string
  25. */
  26. public function renderContent()
  27. {
  28. $content = parent::renderContent();
  29. $adu = Admin::user();
  30. $url = "";
  31. if ($adu->isRole('lanzu_mp')){
  32. $url = url('admin/mp_withdraw/create');
  33. }elseif ($adu->isRole('lanzu_cs')){
  34. $url = url('admin/cs_withdraw/create');
  35. }elseif ($adu->isRole('lanzu_mm')){
  36. $url = url('admin/mm_withdraw/create');
  37. }
  38. return <<<HTML
  39. <div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
  40. <h2 class="ml-1 font-large-1 text-primary">{$content}</h2>
  41. </div>
  42. <a type="button" href="{$url}" style="float: right; margin-right: 10px;margin-top: 15px" class="btn btn-outline-primary">提现</a>
  43. HTML;
  44. }
  45. }