This commit is contained in:
2021-02-01 21:16:19 +08:00
parent 2cad439db6
commit ea4aab991d
2 changed files with 183 additions and 174 deletions

View File

@@ -16,189 +16,196 @@ class HomeController extends Controller
public function index(Content $content) public function index(Content $content)
{ {
return $content return $content->title('数据看版3')
->title('数据看版3') ->row(function (Row $row) {
->row(function (Row $row) { $row->column(2, function (Column $column) {
$row->column(2, function (Column $column) { $column->append(new InfoBox(
$column->append(new InfoBox( '渠道商',
'渠道商', 'users',
'users', 'yellow',
'yellow', '/admin/users?identity[identity_id]=1',
'/admin/users?identity[identity_id]=1', User::whereHas('identity', function ($q) {
User::whereHas('identity', function ($q) { $q->where('identity_id', 1);
$q->where('identity_id', 1); })->count()
})->count() ));
)); });
}); })
}) ->row(function (Row $row) {
->row(function (Row $row) { $row->column(2, function (Column $column) {
$row->column(2, function (Column $column) { $column->append(new InfoBox(
$column->append(new InfoBox( '核销卡券总数',
'核销卡券总数', '',
'', 'blue',
'blue', '/admin/coupons',
'/admin/coupons', Coupon::whereIn('status', [2, 3])->count()
Coupon::whereIn('status', [2, 3])->count() ));
)); });
}); $row->column(2, function (Column $column) {
$row->column(2, function (Column $column) { $column->append(new InfoBox(
$column->append(new InfoBox( '核销成功',
'核销成功', '',
'', 'blue',
'blue', '/admin/coupons',
'/admin/coupons', Coupon::where('status', 2)->count()
Coupon::where('status', 2)->count() ));
)); });
}); $row->column(2, function (Column $column) {
$row->column(2, function (Column $column) { $column->append(new InfoBox(
$column->append(new InfoBox( '核销失败',
'核销失败', '',
'', 'black',
'black', '/admin/coupons',
'/admin/coupons', Coupon::where('status', 3)->count()
Coupon::where('status', 3)->count() ));
)); });
}); $row->column(2, function (Column $column) {
$row->column(2, function (Column $column) { $column->append(new InfoBox(
$column->append(new InfoBox( '资金通道结算',
'资金通道结算', '',
'', 'red',
'red', '/admin/coupons',
'/admin/coupons', Coupon::where('status', 2)->sum('price')
Coupon::where('status', 2)->sum('price') ));
)); });
}); $row->column(2, function (Column $column) {
$row->column(2, function (Column $column) { $column->append(new InfoBox(
$column->append(new InfoBox( '应打款金额',
'应打款金额', '',
'', 'green',
'green', '/admin/coupons',
'/admin/coupons', Coupon::where('status', 2)->sum('profit')
Coupon::where('status', 2)->sum('profit') ));
)); });
}); $row->column(2, function (Column $column) {
$row->column(2, function (Column $column) { $column->append(new InfoBox(
$column->append(new InfoBox( '已打款金额',
'已打款金额', '',
'', 'green',
'green', '/admin/coupons',
'/admin/coupons', Coupon::where('status', 2)
Coupon::where('status', 2) ->where('is_profit', 1)
->where('is_profit', 1) ->sum('profit')
->sum('profit') ));
)); });
}); })
}) ->row(function (Row $row) {
->row(function (Row $row) {
$lists = [ $lists = [
'ysd10' => Coupon::where('status', 2) 'ysd10' => Coupon::where('status', 2)
->whereDate('created_at', now()->format('Y-m-d')) ->whereDate('created_at', now()->format('Y-m-d'))
->where('thirdPartyGoodsId', 'YSD-full100-10') ->where('thirdPartyGoodsId', 'YSD-full100-10')
->count(), ->count(),
'ysd25' => Coupon::where('status', 2) 'ysd25' => Coupon::where('status', 2)
->whereDate('created_at', now()->format('Y-m-d')) ->whereDate('created_at', now()->format('Y-m-d'))
->where('thirdPartyGoodsId', 'YSD-full100-25') ->where('thirdPartyGoodsId', 'YSD-full100-25')
->count(), ->count(),
'ysd50' => Coupon::where('status', 2) 'ysd50' => Coupon::where('status', 2)
->whereDate('created_at', now()->format('Y-m-d')) ->whereDate('created_at', now()->format('Y-m-d'))
->where('thirdPartyGoodsId', 'YSD-full100-50') ->where('thirdPartyGoodsId', 'YSD-full100-50')
->count(), ->count(),
'ysd100' => Coupon::where('status', 2) 'ysd100' => Coupon::where('status', 2)
->whereDate('created_at', now()->format('Y-m-d')) ->whereDate('created_at', now()->format('Y-m-d'))
->where('thirdPartyGoodsId', 'YSD-full200-100') ->where('thirdPartyGoodsId', 'YSD-full200-100')
->count(), ->count(),
]; ];
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'100元减10元成功今日总数', '100元减10元成功今日总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd10'] $lists['ysd10']
)); ));
}); });
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'100元减25元成功今日总数', '100元减25元成功今日总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd25'] $lists['ysd25']
)); ));
}); });
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'100元减50元成功今日总数', '100元减50元成功今日总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd50'] $lists['ysd50']
)); ));
}); });
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'200元减100元成功今日总数', '200元减100元成功今日总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd100'] $lists['ysd100']
)); ));
}); });
}) })
->row(function (Row $row) { ->row(function (Row $row) {
$lists = [ $lists = [
'ysd10' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full100-10')->count(), 'ysd10' => Coupon::where('status', 2)
'ysd25' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full100-25')->count(), ->where('thirdPartyGoodsId', 'YSD-full100-10')
'ysd50' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full100-50')->count(), ->count(),
'ysd100' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full200-100')->count(), 'ysd25' => Coupon::where('status', 2)
]; ->where('thirdPartyGoodsId', 'YSD-full100-25')
->count(),
'ysd50' => Coupon::where('status', 2)
->where('thirdPartyGoodsId', 'YSD-full100-50')
->count(),
'ysd100' => Coupon::where('status', 2)
->where('thirdPartyGoodsId', 'YSD-full200-100')
->count(),
];
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'100元减10元成功总数', '100元减10元成功总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd10'] $lists['ysd10']
)); ));
}); });
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'100元减25元成功总数', '100元减25元成功总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd25'] $lists['ysd25']
)); ));
}); });
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'100元减50元成功总数', '100元减50元成功总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd50'] $lists['ysd50']
)); ));
}); });
$row->column(2, function (Column $column) use ($lists) { $row->column(2, function (Column $column) use ($lists) {
$column->append(new InfoBox( $column->append(new InfoBox(
'200元减100元成功总数', '200元减100元成功总数',
'', '',
'blue', 'blue',
'/admin/coupons', '/admin/coupons',
$lists['ysd100'] $lists['ysd100']
)); ));
}); });
}); });
} }
} }

View File

@@ -1,5 +1,8 @@
<?php <?php
/**
* 核销包
*/
return [ return [
'coupon_model' => \App\Models\Coupon::class, 'coupon_model' => \App\Models\Coupon::class,
'rules' => [ 'rules' => [
@@ -9,7 +12,6 @@ return [
'model' => \XuanChen\Coupon\Action\YsdAction::class, 'model' => \XuanChen\Coupon\Action\YsdAction::class,
], ],
'unionpay' => [ 'unionpay' => [
// 'pattern' => '/^YSD\d{12}/',
'pattern' => '/^66406/', 'pattern' => '/^66406/',
'model' => \XuanChen\Coupon\Action\YsdAction::class, 'model' => \XuanChen\Coupon\Action\YsdAction::class,
], ],