From d43f4b49741cde2162e65e8ee88e9dc437c5c2b4 Mon Sep 17 00:00:00 2001 From: xuanchen <122383162@qq.com> Date: Fri, 16 Oct 2020 16:41:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Account/LogController.php | 2 +- .../Controllers/Activity/CouponController.php | 2 +- .../Controllers/Activity/IndexController.php | 2 +- app/Admin/Controllers/HomeController.php | 174 +++++++++++++----- .../Controllers/User/IndexController.php | 31 +--- app/Admin/Controllers/Wo/IndexController.php | 1 + app/Admin/Renderable/User/ServerKey.php | 1 - app/Api/Controllers/UnionPayController.php | 8 +- packages/coupon/composer.json | 1 + packages/unionpay/composer.json | 48 ++--- 10 files changed, 173 insertions(+), 97 deletions(-) diff --git a/app/Admin/Controllers/Account/LogController.php b/app/Admin/Controllers/Account/LogController.php index a7872f4..3dffd3d 100644 --- a/app/Admin/Controllers/Account/LogController.php +++ b/app/Admin/Controllers/Account/LogController.php @@ -16,7 +16,7 @@ class LogController extends AdminController function grid() { $grid = new Grid(new AccountLog); - $grid->model()->latest(); + $grid->model()->with(['account'])->latest(); $userId = request()->user_id; $grid->model()->when($userId, function ($query, $userId) { $query->where('user_id', $userId); diff --git a/app/Admin/Controllers/Activity/CouponController.php b/app/Admin/Controllers/Activity/CouponController.php index 1f8fd3c..d8e6eed 100644 --- a/app/Admin/Controllers/Activity/CouponController.php +++ b/app/Admin/Controllers/Activity/CouponController.php @@ -16,7 +16,7 @@ class CouponController extends AdminController protected function grid() { $grid = new Grid(new ActivityCoupon); - $grid->model()->latest(); + $grid->model()->with(['outlet'])->latest(); $grid->disableActions(); $grid->disableCreateButton(); diff --git a/app/Admin/Controllers/Activity/IndexController.php b/app/Admin/Controllers/Activity/IndexController.php index 9508774..44d2423 100644 --- a/app/Admin/Controllers/Activity/IndexController.php +++ b/app/Admin/Controllers/Activity/IndexController.php @@ -73,7 +73,7 @@ class IndexController extends AdminController protected function grid() { $grid = new Grid(new Activity); - + $grid->model()->with(['grants.user', 'verifications.user']); $grid->actions(function ($actions) { $actions->disableView(); }); diff --git a/app/Admin/Controllers/HomeController.php b/app/Admin/Controllers/HomeController.php index ba3519b..29ce398 100644 --- a/app/Admin/Controllers/HomeController.php +++ b/app/Admin/Controllers/HomeController.php @@ -20,91 +20,183 @@ class HomeController extends Controller ->title('数据看版2') ->row(function (Row $row) { $row->column(2, function (Column $column) { - $column->append(new InfoBox('渠道商', 'users', 'yellow', '/admin/users?identity[identity_id]=1', User::whereHas('identity', function ($q) { $q->where('identity_id', 1); }) - ->count())); + $column->append(new InfoBox( + '渠道商', + 'users', + 'yellow', + '/admin/users?identity[identity_id]=1', + User::whereHas('identity', function ($q) { + $q->where('identity_id', 1); + })->count() + )); }); - }) ->row(function (Row $row) { $row->column(2, function (Column $column) { - $column->append(new InfoBox('核销卡券总数', '', 'blue', '/admin/coupons', Coupon::whereIn('status', [2, 3]) - ->count())); - }); - - $row->column(2, function (Column $column) { - $column->append(new InfoBox('核销成功', '', 'blue', '/admin/coupons', Coupon::where('status', 2) - ->count())); + $column->append(new InfoBox( + '核销卡券总数', + '', + 'blue', + '/admin/coupons', + Coupon::whereIn('status', [2, 3])->count() + )); }); $row->column(2, function (Column $column) { - $column->append(new InfoBox('核销失败', '', 'black', '/admin/coupons', Coupon::where('status', 3) - ->count())); + $column->append(new InfoBox( + '核销成功', + '', + 'blue', + '/admin/coupons', + Coupon::where('status', 2)->count() + )); }); $row->column(2, function (Column $column) { - $column->append(new InfoBox('资金通道结算', '', 'red', '/admin/coupons', Coupon::where('status', 2) - ->sum('price'))); + $column->append(new InfoBox( + '核销失败', + '', + 'black', + '/admin/coupons', + Coupon::where('status', 3)->count() + )); }); $row->column(2, function (Column $column) { - $column->append(new InfoBox('应打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2) - ->sum('profit'))); + $column->append(new InfoBox( + '资金通道结算', + '', + 'red', + '/admin/coupons', + Coupon::where('status', 2)->sum('price') + )); }); $row->column(2, function (Column $column) { - $column->append(new InfoBox('已打款金额', '', 'green', '/admin/coupons', Coupon::where('status', 2) - ->where('is_profit', 1) - ->sum('profit'))); + $column->append(new InfoBox( + '应打款金额', + '', + 'green', + '/admin/coupons', + Coupon::where('status', 2)->sum('profit') + )); + }); + $row->column(2, function (Column $column) { + $column->append(new InfoBox( + '已打款金额', + '', + 'green', + '/admin/coupons', + Coupon::where('status', 2) + ->where('is_profit', 1) + ->sum('profit') + )); }); }) ->row(function (Row $row) { - $coupons = Coupon::where('status', 2) - ->whereDate('created_at', now()->format('Y-m-d')) - ->get(); - $lists = [ - 'ysd10' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-10')->count(), - 'ysd25' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-25')->count(), - 'ysd50' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-50')->count(), - 'ysd100' => $coupons->where('thirdPartyGoodsId', 'YSD-full200-100')->count(), + $lists = [ + 'ysd10' => Coupon::where('status', 2) + ->whereDate('created_at', now()->format('Y-m-d')) + ->where('thirdPartyGoodsId', 'YSD-full100-10') + ->count(), + 'ysd25' => Coupon::where('status', 2) + ->whereDate('created_at', now()->format('Y-m-d')) + ->where('thirdPartyGoodsId', 'YSD-full100-25') + ->count(), + 'ysd50' => Coupon::where('status', 2) + ->whereDate('created_at', now()->format('Y-m-d')) + ->where('thirdPartyGoodsId', 'YSD-full100-50') + ->count(), + 'ysd100' => Coupon::where('status', 2) + ->whereDate('created_at', now()->format('Y-m-d')) + ->where('thirdPartyGoodsId', 'YSD-full200-100') + ->count(), ]; $row->column(2, function (Column $column) use ($lists) { - $column->append(new InfoBox('100元减10元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd10'])); + $column->append(new InfoBox( + '100元减10元成功今日总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd10'] + )); }); $row->column(2, function (Column $column) use ($lists) { - $column->append(new InfoBox('100元减25元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd25'])); + $column->append(new InfoBox( + '100元减25元成功今日总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd25'] + )); }); $row->column(2, function (Column $column) use ($lists) { - $column->append(new InfoBox('100元减50元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd50'])); + $column->append(new InfoBox( + '100元减50元成功今日总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd50'] + )); }); $row->column(2, function (Column $column) use ($lists) { - $column->append(new InfoBox('200元减100元成功今日总数', '', 'blue', '/admin/coupons', $lists['ysd100'])); + $column->append(new InfoBox( + '200元减100元成功今日总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd100'] + )); }); }) ->row(function (Row $row) { - $coupons = Coupon::where('status', 2)->get(); - $lists = [ - 'ysd10' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-10')->count(), - 'ysd25' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-25')->count(), - 'ysd50' => $coupons->where('thirdPartyGoodsId', 'YSD-full100-50')->count(), - 'ysd100' => $coupons->where('thirdPartyGoodsId', 'YSD-full200-100')->count(), + $lists = [ + 'ysd10' => Coupon::where('status', 2)->where('thirdPartyGoodsId', 'YSD-full100-10')->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) { - $column->append(new InfoBox('100元减10元成功总数', '', 'blue', '/admin/coupons', $lists['ysd10'])); + $column->append(new InfoBox( + '100元减10元成功总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd10'] + )); }); $row->column(2, function (Column $column) use ($lists) { - $column->append(new InfoBox('100元减25元成功总数', '', 'blue', '/admin/coupons', $lists['ysd25'])); + $column->append(new InfoBox( + '100元减25元成功总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd25'] + )); }); $row->column(2, function (Column $column) use ($lists) { - $column->append(new InfoBox('100元减50元成功总数', '', 'blue', '/admin/coupons', $lists['ysd50'])); + $column->append(new InfoBox( + '100元减50元成功总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd50'] + )); }); $row->column(2, function (Column $column) use ($lists) { - $column->append(new InfoBox('200元减100元成功总数', '', 'blue', '/admin/coupons', $lists['ysd100'])); + $column->append(new InfoBox( + '200元减100元成功总数', + '', + 'blue', + '/admin/coupons', + $lists['ysd100'] + )); }); }); } diff --git a/app/Admin/Controllers/User/IndexController.php b/app/Admin/Controllers/User/IndexController.php index 0b81aad..dc292ee 100644 --- a/app/Admin/Controllers/User/IndexController.php +++ b/app/Admin/Controllers/User/IndexController.php @@ -6,7 +6,8 @@ use App\Admin\Actions\User\Callback; use App\Admin\Actions\User\Profit; use App\Admin\Actions\User\ReCode; use App\Admin\Actions\User\RefD3Key; -use App\Admin\Exporters\UsersExport; +use App\Admin\Renderable\User\Rule; +use App\Admin\Renderable\User\ServerKey; use App\Models\Area; use App\Models\User; use Auth; @@ -32,7 +33,7 @@ class IndexController extends AdminController { $user = Auth::guard('admin')->user(); $grid = new Grid(new User); - + $grid->model()->with(['parent']); $grid->actions(function ($actions) use ($user) { $actions->disableDelete(); $actions->disableView(); @@ -112,19 +113,7 @@ class IndexController extends AdminController $grid->column('密钥')->display(function ($title, $column) { return '点击查看'; - })->modal(function ($model) { - $data = [ - [ - '服务秘钥', $model->server_key ?? '---', - ], - [ - 'DES3秘钥', $model->des3key ?? '---', - ], - ]; - - return new Table(['名称', '参数'], $data); - - }); + })->modal(ServerKey::class); $grid->column('nickname', '渠道/网点'); $grid->column('用户身份')->display(function () { @@ -142,17 +131,7 @@ class IndexController extends AdminController $grid->column('分润规则')->display(function ($title, $column) { return '点击展开'; - })->modal(function ($model) { - - if ($model->code) { - $codes = $model->code->map(function ($code) { - return $code->only(['name', 'code', 'profit']); - }); - - return new Table(['名称', '规则项', '分润金额(元)'], $codes->toArray()); - } - - }); + })->modal(Rule::class); $grid->column('created_at', '注册时间'); $grid->disableExport(false); diff --git a/app/Admin/Controllers/Wo/IndexController.php b/app/Admin/Controllers/Wo/IndexController.php index ac96bc5..28ae922 100644 --- a/app/Admin/Controllers/Wo/IndexController.php +++ b/app/Admin/Controllers/Wo/IndexController.php @@ -24,6 +24,7 @@ class IndexController extends AdminController protected function grid() { $grid = new Grid(new WoCoupon); + $grid->model()->with(['user']); $grid->disableCreateButton(); $grid->disableBatchActions(); // $grid->disableActions(); diff --git a/app/Admin/Renderable/User/ServerKey.php b/app/Admin/Renderable/User/ServerKey.php index 37e36ea..9e52886 100644 --- a/app/Admin/Renderable/User/ServerKey.php +++ b/app/Admin/Renderable/User/ServerKey.php @@ -25,7 +25,6 @@ class ServerKey implements Renderable $table = new Table(['名称', '参数'], $data); return $table->render(); - die(); } } \ No newline at end of file diff --git a/app/Api/Controllers/UnionPayController.php b/app/Api/Controllers/UnionPayController.php index e2a471a..a835b3c 100644 --- a/app/Api/Controllers/UnionPayController.php +++ b/app/Api/Controllers/UnionPayController.php @@ -2,16 +2,20 @@ namespace App\Api\Controllers; -use App\Exceptions\ApiException; use Illuminate\Http\Request; use XuanChen\UnionPay\UnionPay; +use Illuminate\Support\Facades\Http; class UnionPayController extends Controller { public function index(Request $request) { - + $response = Http::post(); + die(); + $a = '0.1'; + $b = '0.1'; + dump($a > $b); $action = new UnionPay($request->all()); // $sign = $action->getSign(false); $sign = 'd8e5bf46d0d9f1da702170c2e141d85cf3ca785106886dbfedb3310ee9ce2ca3f18a2e6c179ec9908fc4f41d05df463634106918bdbefc63b8f199c7d2f3b0d45510b4dd6ccdf4549e11a8551a5098b14c01fdaa5840a4608f462fdafdc14b8f2a35471da315d8245a4ef6281b6e04bd22d5a266500a6caf6e5203202c37111d'; diff --git a/packages/coupon/composer.json b/packages/coupon/composer.json index ac5e154..8380114 100644 --- a/packages/coupon/composer.json +++ b/packages/coupon/composer.json @@ -2,6 +2,7 @@ "name": "xuanchen/coupon", "description": "卡券相关", "license": "MIT", + "homepage": "https://gitee.com/xdeepu/coupon", "authors": [ { "name": "玄尘", diff --git a/packages/unionpay/composer.json b/packages/unionpay/composer.json index a0f3e59..6a49a84 100644 --- a/packages/unionpay/composer.json +++ b/packages/unionpay/composer.json @@ -1,27 +1,27 @@ { - "name": "xuanchen/unionPay", - "description": "银联对接", - "license": "MIT", - "authors": [ - { - "name": "玄尘", - "email": "122383162@qq.com" + "name": "xuanchen/unionpay", + "description": "银联对接", + "license": "MIT", + "authors": [ + { + "name": "玄尘", + "email": "122383162@qq.com" + } + ], + "require": { + "php": ">=7.1.3", + "laravel/framework": "*" + }, + "autoload": { + "psr-0": { + "XuanChen\\UnionPay": "src/" + } + }, + "extra": { + "laravel": { + "providers": [ + "XuanChen\\UnionPay\\ServiceProvider" + ] + } } - ], - "require": { - "php": ">=7.1.3", - "laravel/framework": "*" - }, - "autoload": { - "psr-0": { - "XuanChen\\UnionPay": "src/" - } - }, - "extra": { - "laravel": { - "providers": [ - "XuanChen\\UnionPay\\ServiceProvider" - ] - } - } }