7 changed files with 365 additions and 48 deletions
-
2app/Admin/Actions/Grid/v3/GoodsActivitySetting.php
-
78app/Admin/Actions/Grid/v3/OrderReportLastMonth.php
-
79app/Admin/Actions/Grid/v3/OrderReportLastWeek.php
-
77app/Admin/Actions/Grid/v3/OrderReportToday.php
-
78app/Admin/Actions/Grid/v3/OrderReportYesterday.php
-
82app/Admin/Controllers/v3/OrderReportController.php
-
17app/Admin/Repositories/v3/OrderReport.php
@ -0,0 +1,78 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Admin\Actions\Grid\v3; |
||||
|
|
||||
|
use Dcat\Admin\Actions\Response; |
||||
|
use Dcat\Admin\Traits\HasPermissions; |
||||
|
use Dcat\Admin\Tree\AbstractTool; |
||||
|
use Illuminate\Contracts\Auth\Authenticatable; |
||||
|
use Illuminate\Database\Eloquent\Model; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class OrderReportLastMonth extends AbstractTool |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* @return string |
||||
|
*/ |
||||
|
protected $title = '上月'; |
||||
|
|
||||
|
/** |
||||
|
* Handle the action request. |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return Response |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
//上月初
|
||||
|
$lastMonthStart = date('Y-m-d', strtotime('-1 month', strtotime(date('Y-m', time()) . '-01'))); |
||||
|
// 上月底
|
||||
|
$lastMonthEnd = date('Y-m-d', strtotime(date('Y-m', time()) . '-01') - 86400); |
||||
|
return $this->response() |
||||
|
->success('查询中~') |
||||
|
->redirect('/order_report?start_time='.$lastMonthStart.'&end_time='.$lastMonthEnd); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return string|void |
||||
|
*/ |
||||
|
// public function href()
|
||||
|
// {
|
||||
|
// return admin_url('/');
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @return string|array|void |
||||
|
*/ |
||||
|
public function confirm() |
||||
|
{ |
||||
|
// return ['Confirm?', 'contents'];
|
||||
|
} |
||||
|
|
||||
|
// protected function actionScript()
|
||||
|
// {
|
||||
|
|
||||
|
// return <<<JS
|
||||
|
// function (data, target, action) {
|
||||
|
// console.log('发起请求之前', data, target, action);
|
||||
|
|
||||
|
// // return false; 在这里return false可以终止执行后面的操作
|
||||
|
|
||||
|
// // 更改传递到接口的主键值
|
||||
|
// action.options.key = 123;
|
||||
|
// }
|
||||
|
// JS;
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @param Model|Authenticatable|HasPermissions|null $user |
||||
|
* |
||||
|
* @return bool |
||||
|
*/ |
||||
|
protected function authorize($user): bool |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,79 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Admin\Actions\Grid\v3; |
||||
|
|
||||
|
use Dcat\Admin\Actions\Response; |
||||
|
use Dcat\Admin\Traits\HasPermissions; |
||||
|
use Dcat\Admin\Tree\AbstractTool; |
||||
|
use Illuminate\Contracts\Auth\Authenticatable; |
||||
|
use Illuminate\Database\Eloquent\Model; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class OrderReportLastWeek extends AbstractTool |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* @return string |
||||
|
*/ |
||||
|
protected $title = '上周'; |
||||
|
|
||||
|
/** |
||||
|
* Handle the action request. |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return Response |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
// 上周日
|
||||
|
$lastSunday = date('Y-m-d', strtotime('-1 sunday', time())); |
||||
|
// 上周一
|
||||
|
$lastMonday = date('Y-m-d', strtotime('-1 monday', strtotime($lastSunday))); |
||||
|
|
||||
|
return $this->response() |
||||
|
->success('查询中~') |
||||
|
->redirect('/order_report?start_time='.$lastMonday.'&end_time='.$lastSunday); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return string|void |
||||
|
*/ |
||||
|
// public function href()
|
||||
|
// {
|
||||
|
// return admin_url('/');
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @return string|array|void |
||||
|
*/ |
||||
|
public function confirm() |
||||
|
{ |
||||
|
// return ['Confirm?', 'contents'];
|
||||
|
} |
||||
|
|
||||
|
// protected function actionScript()
|
||||
|
// {
|
||||
|
|
||||
|
// return <<<JS
|
||||
|
// function (data, target, action) {
|
||||
|
// console.log('发起请求之前', data, target, action);
|
||||
|
|
||||
|
// // return false; 在这里return false可以终止执行后面的操作
|
||||
|
|
||||
|
// // 更改传递到接口的主键值
|
||||
|
// action.options.key = 123;
|
||||
|
// }
|
||||
|
// JS;
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @param Model|Authenticatable|HasPermissions|null $user |
||||
|
* |
||||
|
* @return bool |
||||
|
*/ |
||||
|
protected function authorize($user): bool |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,77 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Admin\Actions\Grid\v3; |
||||
|
|
||||
|
use Dcat\Admin\Actions\Response; |
||||
|
use Dcat\Admin\Traits\HasPermissions; |
||||
|
use Dcat\Admin\Tree\AbstractTool; |
||||
|
use Illuminate\Contracts\Auth\Authenticatable; |
||||
|
use Illuminate\Database\Eloquent\Model; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class OrderReportToday extends AbstractTool |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* @return string |
||||
|
*/ |
||||
|
protected $title = '今日'; |
||||
|
|
||||
|
/** |
||||
|
* Handle the action request. |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return Response |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
$today = date('Y-m-d'); |
||||
|
$startTime = $today; |
||||
|
$endTime = $today; |
||||
|
return $this->response() |
||||
|
->success('查询中~') |
||||
|
->redirect('/order_report?start_time='.$startTime.'&end_time='.$endTime); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return string|void |
||||
|
*/ |
||||
|
// public function href()
|
||||
|
// {
|
||||
|
// return admin_url('/');
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @return string|array|void |
||||
|
*/ |
||||
|
public function confirm() |
||||
|
{ |
||||
|
// return ['Confirm?', 'contents'];
|
||||
|
} |
||||
|
|
||||
|
// protected function actionScript()
|
||||
|
// {
|
||||
|
|
||||
|
// return <<<JS
|
||||
|
// function (data, target, action) {
|
||||
|
// console.log('发起请求之前', data, target, action);
|
||||
|
|
||||
|
// // return false; 在这里return false可以终止执行后面的操作
|
||||
|
|
||||
|
// // 更改传递到接口的主键值
|
||||
|
// action.options.key = 123;
|
||||
|
// }
|
||||
|
// JS;
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @param Model|Authenticatable|HasPermissions|null $user |
||||
|
* |
||||
|
* @return bool |
||||
|
*/ |
||||
|
protected function authorize($user): bool |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,78 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Admin\Actions\Grid\v3; |
||||
|
|
||||
|
use Dcat\Admin\Actions\Response; |
||||
|
use Dcat\Admin\Traits\HasPermissions; |
||||
|
use Dcat\Admin\Tree\AbstractTool; |
||||
|
use Illuminate\Contracts\Auth\Authenticatable; |
||||
|
use Illuminate\Database\Eloquent\Model; |
||||
|
use Illuminate\Http\Request; |
||||
|
|
||||
|
class OrderReportYesterday extends AbstractTool |
||||
|
{ |
||||
|
|
||||
|
/** |
||||
|
* @return string |
||||
|
*/ |
||||
|
protected $title = '昨日'; |
||||
|
|
||||
|
/** |
||||
|
* Handle the action request. |
||||
|
* |
||||
|
* @param Request $request |
||||
|
* |
||||
|
* @return Response |
||||
|
*/ |
||||
|
public function handle(Request $request) |
||||
|
{ |
||||
|
$today = date('Y-m-d'); |
||||
|
$yesterday = date("Y-m-d",strtotime("-1 days",strtotime($today))); |
||||
|
$startTime = $yesterday; |
||||
|
$endTime = $yesterday; |
||||
|
return $this->response() |
||||
|
->success('查询中~') |
||||
|
->redirect('/order_report?start_time='.$startTime.'&end_time='.$endTime); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @return string|void |
||||
|
*/ |
||||
|
// public function href()
|
||||
|
// {
|
||||
|
// return admin_url('/');
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @return string|array|void |
||||
|
*/ |
||||
|
public function confirm() |
||||
|
{ |
||||
|
// return ['Confirm?', 'contents'];
|
||||
|
} |
||||
|
|
||||
|
// protected function actionScript()
|
||||
|
// {
|
||||
|
|
||||
|
// return <<<JS
|
||||
|
// function (data, target, action) {
|
||||
|
// console.log('发起请求之前', data, target, action);
|
||||
|
|
||||
|
// // return false; 在这里return false可以终止执行后面的操作
|
||||
|
|
||||
|
// // 更改传递到接口的主键值
|
||||
|
// action.options.key = 123;
|
||||
|
// }
|
||||
|
// JS;
|
||||
|
// }
|
||||
|
|
||||
|
/** |
||||
|
* @param Model|Authenticatable|HasPermissions|null $user |
||||
|
* |
||||
|
* @return bool |
||||
|
*/ |
||||
|
protected function authorize($user): bool |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue