170 lines
4.6 KiB
PHP
170 lines
4.6 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||
// | 访问官网:https://www.likeadmin.cn
|
||
// | likeadmin团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeadminTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\adminapi\logic;
|
||
|
||
|
||
use app\common\logic\BaseLogic;
|
||
use app\common\service\ConfigService;
|
||
use app\common\service\FileService;
|
||
|
||
|
||
/**
|
||
* 工作台
|
||
* Class WorkbenchLogic
|
||
* @package app\adminapi\logic
|
||
*/
|
||
class WorkbenchLogic extends BaseLogic
|
||
{
|
||
/**
|
||
* @notes 工作套
|
||
* @param $adminInfo
|
||
* @return array
|
||
* @author 段誉
|
||
* @date 2021/12/29 15:58
|
||
*/
|
||
public static function index()
|
||
{
|
||
return [
|
||
// 今日数据
|
||
'today' => self::today(),
|
||
// 快捷入口
|
||
'menu' => self::menu(),
|
||
// 图表数据
|
||
'visitor' => self::visitor(),
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 快捷入口
|
||
* @return array[]
|
||
* @author 段誉
|
||
* @date 2021/12/29 16:40
|
||
*/
|
||
public static function menu(): array
|
||
{
|
||
return [
|
||
[
|
||
'name' => '土地列表',
|
||
'image' => FileService::getFileUrl(config('project.default_image.menu_dict')),
|
||
'url' => '/land/land'
|
||
],
|
||
[
|
||
'name' => '产品列表',
|
||
'image' => FileService::getFileUrl(config('project.default_image.menu_file')),
|
||
'url' => '/land/product'
|
||
],
|
||
[
|
||
'name' => '设备列表',
|
||
'image' => FileService::getFileUrl(config('project.default_image.menu_web')),
|
||
'url' => '/device/device'
|
||
],
|
||
[
|
||
'name' => '监控报警',
|
||
'image' => FileService::getFileUrl(config('project.default_image.menu_auth')),
|
||
'url' => '/device/monitor_alarm'
|
||
]
|
||
];
|
||
}
|
||
|
||
/**
|
||
* @notes 今日数据
|
||
* @return int[]
|
||
* @author 段誉
|
||
* @date 2021/12/29 16:15
|
||
*/
|
||
public static function today(): array
|
||
{
|
||
return [
|
||
'time' => date('Y-m-d H:i:s'),
|
||
// 土地数
|
||
'today_land' => 3,
|
||
// 今日新增
|
||
'total_land' => 10,
|
||
|
||
// 产品数
|
||
'today_product' => 2,
|
||
// 今日新增
|
||
'total_product' => 100,
|
||
|
||
// 设备数
|
||
'today_device' => 2,
|
||
// 今日新增
|
||
'total_device' => 12,
|
||
|
||
// 报警数
|
||
'today_alarm' => 5,
|
||
// 今日新增
|
||
'total_alarm' => 35,
|
||
|
||
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 访问数
|
||
* @return array
|
||
* @author 段誉
|
||
* @date 2021/12/29 16:57
|
||
*/
|
||
public static function visitor(): array
|
||
{
|
||
$land = $device = $product = $alarm = [];
|
||
$date = [];
|
||
for ($i = 0; $i < 15; $i++) {
|
||
$where_start = strtotime("- " . $i . "day");
|
||
$date[] = date('Y/m/d', $where_start);
|
||
$land[$i] = rand(0, 100);
|
||
$product[$i] = rand(0, 100);
|
||
$device[$i] = rand(0, 100);
|
||
$alarm[$i] = rand(0, 100);
|
||
}
|
||
|
||
return [
|
||
'date' => $date,
|
||
'list' => [
|
||
['name' => '土地数', 'data' => $land],
|
||
['name' => '产品数', 'data' => $product],
|
||
['name' => '设备数', 'data' => $device],
|
||
['name' => '报警数', 'data' => $alarm],
|
||
]
|
||
];
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 服务支持
|
||
* @return array[]
|
||
* @author 段誉
|
||
* @date 2022/7/18 11:18
|
||
*/
|
||
public static function support()
|
||
{
|
||
return [
|
||
[
|
||
'image' => FileService::getFileUrl(config('project.default_image.qq_group')),
|
||
'title' => '官方公众号',
|
||
'desc' => '关注官方公众号',
|
||
],
|
||
[
|
||
'image' => FileService::getFileUrl(config('project.default_image.customer_service')),
|
||
'title' => '添加企业客服微信',
|
||
'desc' => '想了解更多请添加客服',
|
||
]
|
||
];
|
||
}
|
||
|
||
} |