first commit

This commit is contained in:
2026-07-23 09:40:36 +08:00
commit 090abf48fa
989 changed files with 145728 additions and 0 deletions
+158
View File
@@ -0,0 +1,158 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\base;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Request;
use think\facade\Session;
use think\facade\View;
use systematic\Systematic;
/**
* 控制器基础类
*/
abstract class BaseController
{
/**
* 是否批量验证
* @var bool
*/
protected $batchValidate = false;
/**
* 分页数量
* @var string
*/
protected $pageSize = 20;
/**
* 控制器中间件
* @var array
*/
protected $middleware = [];
protected $module;
protected $controller;
protected $action;
protected $uid;
protected $did;
protected $pid;
/**
* 构造方法
* @access public
* @param App $app 应用对象
*/
protected $model;
public function __construct()
{
$this->module = strtolower(app('http')->getName());
$this->controller = strtolower(Request::controller());
$this->action = strtolower(Request::action());
$this->uid = 0;
$this->did = 0;
$this->pid = 0;
// 控制器初始化
$this->initialize();
}
// 初始化
protected function initialize()
{
// 检测权限
$this->checkLogin();
//每页显示数据量
$this->pageSize = Request::param('limit', \think\facade\Config::get('app.page_size'));
}
/**
*验证用户登录
*/
protected function checkLogin()
{
if ($this->controller !== 'login' && $this->controller !== 'captcha') {
$session_admin = get_config('app.session_admin');
if (!Session::has($session_admin)) {
if (request()->isAjax()) {
return to_assign(404, '请先登录');
} else {
redirect('/home/login/index.html')->send();
exit;
}
} else {
$this->uid = Session::get($session_admin);
$login_admin = get_admin($this->uid);
$this->did = $login_admin['did'];
$this->pid = $login_admin['pid'];
$is_lock = $login_admin['is_lock'];
$last_login_time = Db::name('Admin')->where(['id' => $this->uid])->value('last_login_time');
$timeDiff = time() - $last_login_time;
// 如果超过10小时(36000秒),则用户需要重新登录
if ($timeDiff > 36000) {
Session::delete($session_admin);
redirect('/home/login/index.html')->send();
exit;
}
Db::name('Admin')->where(['id' => $this->uid])->update(['last_login_time' => time()]);
if($is_lock==1){
redirect('/home/login/lock.html')->send();
exit;
}
View::assign('login_admin', $login_admin);
$not_check=['index','leaves','outs','overtimes','trips','message'];
// 验证用户访问权限
if ($this->module == 'home' && in_array($this->controller, $not_check)) {
return true;
}
else{
$regPwd = $login_admin['reg_pwd'];
if($regPwd!==''){
redirect('/home/index/edit_password.html')->send();
exit;
}
if (!$this->checkAuth()) {
if (request()->isAjax()) {
return to_assign(405, '你没有权限,请联系管理员或者人事部');
} else {
redirect('/home/index/role')->send();
exit;
}
}
}
}
}
}
/**
* 验证用户访问权限
* @DateTime 2020-12-21
* @param string $controller 当前访问控制器
* @param string $action 当前访问方法
* @return [type]
*/
protected function checkAuth()
{
//Cache::delete('RulesSrc' . $uid);
$uid = $this->uid;
$GOUGU = new Systematic();
$GOUGU->auth($uid);
$auth_list_all = Cache::get('RulesSrc0');
$auth_list = Cache::get('RulesSrc' . $uid);
$pathUrl = $this->module . '/' . $this->controller . '/' . $this->action;
if (!in_array($pathUrl, $auth_list)) {
return false;
} else {
return true;
}
}
}
+57
View File
@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit"/>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
{block name="meta"}
<link rel="mobile-prefetch" href=""/>
{/block}
{block name="title"}
<title>{:get_system_config('web','admin_title')}</title>
{/block}
{block name="keywords"}
<meta name="keywords" content="{:get_system_config('web','keywords')}"/>
<meta name="description" content="{:get_system_config('web','desc')}"/>
{/block}
{block name="css"}
<link rel="stylesheet" href="{__GOUGU__}/gougu/css/gougu.css?v={:get_system_config('system','version')}" media="all">
{/block}
{block name="style"}{/block}
<script>
const login_admin={$login_admin.id};
</script>
{block name="js"}{/block}
</head>
<body class="main-body">
<!-- 主体 -->
{block name="body"}{/block}
<!-- /主体 -->
<!-- 底部 -->
{block name="footer"}{/block}
<!-- /底部 -->
<!-- 脚本 -->
{block name="script"}{/block}
<!-- /脚本 -->
<script src="{__GOUGU__}/layui/layui.js"></script>
<script src="{__GOUGU__}/gougu/gouguInit.js?v={:get_system_config('system','version')}"></script>
<!-- 版权标识 -->
<!--
+------------------------------------------------------------------------------------------
勾股OA系统开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+------------------------------------------------------------------------------------------
如需去除版权标识使用的,请微信(hdm588)联系作者去除,开源不易,请多支持!
+------------------------------------------------------------------------------------------
勾股工作室 <hdm58@qq.com>
+------------------------------------------------------------------------------------------
-->
{block name="copyright"}
<div class="copyright">Copyright © 2022-2025 勾股OA - {:CMS_VERSION} Powered by GouguOPEN<a href="https://www.gougucms.com" target="_blank">官网</a><a href="https://blog.gougucms.com" target="_blank">社区</a><a href="https://blog.gougucms.com/home/book/detail/bid/3/id/7.html" target="_blank">文档</a></div></div>
{/block}
<!-- /版权标识 -->
</body>
</html>
+40
View File
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>找不到模板文件</title>
<style type="text/css">
html,body {width: 100%;height: 100%;background: #f7f7f7;margin: 0;padding: 0;border: 0;}
div,p {margin: 0;padding: 0;border: 0;}
.container {width: 100%;height: 100%;position: fixed;top: 0;left: 0;z-index: 999;overflow: hidden;}
.info {width: 360px;height: 360px;position: absolute;top: 50%;left: 50%;margin-top: -200px;margin-left: -180px;text-align:center;}
.info-status{width: 360px; display:none;justify-content: space-between;align-items: center;flex-wrap: nowrap;}
.info-status div{width:180px; height:180px; line-height:180px; font-size:160px; font-weight:200; color:#F35F37}
.info-status div.face{font-size:60px; border:9px solid #F35F37; width:120px; height:120px; line-height:118px; background-color:#fff; border-radius:50%;}
.info-tips{font-size:20px;color:#F35F37; padding-top:32px; font-weight:600; line-height:1.8}
.info-text{padding-top:20px; line-height:1.6; text-align:left; font-size:14px; color:#646464}
.footer {position: absolute;font-size: 12px;bottom: 28px;text-align: center;width: 100%;color: #969696;}
.info-status{display: -webkit-flex;display: flex;flex-direction: row;}
</style>
</head>
<body>
<div class="container">
<div class="info">
<div class="info-status">
<div>4</div><div class="face">😔</div><div>6</div>
</div>
<div class="info-tips">哎呀!找不到模板文件</div>
<div class="info-text">{$file | default=""}模板不存在,请检查对应的目录文件,注意区分大小写!</div>
</div>
<div class="footer">
Copyright © 2022-2024 勾股OA Powered by GouguOPEN
</div>
</div>
</body>
</html>
+38
View File
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>找不到文件</title>
<style type="text/css">
html,body {width: 100%;height: 100%;background: #f7f7f7;margin: 0;padding: 0;border: 0;}
div,p {margin: 0;padding: 0;border: 0;}
.container {width: 100%;height: 100%;position: fixed;top: 0;left: 0;z-index: 999;overflow: hidden;}
.info {width: 480px;position: absolute;top: 50%;left: 50%;margin-top: -200px;margin-left: -240px;text-align:center;}
.info-status{width: 480px; display: -webkit-flex;display: flex;flex-direction: row;justify-content: space-between;align-items: center;flex-wrap: nowrap;}
.info-status div{width:180px; height:180px; line-height:180px; font-size:180px; font-weight:200; color:#F35F37}
.info-status div.face{font-size:60px; border:9px solid #F35F37; width:120px; height:120px; line-height:118px; background-color:#fff; border-radius:50%;}
.info-tips{font-size:24px;color:#F35F37; padding-top:32px; font-weight:600;}
.info-text{padding-top:20px; line-height:1.6; text-align:left; font-size:14px; color:#646464}
.footer {position: absolute;font-size: 12px;bottom: 28px;text-align: center;width: 100%;color: #969696;}
</style>
</head>
<body>
<div class="container">
<div class="info">
<div class="info-status">
<div>4</div><div class="face">😔</div><div>4</div>
</div>
<div class="info-tips">哎呀!找不到文件!</div>
</div>
<div class="footer">
© 2022 gougucms.com GPL-3.0 licensePowered by 勾股OA
</div>
</div>
</body>
</html>
+38
View File
@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>您没有权限</title>
<style type="text/css">
html,body {width: 100%;height: 100%;background: #f7f7f7;margin: 0;padding: 0;border: 0;}
div,p {margin: 0;padding: 0;border: 0;}
.container {width: 100%;height: 100%;position: fixed;top: 0;left: 0;z-index: 999;overflow: hidden;}
.info {width: 360px;height: 360px;position: absolute;top: 50%;left: 50%;margin-top: -200px;margin-left: -180px;text-align:center;}
.info-status{width: 360px; display:none;justify-content: space-between;align-items: center;flex-wrap: nowrap;}
.info-status div{width:180px; height:180px; line-height:180px; font-size:160px; font-weight:200; color:#F35F37}
.info-status div.face{font-size:60px; border:9px solid #F35F37; width:120px; height:120px; line-height:118px; background-color:#fff; border-radius:50%;}
.info-tips{font-size:20px;color:#F35F37; padding-top:32px; font-weight:600; line-height:1.8}
.footer {position: absolute;font-size: 12px;bottom: 28px;text-align: center;width: 100%;color: #969696;}
.info-status{display: -webkit-flex;display: flex;flex-direction: row;}
</style>
</head>
<body>
<div class="container">
<div class="info">
<div class="info-status">
<div>4</div><div class="face">😔</div><div>5</div>
</div>
<div class="info-tips">哎呀!您没有权限,请联系『管理员』或者『人事部』</div>
</div>
<div class="footer">
Copyright © 2022-2024 勾股OA Powered by GouguOPEN
</div>
</div>
</body>
</html>