This commit is contained in:
mkm 2023-01-29 17:23:27 +08:00
parent f338916394
commit 410114c2fd
6 changed files with 155 additions and 117 deletions

View File

@ -12,6 +12,8 @@ namespace app\admin\controller;
use app\admin\BaseController;
use app\admin\model\AdminLog;
use app\admin\validate\AdminCheck;
use OSS\Core\OssException;
use OSS\OssClient;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\Session;
@ -70,19 +72,34 @@ class Api extends BaseController
// 日期前綴
$dataPath = date('Ym');
$use = 'thumb';
$filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
return $md5;
});
$accessKeyId = "LTAI5t7mhH3ij2cNWs1zhPmv"; ;
$accessKeySecret = "gqo2wMpvi8h5bDBmCpMje6BaiXvcPu";
$endpoint = "oss-cn-chengdu.aliyuncs.com";
try {
$ossClient = new OssClient($accessKeyId, $accessKeySecret, $endpoint);
} catch (OssException $e) {
return to_assign(1, $e->getMessage());
}
$bucket = "lihai001";
$object = 'storage/'.$dataPath.'/'.$md5.'.jpg';
// $filename = \think\facade\Filesystem::disk('public')->putFile($dataPath, $file, function () use ($md5) {
// return $md5;
// });
try {
$filename=$ossClient->uploadFile($bucket, $object,$file);
} catch (OssException $e) {
return to_assign(1, $e->getMessage());
}
if ($filename) {
//写入到附件表
$data = [];
$path = get_config('filesystem.disks.public.url');
$data['filepath'] = $path . '/' . $filename;
$data['filepath'] = $filename['info']['url'];
$data['name'] = $file->getOriginalName();
$data['mimetype'] = $file->getOriginalMime();
$data['fileext'] = $file->extension();
$data['filesize'] = $file->getSize();
$data['filename'] = $filename;
$data['filename'] = $object;
$data['sha1'] = $sha1;
$data['md5'] = $md5;
$data['module'] = \think\facade\App::initialize()->http->getName();

View File

@ -15,6 +15,10 @@ use think\facade\View;
class Index extends BaseController
{
public function __construct()
{
$this->adminInfo = get_login_admin();
}
public function index()
{
$admin = get_login_admin();
@ -40,22 +44,77 @@ class Index extends BaseController
public function main()
{
$adminCount = Db::name('Admin')->where('status', '1')->count();
$userCount = Db::name('User')->where('status', '1')->count();
$articleCount = Db::name('Article')->where('status', '1')->count();
$goodsCount = Db::name('Goods')->where('status', '1')->count();
$fileCount = Db::name('File')->count();
$install = false;
if (file_exists(CMS_ROOT . 'app/install')) {
$install = true;
if ($this->adminInfo['id']!=1){
$find = Db::name('szxc_information_useraddress')->where('user_id', $this->adminInfo['id'])->find();
if ($find) {
if ($find['auth_range']==1){
$where[] = ['village_id', '=', $find['village_id']];
}elseif ($find['auth_range']==2){
$where[] = ['street_id', '=', $find['street_id']];
}elseif ($find['auth_range']==3){
$where[] = ['area_id', '=', $find['area_id']];
}
}
}else{
$where=[];
}
View::assign('adminCount', $adminCount);
View::assign('userCount', $userCount);
View::assign('articleCount', $articleCount);
View::assign('goodsCount', $goodsCount);
View::assign('fileCount', $fileCount);
View::assign('install', $install);
View::assign('TP_VERSION',\think\facade\App::version());
$num =Db::table('fa_szxc_information_usermsg')->where($where)->count();
// 大于60岁人数
$old_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereAge('>=', 60)->count();
// 儿童人数
$children_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereAge('<', 15)->count();
// 未婚男
$unmarried_man_num = Db::table('fa_szxc_information_usermsg')->where($where)->where([['gender', '=', 1], ['marital_status', '=', 169]])->count();
// 未婚女
$unmarried_woman_num = Db::table('fa_szxc_information_usermsg')->where($where)->where([['gender', '=', 2], ['marital_status', '=', 169]])->count();
// 少数民族
$nation_s_num = Db::table('fa_szxc_information_usermsg')->where($where)->whereBetween('nation', [13, 68])->count();
// 汉族
$nation_h_num = Db::table('fa_szxc_information_usermsg')->where($where)->where('nation', 12)->count();
// 土地性质
foreach ($where as $key =>$value){
$where[$key][0] = 'm.'.$value[0];
}
// 残疾人数
$whether_disabled_num = Db::table('fa_szxc_information_usermsg')
->alias('m')
->where($where)
->join(['fa_szxc_information_insurance'=>'i'],'m.user_id=i.user_id and i.whether_disabled!=112')->count();
// 参保人数
$insurance_type_num = Db::table('fa_szxc_information_usermsg')
->alias('m')
->where($where)
->join(['fa_szxc_information_insurance'=>'i'],'m.user_id=i.user_id and i.insurance_type!=219')->count();
if ($this->adminInfo['id']!=1){
// 工作人员数
$work_num = Db::table('fa_szxc_information_usermsg')
->alias('m')
->where($where)
->join(['user'=>'u'],'m.user_id=u.id and u.group_id = 3')->count();
}else{
$work_num = Db::table('fa_user')
->alias('u')
->where($where)
->where('u.group_id',3)
->join(['fa_szxc_information_usermsg'=>'m'],'u.id = m.user_id')->count();
}
View::assign(
[
'totaluser' => $num,//User::where($whe)->count(),// 总用户数
'old_num' => $old_num,
'children_num' => $children_num,
'unmarried_man_num' => $unmarried_man_num,
'unmarried_woman_num' => $unmarried_woman_num,
'whether_disabled_num' => $whether_disabled_num,
'insurance_type_num' => $insurance_type_num,
'nation_s_num' => $nation_s_num,
'nation_h_num' => $nation_h_num,
'work_num' => $work_num,
]
);
return View();
}

View File

@ -16,9 +16,9 @@
<span class="gg-head-item gg-head-cache">
<a href="javascript:;" gg-event="cache" data-href="/admin/api/cache_clear" title="清空缓存"><i class="layui-icon layui-icon-fonts-clear"></i></a>
</span>
<span class="gg-head-item gg-head-home">
<a href="/" target="_blank" title="前台首页"><i class="layui-icon layui-icon-website"></i></a>
</span>
<!-- <span class="gg-head-item gg-head-home">-->
<!-- <a href="/" target="_blank" title="前台首页"><i class="layui-icon layui-icon-website"></i></a>-->
<!-- </span>-->
</div>
<div class="layui-layout-right">
@ -37,13 +37,13 @@
<i class="layui-icon layui-icon-set"></i>
</a>
</span>
<span class="gg-head-item gg-head-message">
<a data-text="消息中心" data-url="" gg-event="message" title="消息中心">
<i class="layui-icon layui-icon-notice"></i>
<!-- 如果有新消息,则显示 -->
<div class="gg-message-num"><span>99</span></div>
</a>
</span>
<!-- <span class="gg-head-item gg-head-message">-->
<!-- <a data-text="消息中心" data-url="" gg-event="message" title="消息中心">-->
<!-- <i class="layui-icon layui-icon-notice"></i>-->
<!-- &lt;!&ndash; 如果有新消息,则显示 &ndash;&gt;-->
<!-- <div class="gg-message-num"><span>99</span></div>-->
<!-- </a>-->
<!-- </span>-->
<span class="gg-head-item gg-head-avatar">
<ul class="layui-nav">
<li class="layui-nav-item">

View File

@ -25,47 +25,60 @@
{block name="body"}
<div class="p-3">
<div class="layui-row layui-col-space12">
<div class="layui-col-md8">
<div class="">
<div class="layui-row layui-col-space12">
<div class="layui-col-md12">
<div class="layui-card dashboard-num">
<table>
<tr>
<td>
<div class="num-title">系统用户</div>
<div class="blue">{$adminCount}</div>
<div class="num-title">总会员数</div>
<div class="blue">{$totaluser}</div>
</td>
<td>
<div class="num-title">注册用户</div>
<div class="blue">{$userCount}</div>
<div class="num-title">老人人数</div>
<div class="blue">{$old_num}</div>
</td>
<td>
<div class="num-title">文章</div>
<div class="blue">{$articleCount}</div>
<div class="num-title">儿童人数</div>
<div class="blue">{$children_num}</div>
</td>
<td>
<div class="num-title">商品</div>
<div class="blue">{$goodsCount}</div>
<div class="num-title">未婚男</div>
<div class="blue">{$unmarried_man_num}</div>
</td>
<td>
<div class="num-title">附件</div>
<div class="blue">{$fileCount}</div>
<div class="num-title">未婚女</div>
<div class="blue">{$unmarried_woman_num}</div>
</td>
</tr>
<tr>
<td>
<div class="num-title">残疾人数</div>
<div class="blue">{$whether_disabled_num}</div>
</td>
<td>
<div class="num-title">参保人数</div>
<div class="blue">{$insurance_type_num}</div>
</td>
<td>
<div class="num-title">少数名族人数</div>
<div class="blue">{$nation_s_num}</div>
</td>
<td>
<div class="num-title">汉族人数</div>
<div class="blue">{$nation_h_num}</div>
</td>
<td>
<div class="num-title">工作人员数</div>
<div class="blue">{$work_num}</div>
</td>
</tr>
</table>
</div>
<div class="layui-card">
<div class="layui-card-title">注册用户</div>
<div class="p-3">
<table id="UserList" lay-filter="UserList" class="layui-hide"></table>
</div>
</div>
<div class="layui-card">
<div class="layui-card-title">文章列表</div>
<div class="p-3">
<table id="Article" lay-filter="Article" class="layui-hide" style="margin-top:0"></table>
</div>
</div>
<div class="layui-card">
<div id="chartView" style="width: 100%;height:300px;"></div>
</div>
@ -75,69 +88,6 @@
</div>
</div>
</div>
<div class="layui-col-md4">
<div class="layui-card">
<div class="layui-card-title">系统信息</div>
<div class="layui-card-body">
<table class="layui-table" lay-skin="" lay-size="sm">
{if condition="($install == true)"}
<tr>
<td colspan="4" style="color: #E94335; background-color:#f8f8f8">提醒发现app目录下的install文件夹没删除为了系统的安全,请手动去删除。</td>
</tr>
{/if}
<tr>
<td class="info-td">服务器系统</td>
<td>{:get_system_info('os')}</td>
<td class="info-td">PHP版本</td>
<td>{:get_system_info('php')}</td>
</tr>
<tr>
<td class="info-td">上传附件限制</td>
<td>{:get_system_info('upload_max_filesize')}</td>
<td class="info-td">执行时间限制</td>
<td>{:get_system_info('max_execution_time')}</td>
</tr>
<tr>
<td class="info-td">勾股CMS版本</td>
<td colspan="3">{:CMS_VERSION}<a class="layui-badge layui-bg-blue" style="margin-left:8px"
href="https://blog.gougucms.com/home/book/detail/bid/1.html" target="_blank">勾股CMS文档</a></td>
</tr>
<tr>
<td class="info-td">ThinkPHP版本</td>
<td colspan="3">{$TP_VERSION}<a class="layui-badge layui-bg-blue" style="margin-left:8px" href="https://www.kancloud.cn/manual/thinkphp6_0" target="_blank">TP6文档</a></td>
</tr>
<tr>
<td class="info-td">Layui版本</td>
<td colspan="3">{:LAYUI_VERSION}<a class="layui-badge layui-bg-blue" style="margin-left:8px" href="https://layui.gitee.io/v2/docs/" target="_blank">Layui文档</a></td>
</tr>
<tr>
<td class="info-td">BUG反馈</td>
<td colspan="3"><a href="mailto:hdm58@qq.com" target="_blank">hdm58@qq.com</a></td>
</tr>
<tr>
<td class="info-td">QQ交流群</td>
<td colspan="3">搜Q群2464107646924914<br>或点击 <a href="https://jq.qq.com/?_wv=1027&k=aCESqWHQ" target="_blank" rel="nofollow"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="gougucms交流群" title="点击链接加入群聊【勾股开源交流群】" style="vertical-align:middle"></a></td>
</tr>
<tr>
<td class="info-td">同系列开源软件</td>
<td colspan="3"><a class="layui-badge layui-bg-blue" style="margin-right:8px" href="https://gitee.com/gougucms/blog" target="_blank">勾股BLOG</a><a class="layui-badge layui-bg-blue" style="margin-right:8px" href="https://gitee.com/gougucms/office" target="_blank">勾股OA</a><a class="layui-badge layui-bg-blue" href="https://gitee.com/gougucms/dev" target="_blank">勾股DEV</a></td>
</tr>
<tr>
<td class="info-td">🍗🍗<br/>给作者加鸡腿<br/>🍗🍗</td>
<td colspan="3">
<img src="https://www.gougucms.com/static/home/images/zfb.png" data-event="pay" style="width:50%; max-width:100%; cursor:pointer;" align=center /><img src="https://www.gougucms.com/static/home/images/wx.png" data-event="pay" style="width:50%; max-width:100%; cursor:pointer;" align=center />
</td>
</tr>
</table>
</div>
</div>
<div class="layui-card">
<div class="layui-card-header"><h3>操作日志</h3><a data-title="操作日志" data-href="/admin/api/log_list/" class="pull-right tab-a">更多</a></div>
<div class="layui-card-body">
<ul class="layui-timeline" id="logs"></ul>
</div>
</div>
</div>
</div>
</div>
{/block}

View File

@ -29,7 +29,8 @@
"topthink/think-captcha": "^3.0",
"phpmailer/phpmailer": "^6.6",
"firebase/php-jwt": "6.1.2",
"symfony/var-exporter": "5.4.10"
"symfony/var-exporter": "5.4.10",
"aliyuncs/oss-sdk-php": "^2.6"
},
"require-dev": {
"symfony/var-dumper": "^4.2",

View File

@ -21,6 +21,17 @@ return [
// 可见性
'visibility' => 'public',
],
'aliyun'=>[
'type'=>'Aliyun',//驱动使用阿里云
'accessId' => 'LTAI5t7mhH3ij2cNWs1zhPmv',
'accessSecret' => 'gqo2wMpvi8h5bDBmCpMje6BaiXvcPu',
'bucket' => 'lihai001',
'endpoint' => '"oss-cn-chengdu.aliyuncs.com',
// 'timeout' => 3600,
// 'connectTimeout' => 10,
// 'isCName' => false,
// 'token' => '',
]
// 更多的磁盘配置信息
],
];