后台优化
This commit is contained in:
@@ -9,10 +9,9 @@ use think\Response;
|
||||
class Base extends Controller
|
||||
{
|
||||
protected function _initialize()
|
||||
{var_dump(1111);exit;
|
||||
{
|
||||
if(!session('adminghd_user_id')){//没有登录信息
|
||||
// $this->redirect('login/index');
|
||||
var_dump(url('Login/logoutJump'));exit;
|
||||
return $this->error('您还未登录',url('Login/logoutJump'));
|
||||
//Response::create(['status' => '0','msg'=> '还未登录,验证失败'], 'json')->send();
|
||||
exit;
|
||||
|
||||
77
application/adminghd/controller/Dashboard.php
Normal file
77
application/adminghd/controller/Dashboard.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
namespace app\adminghd\controller;
|
||||
|
||||
use app\adminghd\common\Base;
|
||||
use think\Db;
|
||||
|
||||
/**
|
||||
* 系统概览控制器
|
||||
* GHD预测后台独立实现,不再依赖common模块
|
||||
*/
|
||||
class Dashboard extends Base
|
||||
{
|
||||
/**
|
||||
* 后台首页概览
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->view->fetch('dashboard/index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
* adminghd模块独立实现,使用ghd_wechat_user表
|
||||
*/
|
||||
public function getStatistics()
|
||||
{
|
||||
try {
|
||||
// adminghd模块使用的表名(固定)
|
||||
$userTable = 'ghd_wechat_user';
|
||||
$infoTable = 'wechat_real_time_info';
|
||||
$recordTable = 'wechat_calculate_record';
|
||||
|
||||
// 小程序注册用户数量
|
||||
$userCount = Db::name($userTable)->count();
|
||||
|
||||
// 首页资讯数量
|
||||
$infoCount = Db::name($infoTable)->count();
|
||||
|
||||
// 最近一次计算时间
|
||||
$lastCalculate = Db::name($recordTable)
|
||||
->order('create_time desc')
|
||||
->value('create_time');
|
||||
|
||||
// 今日新增用户
|
||||
$todayUserCount = Db::name($userTable)
|
||||
->whereTime('create_time', 'today')
|
||||
->count();
|
||||
|
||||
// 总计算次数
|
||||
$totalCalculateCount = Db::name($recordTable)->count();
|
||||
|
||||
return json([
|
||||
'status' => 1,
|
||||
'msg' => '获取成功',
|
||||
'data' => [
|
||||
'user_count' => $userCount,
|
||||
'info_count' => $infoCount,
|
||||
'last_calculate_time' => $lastCalculate ?: '暂无',
|
||||
'today_user_count' => $todayUserCount,
|
||||
'total_calculate_count' => $totalCalculateCount
|
||||
]
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'status' => 0,
|
||||
'msg' => '获取失败:' . $e->getMessage(),
|
||||
'data' => [
|
||||
'user_count' => 0,
|
||||
'info_count' => 0,
|
||||
'last_calculate_time' => '暂无',
|
||||
'today_user_count' => 0,
|
||||
'total_calculate_count' => 0
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
138
application/adminghd/view/dashboard/index.html
Normal file
138
application/adminghd/view/dashboard/index.html
Normal file
@@ -0,0 +1,138 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
||||
<title>系统概览</title>
|
||||
<link rel="stylesheet" href="/static/adminghd/layui/css/layui.css">
|
||||
<style>
|
||||
body{
|
||||
background:#f5f7fb;
|
||||
padding:24px 24px 40px;
|
||||
box-sizing:border-box;
|
||||
font-family:"Microsoft YaHei",-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
|
||||
}
|
||||
.dash-card{
|
||||
background:#fff;
|
||||
border-radius:10px;
|
||||
box-shadow:0 10px 30px rgba(15,35,52,0.06);
|
||||
padding:20px 24px;
|
||||
margin-bottom:20px;
|
||||
}
|
||||
.dash-title{
|
||||
font-size:18px;
|
||||
font-weight:600;
|
||||
color:#1f2d3d;
|
||||
margin-bottom:4px;
|
||||
}
|
||||
.dash-sub{
|
||||
font-size:12px;
|
||||
color:#9aa4b1;
|
||||
margin-bottom:18px;
|
||||
}
|
||||
.dash-grid{
|
||||
display:flex;
|
||||
flex-wrap:wrap;
|
||||
gap:16px;
|
||||
}
|
||||
.dash-item{
|
||||
flex:1 1 200px;
|
||||
min-width:200px;
|
||||
background:#f8fafc;
|
||||
border-radius:8px;
|
||||
padding:14px 16px;
|
||||
cursor:pointer;
|
||||
transition:all 0.3s;
|
||||
}
|
||||
.dash-item:hover{
|
||||
background:#f0f4f8;
|
||||
transform:translateY(-2px);
|
||||
box-shadow:0 4px 12px rgba(15,35,52,0.1);
|
||||
}
|
||||
.dash-item-label{
|
||||
font-size:13px;
|
||||
color:#9aa4b1;
|
||||
}
|
||||
.dash-item-value{
|
||||
margin-top:6px;
|
||||
font-size:22px;
|
||||
font-weight:600;
|
||||
color:#1f2d3d;
|
||||
}
|
||||
.dash-item-desc{
|
||||
margin-top:4px;
|
||||
font-size:12px;
|
||||
color:#b0b7c3;
|
||||
}
|
||||
.dash-empty{
|
||||
margin-top:10px;
|
||||
font-size:13px;
|
||||
color:#9aa4b1;
|
||||
}
|
||||
.loading{
|
||||
text-align:center;
|
||||
padding:40px;
|
||||
color:#9aa4b1;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="dash-card">
|
||||
<div class="dash-title">欢迎使用后台管理系统</div>
|
||||
<div class="dash-sub">这里是系统概览,实时展示系统统计数据。</div>
|
||||
<div class="dash-grid" id="dashGrid">
|
||||
<div class="loading">数据加载中...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/static/adminghd/js/jquery.js"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
// 加载统计数据
|
||||
loadStatistics();
|
||||
|
||||
function loadStatistics(){
|
||||
$.ajax({
|
||||
url: '/adminghd/Dashboard/getStatistics',
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
success: function(res){
|
||||
if(res.status == 1){
|
||||
renderStatistics(res.data);
|
||||
} else {
|
||||
$('#dashGrid').html('<div class="loading">数据加载失败:' + res.msg + '</div>');
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$('#dashGrid').html('<div class="loading">数据加载失败,请稍后重试</div>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function renderStatistics(data){
|
||||
var html = `
|
||||
<div class="dash-item" onclick="parent.location.href='/adminghd/wechatinfro/wechatUserList'">
|
||||
<div class="dash-item-label">小程序注册用户</div>
|
||||
<div class="dash-item-value">${data.user_count}</div>
|
||||
<div class="dash-item-desc">今日新增:${data.today_user_count} 人</div>
|
||||
</div>
|
||||
<div class="dash-item" onclick="parent.location.href='/adminghd/wechatset/wechatRealTimeInfo'">
|
||||
<div class="dash-item-label">首页资讯数量</div>
|
||||
<div class="dash-item-value">${data.info_count}</div>
|
||||
<div class="dash-item-desc">可在「咨询管理」菜单中维护展示内容</div>
|
||||
</div>
|
||||
<div class="dash-item" onclick="parent.location.href='/adminghd/wechatinfro/wechatRecordList'">
|
||||
<div class="dash-item-label">总计算次数</div>
|
||||
<div class="dash-item-value">${data.total_calculate_count}</div>
|
||||
<div class="dash-item-desc">最近一次:${data.last_calculate_time}</div>
|
||||
</div>
|
||||
`;
|
||||
$('#dashGrid').html(html);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div style='background:#e3e3e3;height:450px;width:100%;position:relative;'>
|
||||
<div style='width:350px;height:400px;background:#EDF1F5;float:right;margin-right:20%;margin-top:1.5%;box-shadow:#666 0px 0px 20px;'>
|
||||
<div class="login-top" style="padding-bottom:0;">
|
||||
<div style='color:#453A3E;margin:30px auto 10px auto;width:150px;font-size:18px;font-weight:bold;text-align:center;'>瑞莱医疗</div>
|
||||
<div style='color:#453A3E;margin:30px auto 10px auto;width:auto;max-width:90%;font-size:16px;font-weight:bold;text-align:center;padding:0 10px;'>生长激素缺乏预测模型后台</div>
|
||||
</div>
|
||||
<div style='height:1px;width:100%;background:#DEDCDD;'>
|
||||
<div style='background:#e3e3e3;height:3px;width:80%;margin:0px auto 0 auto;'></div>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp">
|
||||
<title>瑞莱医疗后台</title>
|
||||
<title>生长激素缺乏预测模型后台</title>
|
||||
|
||||
<link rel="stylesheet" href="/static/adminghd/layui/css/layui.css?t=1554901097999" media="all">
|
||||
<link rel="stylesheet" type="text/css" href="/static/adminghd/css/nav.css" />
|
||||
@@ -33,22 +33,14 @@
|
||||
</div>
|
||||
<!--顶部-->
|
||||
<div class="top_right">
|
||||
<a href="javascript:void(0)" class="logo">
|
||||
<!-- <img id="packBtn" src="{S_URL}/templates/adminfactory/img/logo.png">-->
|
||||
</a>
|
||||
<b></b>
|
||||
<div class="header_title">生长激素缺乏预测模型后台</div>
|
||||
<div class="user_right">
|
||||
<a href="javascript:;" id="user" style="position: absolute;left: 100px;top: 4px;font-size: 16px;"></a>
|
||||
<span id="inform">
|
||||
<!-- 您好!工厂
|
||||
<img id="u_headimg" src="{S_URL}/templates/adminfactory/img/logo.png" alt="">
|
||||
<i>荣麟</i> -->
|
||||
</span>
|
||||
<span id="inform"></span>
|
||||
<b class="out" id="sign_out">退出</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_content">
|
||||
<iframe id="iframeId" src="" frameborder="0"></iframe>
|
||||
<iframe id="iframeId" src="/adminghd/Dashboard/index" frameborder="0"></iframe>
|
||||
</div>
|
||||
|
||||
<script src="/static/adminghd/js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
Reference in New Issue
Block a user