Files
dsserver/plugin/admin/app/controller/DeviceUsageController.php
zimoyin 13fd9c5f0a init
2026-04-06 20:48:32 +08:00

49 lines
1.1 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace plugin\admin\app\controller;
use plugin\admin\app\service\DeviceUsageService;
use support\Response;
/**
* 设备使用情况(参照旧系统 device_details.tpl.html
*/
class DeviceUsageController extends Base
{
private DeviceUsageService $service;
public function __construct()
{
$this->service = new DeviceUsageService();
}
public function index(): Response
{
return raw_view('device-usage/index');
}
/**
* 获取设备使用情况列表(Layui table 格式,带数据权限)
*/
public function select(): Response
{
$params = request()->get();
$result = $this->service->getUsageList($params);
return json([
'code' => 0,
'msg' => '',
'count' => $result['total'],
'data' => $result['data'],
]);
}
/**
* 获取设备下拉选项(带数据权限,复用 DeviceStatusService
*/
public function deviceOptions(): Response
{
return json(['code' => 0, 'msg' => 'ok', 'data' => $this->service->getDeviceOptions()]);
}
}