Skip to content

Commit

Permalink
医院OA管理系统
Browse files Browse the repository at this point in the history
  • Loading branch information
smithyj committed Dec 10, 2014
1 parent e63817d commit 55b0448
Show file tree
Hide file tree
Showing 1,031 changed files with 148,802 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
92 changes: 92 additions & 0 deletions Oa/Common/Common/function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
require("model.function.php");
/**
* [getUserSession 实时获取用户权限与组信息]
* @return [type] [description]
*/
function getUserSession(){
$User = session("user");

//重组管理员权限
$AuthIds = array();
$AuthRules = M("AuthRule")->field('id')->select();
foreach($AuthRules as $AuthRules_k => $AuthRules_v){
$AuthIds[] = $AuthRules_v['id'];
}
$AuthIds = implode(',', $AuthIds);
$GroupData = array(
'id' => 1,
'rules' => $AuthIds,
);
M("AuthGroup")->save($GroupData);

//初始化Auth权限控制
$Auth = new \Think\Auth();

//获取登录用户拥有的用户组相关信息
$Gids = $Auth->getGroups($User['id']);

//组合用户拥有的用户组下的所有权限规则
$Rules = array();
foreach($Gids as $Gids_k => $Gids_v){
$ruleIds = explode(",",$Gids_v['rules']);
foreach($ruleIds as $ruleIds_k => $ruleIds_v){
$Rules[] = $ruleIds[$ruleIds_k];
}
}
//规则去重复
$Rules = array_unique($Rules);

//组合用户拥有的用户组id
$tmpGids = array();
foreach($Gids as $Gids_k => $Gids_v){
$tmpGids[] = $Gids_v['group_id'];
}
$Gids = $tmpGids;

//记录登录用户规则信息
session("gid",$Gids);
session("rules",$Rules);
}
/**
* [treeRules 递归获取规则树]
* @param [type] $data [递归循环数据]
* @param integer $pid [父级ID]
* @return [type] Array [返回Array树数组]
*/
function treeRules($data,$pid = 0){
$treeRules = array();
foreach($data as $data_v){
if($data_v['pid'] == $pid){
$data_v['children'] = treeRules($data,$data_v['id']);
$treeRules[] = $data_v;
}
}
return $treeRules;
}
/**
* [getTree 获取规则树]
* @return [type] Array [返回处理的数组]
*/
function getTree(){
$Rules = M("AuthRule");
$Rules = $Rules->order("sort asc")->select();
foreach($Rules as $Rules_k => $Rules_v){
$Rules[$Rules_k]['text'] = $Rules[$Rules_k]['title'];
$Rules[$Rules_k]['op'] = $Rules_v['id'];
}
$Rules = treeRules($Rules);
return $Rules;
}
/**
* [getUsergroup 获取角色组]
* @return [type] Array [返回处理的数组]
*/
function getUsergroup(){
$Usergroup = M("AuthGroup");
$Usergroup = $Usergroup->order("id asc")->select();
foreach($Usergroup as $Usergroup_k => $Usergroup_v){
$Usergroup[$Usergroup_k]['text'] = $Usergroup[$Usergroup_k]['title'];
}
return $Usergroup;
}
1 change: 1 addition & 0 deletions Oa/Common/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

38 changes: 38 additions & 0 deletions Oa/Common/Common/model.function.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
// 校验验证码 @return boolean
function checkVerify(){
$verify = new \Think\Verify();
return $verify->check(I('verify'));
}
// 校验用户名是否存在 @return boolean
function checkUsername(){
$User = M("User")->where(array("username"=>I("username")))->find();
if($User<=0){
return false;
}
}
// 校验密码是否正确是否存在 @return boolean
function checkPassword(){
$User = M("User")->where(array("username"=>I("username"),"password"=>I("password",0,'md5')))->find();
//密码错误返回false
if($User<=0){
return false;
} else {
//用户登录信息处理
$data['id'] = $User['id'];
$data['logindate'] = time();
$data['loginnums'] = $User['loginnums']+1;
M('User')->save($data);

//用户登录成功数据处理函数
loginSuccess($User);
}
}
//用户登录成功处理函数
function loginSuccess($User){

//记录登陆用户session信息
session("user",$User);
//获取用户权限与组信息
getUserSession();
}
28 changes: 28 additions & 0 deletions Oa/Common/Conf/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
return array(
//'配置项'=>'配置值'
'SHOW_PAGE_TRACE' => true,
'DEFAULT_MODULE' => 'Oa',

'URL_HTML_SUFFIX' => '',

'TMPL_L_DELIM' => '<{',
'TMPL_R_DELIM' => '}>',
'TMPL_FILE_DEPR' => '_',

'DB_TYPE' => 'mysqli',
'DB_HOST' => 'localhost',
'DB_NAME' => 'oa',
'DB_USER' => 'root',
'DB_PWD' => 'hucxiaoyao',
'DB_PORT' => '3306',
'DB_PREFIX' => 'oa_',
'DB_CHARSET' => 'utf8',
'DB_DSN' => 'mysqli://root:hucxiaoyao@localhost:3306/oa#utf8',

'SESSION_TYPE' => 'Db',

'TITLE' => '医疗OA管理系统',


);
1 change: 1 addition & 0 deletions Oa/Common/Conf/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

