From 2d46ca1b94cffaf8844dc1904277a1b1b82f64c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 1 Apr 2022 09:54:53 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BD=93=E6=9C=9F?= =?UTF-8?q?=E8=BF=9B=E8=B4=A7=E4=B8=9A=E7=BB=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dealer/CalculatePurchaseAmountOfCurrentPeriod.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php b/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php index 0396f595..d4d86243 100644 --- a/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php +++ b/app/Actions/Dealer/CalculatePurchaseAmountOfCurrentPeriod.php @@ -22,11 +22,9 @@ class CalculatePurchaseAmountOfCurrentPeriod $tz = now(); if ($tz->day >= 20) { - // 上月20号-当月19号的进货业绩 - $startAt = $tz->copy()->subMonthNoOverflow()->setDay(20)->startOfDay(); + $startAt = $tz->setDay(20)->startOfDay(); } else { - // 上上月20号-上月19号的进货业绩 - $startAt = $tz->copy()->subMonthsNoOverflow(2)->setDay(20)->startOfDay(); + $startAt = $tz->subMonthNoOverflow()->setDay(20)->startOfDay(); } return bcmul($this->calculatePurchaseAmount->handle($dealer, $startAt), '1', 2); From b454d36257f5f3ac43766b3c8f34eda9375fd163 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 1 Apr 2022 14:54:36 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E9=80=BB=E8=BE=91=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=90=8C=E6=97=B6=E5=88=A0=E9=99=A4=E7=94=A8=E6=88=B7=E6=89=80?= =?UTF-8?q?=E6=9C=89token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Controllers/UserController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Admin/Controllers/UserController.php b/app/Admin/Controllers/UserController.php index bcd96658..2a50508d 100644 --- a/app/Admin/Controllers/UserController.php +++ b/app/Admin/Controllers/UserController.php @@ -295,6 +295,9 @@ class UserController extends AdminController $user->update([ 'phone'=>null, ]); + //删除当前登录token + $user->tokens()->delete(); + // return response('删除成功'); return response()->json([ 'status'=> true, From a96e157868b7dbc4e858ee1357fa11cdee278e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 1 Apr 2022 15:07:56 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E8=B0=83=E5=BA=A6=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Kernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index bd8371a0..6eec529e 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -29,7 +29,7 @@ class Kernel extends ConsoleKernel ->runInBackground(); $schedule->command('dealer:purchase-subsidy-settle') - ->twiceMonthly(20, '3:00') + ->monthlyOn(20, '3:00') ->runInBackground(); $schedule->command('dealer:manager-subsidy-settle') From 5fd5aebbac3e98d33bc3a29aab1bea4d67b05d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 1 Apr 2022 15:54:31 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=AF=8F=E6=9C=88=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MonthlyStatisticsController.php | 84 +++++++++++++++++++ app/Admin/routes.php | 1 + database/seeders/AdminPermissionSeeder.php | 4 + 3 files changed, 89 insertions(+) create mode 100644 app/Admin/Controllers/MonthlyStatisticsController.php diff --git a/app/Admin/Controllers/MonthlyStatisticsController.php b/app/Admin/Controllers/MonthlyStatisticsController.php new file mode 100644 index 00000000..0be6acdd --- /dev/null +++ b/app/Admin/Controllers/MonthlyStatisticsController.php @@ -0,0 +1,84 @@ +header('首页') + ->description('首页') + ->body(function (Row $row) { + if (blank($date = request('date'))) { + $date = date('Y-m'); + } + + $start = Carbon::parse($date)->startOfMonth(); + $end = $start->copy()->endOfMonth(); + + $row->column(12, function (Column $column) use ($date) { + $form = << +
+ +
+ + + + +
+
+ + + HTML; + + $column->row(new Card(null, $form)); + }); + + $totalPreIncome = WalletLog::where('loggable_type', 'distribution_pre_income') + ->whereBetween('created_at', [$start, $end]) + ->sum('change_balance'); + + // 提现总额 + $withdrawAmount = WalletToBankLog::where('status', WalletToBankLog::STATUS_AGREE) + ->whereBetween('updated_at', [$start, $end]) + ->sum('amount'); + + // 余额支付总额 + $totalOrderAmount = Order::where('status', Order::STATUS_COMPLETED) + ->whereBetween('completed_at', [$start, $end]) + ->where('pay_way', PayWay::Balance) + ->sum('total_amount'); + + $row->column(3, new InfoBox('返利总额', bcdiv($totalPreIncome, '100', 2), 'fa fa-cny')); + $row->column(3, new InfoBox('提现总额', bcdiv($withdrawAmount, '100', 2), 'fa fa-cny')); + $row->column(3, new InfoBox('余额支付总额', bcdiv($totalOrderAmount, '100', 2), 'fa fa-cny')); + }); + } +} diff --git a/app/Admin/routes.php b/app/Admin/routes.php index cb521eb3..fcb2e921 100644 --- a/app/Admin/routes.php +++ b/app/Admin/routes.php @@ -168,6 +168,7 @@ Route::group([ ['index'] )->names('sales_value_logs'); + $router->get('monthly-statistics', 'MonthlyStatisticsController@index')->name('monthly-statistics.index'); //经销商 $router->resource('dealer-products', 'DealerProductController')->names('dealer_products'); diff --git a/database/seeders/AdminPermissionSeeder.php b/database/seeders/AdminPermissionSeeder.php index fc5e274f..4c58862d 100644 --- a/database/seeders/AdminPermissionSeeder.php +++ b/database/seeders/AdminPermissionSeeder.php @@ -414,6 +414,10 @@ class AdminPermissionSeeder extends Seeder 'name' =>'活动管理', 'curd' => true, ], + 'monthly-statistics' => [ + 'name' => '每月统计', + 'curd' => ['index'], + ], ]; // try { // DB::begintransaction(); From 6668e210b4381368223ef482bbdd3db95f9d9e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 1 Apr 2022 15:56:49 +0800 Subject: [PATCH 5/5] Fix --- app/Admin/Controllers/MonthlyStatisticsController.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Admin/Controllers/MonthlyStatisticsController.php b/app/Admin/Controllers/MonthlyStatisticsController.php index 0be6acdd..425d6ea7 100644 --- a/app/Admin/Controllers/MonthlyStatisticsController.php +++ b/app/Admin/Controllers/MonthlyStatisticsController.php @@ -32,8 +32,7 @@ class MonthlyStatisticsController extends Controller ); return $content - ->header('首页') - ->description('首页') + ->header('每月统计') ->body(function (Row $row) { if (blank($date = request('date'))) { $date = date('Y-m');