You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.1 KiB
84 lines
2.1 KiB
<?php
|
|
|
|
namespace App\Admin\Actions\Tools;
|
|
|
|
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 GoodsActivityExport extends AbstractTool
|
|
{
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
protected $title = '<span class="feather icon-download">导出<span>';
|
|
|
|
/**
|
|
* Handle the action request.
|
|
*
|
|
* @param Request $request
|
|
*
|
|
* @return Response
|
|
*/
|
|
public function handle(Request $request)
|
|
{
|
|
$url = '/goods_activity_export?';
|
|
$name = $request->get('name', '');
|
|
$marketId = $request->get('market_id',0);
|
|
$storeId = $request->get('store_id',0);
|
|
$startTime = $request->get('start_time','');
|
|
$endTime = $request->get('end_time','');
|
|
|
|
if(!empty($name)){
|
|
$url .= '&name='.$name;
|
|
}
|
|
if(!empty($marketId)){
|
|
$url .= '&market_id='.$marketId;
|
|
}
|
|
if(!empty($storeId)){
|
|
$url .= '&store_id='.$storeId;
|
|
}
|
|
if(!empty($startTime)){
|
|
$url .= '&start_time='.$startTime;
|
|
}
|
|
|
|
if(!empty($endTime)){
|
|
$url .= '&end_time='.$endTime;
|
|
}
|
|
return $this->response()
|
|
->success('导出中~')
|
|
->redirect($url);
|
|
}
|
|
public function parameters()
|
|
{
|
|
return [
|
|
'page' => request()->input('page', 1),
|
|
'name' => request()->input('name', ''),
|
|
'market_id' => request()->input('market_id',0),
|
|
'store_id' => request()->input('store_id',0),
|
|
'start_time' => request()->input('start_time',''),
|
|
'end_time' => request()->input('end_time',''),
|
|
];
|
|
}
|
|
/**
|
|
* @return string|array|void
|
|
*/
|
|
public function confirm()
|
|
{
|
|
return '确定导出数据吗?';
|
|
}
|
|
|
|
/**
|
|
* @param Model|Authenticatable|HasPermissions|null $user
|
|
*
|
|
* @return bool
|
|
*/
|
|
protected function authorize($user): bool
|
|
{
|
|
return true;
|
|
}
|
|
}
|