60 lines
1.3 KiB
PHP
60 lines
1.3 KiB
PHP
<?php
|
|
namespace App\Domains\Stats\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Carbon;
|
|
use Dipper\Excel\Facades\Excel;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use App\Domains\Stats\Exports\CompanyCountExport;
|
|
use App\Domains\Stats\Services\CompanyCountService;
|
|
|
|
class CompanyCountController extends Controller
|
|
{
|
|
protected $request;
|
|
protected $companyCountService;
|
|
|
|
/**
|
|
* 构造函数,自动注入.
|
|
*/
|
|
public function __construct(Request $request, CompanyCountService $companyCountService)
|
|
{
|
|
$this->request = $request;
|
|
$this->companyCountService = $companyCountService;
|
|
}
|
|
|
|
/**
|
|
* 列表.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
$conditions = $this->request->all();
|
|
|
|
$res = $this->companyCountService->index($conditions);
|
|
|
|
return res($res, '企业统计', 201);
|
|
}
|
|
|
|
/**
|
|
* 导出.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function export()
|
|
{
|
|
$conditions = $this->request->all();
|
|
$conditions['limit'] = 0;
|
|
|
|
$export = new CompanyCountExport($conditions);
|
|
|
|
$res = Excel::queue($export, $export->filename(), $this->disk);
|
|
|
|
dd($res);
|
|
|
|
$url = Storage::url($filename);
|
|
|
|
return res($url, '导出成功', 201);
|
|
}
|
|
}
|