|
@@ -1,7 +1,8 @@
|
|
<?php
|
|
<?php
|
|
|
|
|
|
-namespace App\Admin\Metrics\Examples;
|
|
|
|
|
|
+namespace App\Admin\Metrics\User;
|
|
|
|
|
|
|
|
+use App\Models\PaymentLogModel;
|
|
use Dcat\Admin\Widgets\Metrics\Card;
|
|
use Dcat\Admin\Widgets\Metrics\Card;
|
|
use Illuminate\Contracts\Support\Renderable;
|
|
use Illuminate\Contracts\Support\Renderable;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Request;
|
|
@@ -22,13 +23,17 @@ class TotalUsers extends Card
|
|
{
|
|
{
|
|
parent::init();
|
|
parent::init();
|
|
|
|
|
|
- $this->title('Total Users');
|
|
|
|
|
|
+ $this->title('累计金额');
|
|
$this->dropdown([
|
|
$this->dropdown([
|
|
- '7' => 'Last 7 Days',
|
|
|
|
- '28' => 'Last 28 Days',
|
|
|
|
- '30' => 'Last Month',
|
|
|
|
- '365' => 'Last Year',
|
|
|
|
|
|
+ '7' => '最近7天',
|
|
|
|
+ '30' => '最近一个月',
|
|
|
|
+ '365' => '最近一年',
|
|
]);
|
|
]);
|
|
|
|
+ $this->style(
|
|
|
|
+ <<<STYLE
|
|
|
|
+ .App_Admin_Metrics_User_TotalUsers{min-height: 120px!important;}
|
|
|
|
+STYLE
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -49,14 +54,15 @@ class TotalUsers extends Card
|
|
$this->content(mt_rand(170, 250));
|
|
$this->content(mt_rand(170, 250));
|
|
$this->up(mt_rand(12, 50));
|
|
$this->up(mt_rand(12, 50));
|
|
break;
|
|
break;
|
|
- case '28':
|
|
|
|
- $this->content(mt_rand(155, 200));
|
|
|
|
- $this->up(mt_rand(5, 50));
|
|
|
|
- break;
|
|
|
|
case '7':
|
|
case '7':
|
|
default:
|
|
default:
|
|
- $this->content(143);
|
|
|
|
- $this->up(15);
|
|
|
|
|
|
+ $start_time = date("Y-m-d 00:00:00",(time()-86400*7));
|
|
|
|
+ $end_time = date("Y-m-d 23:59:59",time());
|
|
|
|
+ $total = PaymentLogModel::query()
|
|
|
|
+ ->where(['status'=>1,'type'=>1])
|
|
|
|
+ ->whereBetween('created_at',[$start_time,$end_time])
|
|
|
|
+ ->sum('price');
|
|
|
|
+ $this->content($total);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -111,9 +117,6 @@ class TotalUsers extends Card
|
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
|
|
<div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px">
|
|
<h2 class="ml-1 font-lg-1">{$content}</h2>
|
|
<h2 class="ml-1 font-lg-1">{$content}</h2>
|
|
</div>
|
|
</div>
|
|
-<div class="ml-1 mt-1 font-weight-bold text-80">
|
|
|
|
- {$this->renderFooter()}
|
|
|
|
-</div>
|
|
|
|
HTML;
|
|
HTML;
|
|
}
|
|
}
|
|
|
|
|