提交其他文件
This commit is contained in:
234
app/adminapi/logic/WorkbenchLogic.php
Normal file
234
app/adminapi/logic/WorkbenchLogic.php
Normal file
@ -0,0 +1,234 @@
|
||||
<?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 [
|
||||
// 版本信息
|
||||
'version' => self::versionInfo(),
|
||||
// 今日数据
|
||||
'today' => self::today(),
|
||||
// 常用功能
|
||||
'menu' => self::menu(),
|
||||
// 近15日访客数
|
||||
'visitor' => self::visitor(),
|
||||
// 服务支持
|
||||
'support' => self::support(),
|
||||
// 销售数据
|
||||
'sale' => self::sale()
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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_admin')),
|
||||
'url' => '/permission/admin'
|
||||
],
|
||||
[
|
||||
'name' => '角色管理',
|
||||
'image' => FileService::getFileUrl(config('project.default_image.menu_role')),
|
||||
'url' => '/permission/role'
|
||||
],
|
||||
[
|
||||
'name' => '部门管理',
|
||||
'image' => FileService::getFileUrl(config('project.default_image.menu_dept')),
|
||||
'url' => '/organization/department'
|
||||
],
|
||||
[
|
||||
'name' => '字典管理',
|
||||
'image' => FileService::getFileUrl(config('project.default_image.menu_dict')),
|
||||
'url' => '/setting/dev_tools/dict'
|
||||
],
|
||||
[
|
||||
'name' => '代码生成器',
|
||||
'image' => FileService::getFileUrl(config('project.default_image.menu_generator')),
|
||||
'url' => '/dev_tools/code'
|
||||
],
|
||||
[
|
||||
'name' => '素材中心',
|
||||
'image' => FileService::getFileUrl(config('project.default_image.menu_file')),
|
||||
'url' => '/app/material/index'
|
||||
],
|
||||
[
|
||||
'name' => '菜单权限',
|
||||
'image' => FileService::getFileUrl(config('project.default_image.menu_auth')),
|
||||
'url' => '/permission/menu'
|
||||
],
|
||||
[
|
||||
'name' => '网站信息',
|
||||
'image' => FileService::getFileUrl(config('project.default_image.menu_web')),
|
||||
'url' => '/setting/website/information'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 版本信息
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 16:08
|
||||
*/
|
||||
public static function versionInfo(): array
|
||||
{
|
||||
return [
|
||||
'version' => config('project.version'),
|
||||
'website' => config('project.website.url'),
|
||||
'name' => ConfigService::get('website', 'name'),
|
||||
'based' => 'vue3.x、ElementUI、MySQL',
|
||||
'channel' => [
|
||||
'website' => 'https://www.likeadmin.cn',
|
||||
'gitee' => 'https://gitee.com/likeadmin/likeadmin_php',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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_sales' => 100,
|
||||
// 总销售额
|
||||
'total_sales' => 1000,
|
||||
|
||||
// 今日访问量
|
||||
'today_visitor' => 10,
|
||||
// 总访问量
|
||||
'total_visitor' => 100,
|
||||
|
||||
// 今日新增用户量
|
||||
'today_new_user' => 30,
|
||||
// 总用户量
|
||||
'total_new_user' => 3000,
|
||||
|
||||
// 订单量 (笔)
|
||||
'order_num' => 12,
|
||||
// 总订单量
|
||||
'order_sum' => 255
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 访问数
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 16:57
|
||||
*/
|
||||
public static function visitor(): array
|
||||
{
|
||||
$num = [];
|
||||
$date = [];
|
||||
for ($i = 0; $i < 15; $i++) {
|
||||
$where_start = strtotime("- " . $i . "day");
|
||||
$date[] = date('m/d', $where_start);
|
||||
$num[$i] = rand(0, 100);
|
||||
}
|
||||
|
||||
return [
|
||||
'date' => $date,
|
||||
'list' => [
|
||||
['name' => '访客数', 'data' => $num]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 访问数
|
||||
* @return array
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 16:57
|
||||
*/
|
||||
public static function sale(): array
|
||||
{
|
||||
$num = [];
|
||||
$date = [];
|
||||
for ($i = 0; $i < 7; $i++) {
|
||||
$where_start = strtotime("- " . $i . "day");
|
||||
$date[] = date('m/d', $where_start);
|
||||
$num[$i] = rand(30, 200);
|
||||
}
|
||||
|
||||
return [
|
||||
'date' => $date,
|
||||
'list' => [
|
||||
['name' => '销售量', 'data' => $num]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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' => '想了解更多请添加客服',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user