91 lines
2.1 KiB
PHP
91 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace plugin\admin\app\controller;
|
|
|
|
use plugin\admin\app\service\DataOverviewService;
|
|
use support\Request;
|
|
use support\Response;
|
|
|
|
class DataOverviewController extends Crud
|
|
{
|
|
protected $model = null;
|
|
|
|
private DataOverviewService $service;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->service = new DataOverviewService();
|
|
}
|
|
|
|
public function index(): Response
|
|
{
|
|
return raw_view('data-overview/index');
|
|
}
|
|
|
|
/**
|
|
* 消毒灭菌次数概况(今日/本周/本月/本年)
|
|
*/
|
|
public function getIndexCount(): Response
|
|
{
|
|
return json(['code' => 0, 'data' => $this->service->getIndexCount()]);
|
|
}
|
|
|
|
/**
|
|
* 消毒灭菌锅(设备)运行状态
|
|
*/
|
|
public function getIndexRunStatus(): Response
|
|
{
|
|
return json(['code' => 0, 'data' => $this->service->getDeviceRunStatus()]);
|
|
}
|
|
|
|
/**
|
|
* 消毒灭菌统计折线图(7日/30日/本年)
|
|
*/
|
|
public function getIndexLine(Request $request): Response
|
|
{
|
|
$parameterTime = $request->get('parameter_time', 'week');
|
|
return json(['code' => 0, 'data' => $this->service->getLineData($parameterTime)]);
|
|
}
|
|
|
|
/**
|
|
* 预警概览(预警次数/处理次数)
|
|
*/
|
|
public function getIndexWarnCount(): Response
|
|
{
|
|
return json(['code' => 0, 'data' => $this->service->getWarnCount()]);
|
|
}
|
|
|
|
/**
|
|
* 预警分布饼图数据
|
|
*/
|
|
public function getIndexWarnTypePie(): Response
|
|
{
|
|
return json(['code' => 0, 'data' => $this->service->getWarnTypePie()]);
|
|
}
|
|
|
|
/**
|
|
* 预警分布百分比信息
|
|
*/
|
|
public function getIndexWarnTypePieInfo(): Response
|
|
{
|
|
return json(['code' => 0, 'data' => $this->service->getWarnTypePieInfo()]);
|
|
}
|
|
|
|
/**
|
|
* 预警设备列表
|
|
*/
|
|
public function getIndexWarnDeviceList(): Response
|
|
{
|
|
$data = $this->service->getWarnDeviceList();
|
|
return json(['code' => 0, 'data' => $data ?? false]);
|
|
}
|
|
|
|
/**
|
|
* 事件数据
|
|
*/
|
|
public function getIndexEvent(): Response
|
|
{
|
|
return json(['code' => 0, 'data' => $this->service->getEventData()]);
|
|
}
|
|
}
|