添加指定升级规则
parent
1a707d98fb
commit
33b5f47ef7
|
|
@ -2,8 +2,15 @@
|
|||
|
||||
namespace App\Admin\Controllers;
|
||||
|
||||
use App\Admin\Metrics\Dashboard;
|
||||
use App\Admin\Metrics\NewUsers;
|
||||
use App\Admin\Metrics\Orders;
|
||||
use App\Admin\Metrics\StatisticsTotal;
|
||||
use App\Admin\Metrics\Users;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Dcat\Admin\Layout\Column;
|
||||
use Dcat\Admin\Layout\Content;
|
||||
use Dcat\Admin\Layout\Row;
|
||||
|
||||
class HomeController extends Controller
|
||||
{
|
||||
|
|
@ -11,6 +18,18 @@ class HomeController extends Controller
|
|||
{
|
||||
return $content
|
||||
->header('首页')
|
||||
->description('开发中...');
|
||||
->description('开发中...')
|
||||
->body(function (Row $row) {
|
||||
$row->column(6, function (Column $column) {
|
||||
$column->row(Dashboard::title());
|
||||
$column->row(new StatisticsTotal());
|
||||
});
|
||||
|
||||
$row->column(6, function (Column $column) {
|
||||
$column->row(new NewUsers());
|
||||
$column->row(new Orders());
|
||||
$column->row(new Users());
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,5 +60,6 @@ class App extends Form
|
|||
$this->text('article_about_us', '关于我们文章指定(链接)')->value($appSettings['article_about_us'] ?? '');
|
||||
$this->text('article_user_promotion_agreement', '服务协议文章指定(链接)')->value($appSettings['article_user_promotion_agreement'] ?? '');
|
||||
$this->text('article_user_hide_agreement', '隐私协议文章指定(链接)')->value($appSettings['article_user_hide_agreement'] ?? '');
|
||||
$this->text('article_user_agent_agreement', '升级规则文章指定(链接)')->value($appSettings['article_user_agent_agreement'] ?? '');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Metrics;
|
||||
|
||||
class Dashboard
|
||||
{
|
||||
public static function title()
|
||||
{
|
||||
return view('admin.metrics.dashboard');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Metrics;
|
||||
|
||||
use Dcat\Admin\Widgets\Metrics\Line;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class NewUsers extends Line
|
||||
{
|
||||
/**
|
||||
* 初始化卡片内容
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->title('新注册');
|
||||
$this->dropdown([
|
||||
'7' => '最近7天',
|
||||
'30' => '最近30天',
|
||||
'90' => '最近3个月',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function handle(Request $request)
|
||||
{
|
||||
$generator = function ($len, $min = 10, $max = 300) {
|
||||
for ($i = 0; $i <= $len; $i++) {
|
||||
yield mt_rand($min, $max);
|
||||
}
|
||||
};
|
||||
|
||||
switch ($request->get('option')) {
|
||||
case '365':
|
||||
// 卡片内容
|
||||
$this->withContent(mt_rand(1000, 5000).'k');
|
||||
// 图表数据
|
||||
$this->withChart(collect($generator(30))->toArray());
|
||||
break;
|
||||
case '30':
|
||||
// 卡片内容
|
||||
$this->withContent(mt_rand(400, 1000).'k');
|
||||
// 图表数据
|
||||
$this->withChart(collect($generator(30))->toArray());
|
||||
break;
|
||||
case '28':
|
||||
// 卡片内容
|
||||
$this->withContent(mt_rand(400, 1000).'k');
|
||||
// 图表数据
|
||||
$this->withChart(collect($generator(28))->toArray());
|
||||
break;
|
||||
case '7':
|
||||
default:
|
||||
// 卡片内容
|
||||
$this->withContent('89.2k');
|
||||
// 图表数据
|
||||
$this->withChart([28, 40, 36, 52, 38, 60, 55]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置图表数据.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withChart(array $data)
|
||||
{
|
||||
return $this->chart([
|
||||
'series' => [
|
||||
[
|
||||
'name' => $this->title,
|
||||
'data' => $data,
|
||||
],
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置卡片内容.
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withContent($content)
|
||||
{
|
||||
return $this->content(
|
||||
<<<HTML
|
||||
<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>
|
||||
<span class="mb-0 mr-1 text-80">{$this->title}</span>
|
||||
</div>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,116 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Metrics;
|
||||
|
||||
use Dcat\Admin\Admin;
|
||||
use Dcat\Admin\Widgets\Metrics\Bar;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Orders extends Bar
|
||||
{
|
||||
/**
|
||||
* 初始化卡片内容
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$color = Admin::color();
|
||||
|
||||
$dark35 = $color->dark35();
|
||||
|
||||
// 卡片内容宽度
|
||||
$this->contentWidth(5, 7);
|
||||
// 标题
|
||||
$this->title('订单');
|
||||
// 设置下拉选项
|
||||
$this->dropdown([
|
||||
'7' => '最近7天',
|
||||
'28' => '最近30天',
|
||||
]);
|
||||
// 设置图表颜色
|
||||
$this->chartColors([
|
||||
$dark35,
|
||||
$dark35,
|
||||
$dark35,
|
||||
$dark35,
|
||||
$dark35,
|
||||
$dark35,
|
||||
$color->primary(),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function handle(Request $request)
|
||||
{
|
||||
switch ($request->get('option')) {
|
||||
case '7':
|
||||
default:
|
||||
// 卡片内容
|
||||
$this->withContent('2.7k', '+5.2%');
|
||||
|
||||
// 图表数据
|
||||
$this->withChart([
|
||||
[
|
||||
'name' => 'Sessions',
|
||||
'data' => [75, 125, 225, 250, 125, 75, 25],
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置图表数据.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withChart(array $data)
|
||||
{
|
||||
return $this->chart([
|
||||
'series' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置卡片内容.
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $value
|
||||
* @param string $style
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withContent($title, $value, $style = 'success')
|
||||
{
|
||||
// 根据选项显示
|
||||
$label = strtolower(
|
||||
$this->dropdown[request()->option] ?? 'last 7 days'
|
||||
);
|
||||
|
||||
$minHeight = '183px';
|
||||
|
||||
return $this->content(
|
||||
<<<HTML
|
||||
<div class="d-flex p-1 flex-column justify-content-between" style="padding-top: 0;width: 100%;height: 100%;min-height: {$minHeight}">
|
||||
<div class="text-left">
|
||||
<h1 class="font-lg-2 mt-2 mb-0">{$title}</h1>
|
||||
<!-- <h5 class="font-medium-2" style="margin-top: 10px;">
|
||||
<span class="text-{$style}">{$value} </span>
|
||||
<span>vs {$label}</span>
|
||||
</h5> -->
|
||||
</div>
|
||||
|
||||
<a href="#" class="btn btn-primary shadow waves-effect waves-light">查看详情 <i class="feather icon-chevrons-right"></i></a>
|
||||
</div>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Metrics;
|
||||
|
||||
use Dcat\Admin\Widgets\Metrics\RadialBar;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class StatisticsTotal extends RadialBar
|
||||
{
|
||||
/**
|
||||
* 初始化卡片内容
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->title('统计预览');
|
||||
$this->height(400);
|
||||
$this->contentWidth(12, 0);
|
||||
|
||||
// $this->chartLabels('Completed Tickets');
|
||||
// $this->dropdown([
|
||||
// '7' => 'Last 7 Days',
|
||||
// '28' => 'Last 28 Days',
|
||||
// '30' => 'Last Month',
|
||||
// '365' => 'Last Year',
|
||||
// ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function handle(Request $request)
|
||||
{
|
||||
// 卡片内容
|
||||
$this->withContent([
|
||||
'total_points'=> 999999999,
|
||||
'total_wallet'=> 999999999.99,
|
||||
'total_balance'=> 999999999.99,
|
||||
'total_distribution'=> 999999999.99,
|
||||
'total_quota_v2' => 999999999.99,
|
||||
'total_quota_v1' => 999999999.99,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片内容
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withContent($content)
|
||||
{
|
||||
return $this->content(
|
||||
<<<HTML
|
||||
<div class="d-flex row text-center align-items-center justify-content-center" >
|
||||
|
||||
<div class="col-sm-4">
|
||||
<h1 class="font-lg-2 mt-2 mb-0">{$content['total_distribution']}</h1>
|
||||
当前预收益
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h1 class="font-lg-2 mt-2 mb-0">{$content['total_wallet']}</h1>
|
||||
总可提
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h1 class="font-lg-2 mt-2 mb-0">{$content['total_balance']}</h1>
|
||||
总余额
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex row text-center align-items-center justify-content-center" >
|
||||
<div class="col-sm-4">
|
||||
<h1 class="font-lg-2 mt-2 mb-0">{$content['total_points']}</h1>
|
||||
总积分
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h1 class="font-lg-2 mt-2 mb-0">{$content['total_quota_v2']}</h1>
|
||||
新配额
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h1 class="font-lg-2 mt-2 mb-0">{$content['total_quota_v1']}</h1>
|
||||
老配额
|
||||
</div>
|
||||
</div>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片底部内容.
|
||||
*
|
||||
* @param string $new
|
||||
* @param string $open
|
||||
* @param string $response
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withFooter($new, $open, $response)
|
||||
{
|
||||
return $this->footer(
|
||||
<<<HTML
|
||||
<div class="d-flex justify-content-between p-1" style="padding-top: 0!important;">
|
||||
<div class="text-center">
|
||||
<p>New Tickets</p>
|
||||
<span class="font-lg-1">{$new}</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>Open Tickets</p>
|
||||
<span class="font-lg-1">{$open}</span>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<p>Response Time</p>
|
||||
<span class="font-lg-1">{$response}</span>
|
||||
</div>
|
||||
</div>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
<?php
|
||||
|
||||
namespace App\Admin\Metrics;
|
||||
|
||||
use App\Models\UserInfo;
|
||||
use Dcat\Admin\Widgets\Metrics\Donut;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class Users extends Donut
|
||||
{
|
||||
/**
|
||||
* 初始化卡片内容
|
||||
*/
|
||||
protected function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
$this->title('累计会员');
|
||||
$this->contentWidth(4, 8);
|
||||
$this->chartLabels(UserInfo::$agentLevelTexts);
|
||||
$this->chartHeight(300);
|
||||
$this->chartOption('chart.width', '300');
|
||||
$this->chart->style('float: none;');
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理请求
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return mixed|void
|
||||
*/
|
||||
public function handle(Request $request)
|
||||
{
|
||||
switch ($request->get('option')) {
|
||||
case '365':
|
||||
case '30':
|
||||
case '28':
|
||||
case '7':
|
||||
default:
|
||||
// 卡片内容
|
||||
$this->withContent(23043, 14658, 4758);
|
||||
|
||||
// 图表数据
|
||||
$this->withChart([70, 52, 26]);
|
||||
|
||||
// 总数
|
||||
$this->chartTotal('Total', 344);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置图表数据.
|
||||
*
|
||||
* @param array $data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withChart(array $data)
|
||||
{
|
||||
return $this->chart([
|
||||
'series' => $data,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 卡片内容.
|
||||
*
|
||||
* @param int $finished
|
||||
* @param int $pending
|
||||
* @param int $rejected
|
||||
* @param int $finished
|
||||
* @param int $pending
|
||||
* @param int $rejected
|
||||
* @param int $rejected
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withContent($finished, $pending, $rejected)
|
||||
{
|
||||
return $this->content(
|
||||
<<<HTML
|
||||
<div class="col-12 d-flex flex-column flex-wrap text-center" style="max-width: 220px">
|
||||
<div class="chart-info d-flex justify-content-between mb-1 mt-2" >
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i>
|
||||
<span class="text-bold-600 ml-50">粉丝</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$finished}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1">
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
|
||||
<span class="text-bold-600 ml-50">店铺</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$pending}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-info d-flex justify-content-between mb-1">
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
|
||||
<span class="text-bold-600 ml-50">社区</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$rejected}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-info d-flex justify-content-between mb-1" >
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-primary"></i>
|
||||
<span class="text-bold-600 ml-50">区级</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$finished}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1">
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-warning"></i>
|
||||
<span class="text-bold-600 ml-50">市级</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$pending}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chart-info d-flex justify-content-between mb-1">
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
|
||||
<span class="text-bold-600 ml-50">省级</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$rejected}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-info d-flex justify-content-between mb-1">
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
|
||||
<span class="text-bold-600 ml-50">分公司</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$rejected}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="chart-info d-flex justify-content-between mb-1">
|
||||
<div class="series-info d-flex align-items-center">
|
||||
<i class="fa fa-circle-o text-bold-700 text-danger"></i>
|
||||
<span class="text-bold-600 ml-50">董事</span>
|
||||
</div>
|
||||
<div class="product-result">
|
||||
<span>{$rejected}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
HTML
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -31,6 +31,7 @@ class AppSettingSeeder extends Seeder
|
|||
'article_about_us' => env('APP_URL', '').'/h5/articles/1',
|
||||
'article_user_promotion_agreement' => env('APP_URL', '').'/h5/articles/2',
|
||||
'article_user_hide_agreement' => env('APP_URL', '').'/h5/articles/3',
|
||||
'article_user_agent_agreement' => env('APP_URL', '').'/h5/articles/4',
|
||||
'invite_uri' => '',
|
||||
'search_hot_keys' => '搜索热词,分词1,分词2,分词3',
|
||||
],
|
||||
|
|
|
|||
|
|
@ -0,0 +1,74 @@
|
|||
<style>
|
||||
.dashboard-title .links {
|
||||
text-align: center;
|
||||
margin-bottom: 2.5rem;
|
||||
}
|
||||
.dashboard-title .links > a {
|
||||
padding: 0 25px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
letter-spacing: .1rem;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
/* color: #fff; */
|
||||
}
|
||||
.dashboard-title h1 {
|
||||
font-weight: 200;
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
.dashboard-title .avatar {
|
||||
background: #fff;
|
||||
border: 2px solid #fff;
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="dashboard-title card">
|
||||
<div class="card-body">
|
||||
<div class="text-center ">
|
||||
<img class="avatar img-circle shadow mt-1" src="{{ admin_asset('/images/logo.png') }}">
|
||||
|
||||
<div class="text-center mb-1">
|
||||
<h1 class="mb-3 mt-2">{{ config('admin.name') }}</h1>
|
||||
<div class="links">
|
||||
<!-- <button class="btn btn-primary filter-btn-Lh3s1sjj ">
|
||||
<span class="d-none d-sm-inline"> 售后-待处理</span>
|
||||
<span class="badge badge-danger">5</span>
|
||||
</button>
|
||||
<button class="btn btn-primary filter-btn-Lh3s1sjj ">
|
||||
<span class="d-none d-sm-inline"> 售后-待验收</span>
|
||||
<span class="badge badge-danger">5</span>
|
||||
</button>
|
||||
<button class="btn btn-primary filter-btn-Lh3s1sjj ">
|
||||
<span class="d-none d-sm-inline"> 售后-待审核</span>
|
||||
<span class="badge badge-danger">5</span>
|
||||
</button>
|
||||
<button class="btn btn-primary filter-btn-Lh3s1sjj ">
|
||||
<span class="d-none d-sm-inline"> 订单-待发货</span>
|
||||
<span class="badge badge-danger">5</span>
|
||||
</button>
|
||||
<button class="btn btn-primary filter-btn-Lh3s1sjj ">
|
||||
<span class="d-none d-sm-inline"> 商品-待审核</span>
|
||||
<span class="badge badge-danger">5</span>
|
||||
</button> -->
|
||||
<a href="#" target="_blank" class="btn btn-warning ">售后-待处理
|
||||
<span class="badge badge-danger">5</span>
|
||||
</a>
|
||||
<a href="#" target="_blank" class="btn btn-info ">售后-待验收
|
||||
<span class="badge badge-danger">5</span>
|
||||
</a>
|
||||
<a href="#" target="_blank" class="btn btn-warning ">售后-待审核
|
||||
<span class="badge badge-danger">5</span>
|
||||
</a>
|
||||
<a href="#" target="_blank" class="btn btn-warning ">订单-待发货
|
||||
<span class="badge badge-danger">5</span>
|
||||
</a>
|
||||
<a href="#" target="_blank" class="btn btn-warning ">商品-待审核
|
||||
<span class="badge badge-danger">5</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue