60 lines
1.4 KiB
PHP
60 lines
1.4 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\Export\Services\ExportService;
|
|
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->except(['page', 'limit']);
|
|
$conditions['limit'] = 0;
|
|
|
|
try {
|
|
$export = new CompanyCountExport($conditions);
|
|
$url = ExportService::store($export, $this->disk);
|
|
} catch (\Exception $e) {
|
|
throw $e;
|
|
}
|
|
|
|
return res($url, '导出成功', 201);
|
|
}
|
|
}
|