23 changes: 23 additions & 0 deletions Oa/Common/Controller/CommonController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace Common\Controller;
use Think\Controller;
use Think\Auth;

class CommonController extends Controller{
public function _initialize(){
//初始化公用变量

//用户登陆信息检测处理
$User = session("user");
if(!$User){
$this->redirect('Login/index');
}
//初始化模板变量
$AppsWhere = array(
"pid" => 0,
"is_show" => 1
);
$Apps = M("AuthRule")->where($AppsWhere)->order("sort asc")->select();
$this->assign("Apps",$Apps);
}
}
1 change: 1 addition & 0 deletions Oa/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file added Oa/Home/Common/function.php
Empty file.
1 change: 1 addition & 0 deletions Oa/Home/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 4 additions & 0 deletions Oa/Home/Conf/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
return array(
//'配置项'=>'配置值'
);
1 change: 1 addition & 0 deletions Oa/Home/Conf/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

8 changes: 8 additions & 0 deletions Oa/Home/Controller/IndexController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index(){
$this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px }</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p><br/>[ 您现在访问的是Home模块的Index控制器 ]</div><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
}
}
1 change: 1 addition & 0 deletions Oa/Home/Controller/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Oa/Home/Model/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Oa/Home/View/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Oa/Home/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions Oa/Oa/Common/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

4 changes: 4 additions & 0 deletions Oa/Oa/Conf/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php
return array(
//'配置项'=>'配置值'
);
1 change: 1 addition & 0 deletions Oa/Oa/Conf/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

10 changes: 10 additions & 0 deletions Oa/Oa/Controller/IndexController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace Oa\Controller;
use Think\Controller;
class IndexController extends PublicController {
public function index(){
//初始化变量
$this->page_title = '系统中心_'.C('TITLE');
$this->display();
}
}
41 changes: 41 additions & 0 deletions Oa/Oa/Controller/LoginController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php
namespace Oa\Controller;
use Think\Controller;

class LoginController extends Controller{
public function index(){
if(IS_POST){
$User = D("User");
if(!$User->create($_POST,4)){//登陆失败
$msg['info'] = $User->getError();
$msg['status'] = "error";
$this->ajaxReturn($msg);
} else {
$msg['info'] = "成功登陆,正在跳转会员中心!";
$msg['status'] = "success";
$msg['url'] = U("Index/index");
$this->ajaxReturn($msg);
}
$this->ajaxReturn($msg);
exit;
}
//初始化变量
$this->page_title = '用户登录_'.C('TITLE');
$this->display();
}
public function verify(){
$config = array(
'fontSize' => 20, // 验证码字体大小
'length' => 3, // 验证码位数
'imageH' => 35,
'useNoise' => false, // 关闭验证码杂点
);
$verify = new \Think\Verify($config);
$verify->codeSet = '0123456789';
$verify->entry();
}
public function logout(){
session(null);
$this->success("成功退出,正在转向登陆页面!",U('Login/index'));
}
}
30 changes: 30 additions & 0 deletions Oa/Oa/Controller/PublicController.class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
namespace Oa\Controller;
use Common\Controller\CommonController;

class PublicController extends CommonController{
//获取左侧菜单权限列表
public function getLeftMenu(){
if(IS_POST){
$ModuleWhere = array(
"pid" => I("pid"),
"is_show" => 1,
'id' => array('in',implode(',', session('rules'))),
);
$Modules = M("AuthRule")->where($ModuleWhere)->order("sort asc")->select();
foreach($Modules as $Modules_k => $Modules_v){
$where = array(
'pid'=> $Modules_v['id'],
'id' => array('in',implode(',', session('rules'))),
);
$Modules_son = M("AuthRule")->order('sort asc')->field("id,title as text,cls as iconCls,name as url")->where($where)->select();
foreach($Modules_son as $Modules_k2 => $Modules_v2){
$Modules_son[$Modules_k2]['url'] = "/index.php/".$Modules_v2['url'];
$Modules_son[$Modules_k2]['type'] = true;
}
$Modules[$Modules_k]['children'] = $Modules_son;
}
$this->ajaxReturn($Modules);
}
}
}
Loading

0 comments on commit 55b0448

Please sign in to comment.