开始优化类别获取
This commit is contained in:
1 parent
6d1d18b48b
commit
e3be1c24cb
11 files changed
+47
-72
No files matched your search
+13
-4
@@ -12,18 +12,27 @@
|
||||
// 应用公共文件
|
||||
|
||||
// 获取类别列表
|
||||
function getCategory($id = '0')
|
||||
function getCategory($id = '0',$title='')
|
||||
{
|
||||
|
||||
|
||||
dump($id);
|
||||
dump($title);
|
||||
|
||||
$category = new \app\system\model\Category;
|
||||
|
||||
// 根据父级id查询类别列表
|
||||
$list = $category
|
||||
->where('pid',$id)
|
||||
->when(strlen($title)>0,function($q) use($title){
|
||||
$q->where('title',$title);
|
||||
},function($q) use($id){
|
||||
$q->where('pid',$id);
|
||||
})
|
||||
->where('status',1)
|
||||
->field('id,title')
|
||||
->fetchSql(true)
|
||||
->select();
|
||||
|
||||
halt($list);
|
||||
|
||||
// 返回类别列表
|
||||
return $list;
|
||||
}
|
||||
|
||||
@@ -32,54 +32,6 @@ class OnLine extends Controller
|
||||
if($yz['status'] == 0){
|
||||
echo "<script>top.location.href='login';</script>";
|
||||
}
|
||||
|
||||
|
||||
// 实例化权限验证类
|
||||
$auth = new Auth();
|
||||
|
||||
// 获取当前地址
|
||||
$mod = $request->module();
|
||||
$con = $request->controller();
|
||||
$act = $request->action();
|
||||
$url = $mod.'/'.$con.'/'.$act;
|
||||
|
||||
// 排除模块
|
||||
$uneed_m = array('home');
|
||||
// 排除控制器
|
||||
$uneed_c = array(); # 荣誉器名首字母要大写
|
||||
// 排除方法
|
||||
$uneed_a = array(
|
||||
'welcome','upload','myinfo',
|
||||
'mybanji','banjilist',
|
||||
'editpassword','updatepassword',
|
||||
// 教师信息查询
|
||||
'srcteacher','srcry','srckt',
|
||||
// 查询班级成绩、查询年级成绩、查询录入成绩人员信息
|
||||
'ajaxbianji','ajaxnianji','ajaxaddinfo',
|
||||
// 批量保存
|
||||
// 'saveall',
|
||||
// 下载成绩表、下载成绩统计表
|
||||
'dwchengjixls','dwbanjixls','dwnianjixls',
|
||||
//保存考号、下载试卷标签、下载成绩采集表
|
||||
'updateset','kaohaosave','biaoqianxls','dwcaiji',
|
||||
//课题结题图片上传和更新
|
||||
'jtupload','jtupdate','ajaxdata'
|
||||
);
|
||||
// 排除指定模块下的指定方法
|
||||
$uneed_u = array('index/Index/index');
|
||||
|
||||
// 验证是否是排除方法
|
||||
if(in_array($mod,$uneed_m) || in_array($con,$uneed_c) || in_array($act,$uneed_a) || in_array($url,$uneed_u))
|
||||
{
|
||||
$except = true;
|
||||
}else{
|
||||
$except = false;
|
||||
}
|
||||
|
||||
// 验证方法
|
||||
if( !$auth->check($url, session('userid')) && $except == false ){// 第一个参数是规则名称,第二个参数是用户UID
|
||||
$this->error('哎哟~ 因为权限不足');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
@@ -27,14 +27,13 @@ class Index extends BaseController
|
||||
// 查询系统信息
|
||||
$list = $sysbasemod
|
||||
->order(['id'=>'desc'])
|
||||
->field('id,webtitle,keywords,description')
|
||||
->field('id,keywords,description')
|
||||
->find();
|
||||
|
||||
// 存储网站名
|
||||
session('webtitle',$list->webtitle);
|
||||
|
||||
// 获取版本号
|
||||
$list->version = config('shangma.version');
|
||||
// 获取系统名称和版本号
|
||||
$list['webtitle'] = config('shangma.webtitle');
|
||||
$list['version'] = config('shangma.version');
|
||||
// 获取用户姓名
|
||||
$ad = new \app\admin\model\Admin;
|
||||
$list->xingming = $ad->where('id',session('userid'))->value('xingming');
|
||||
@@ -98,11 +97,12 @@ class Index extends BaseController
|
||||
// 查询系统设置
|
||||
$list = $sysbasemod
|
||||
->order(['id'=>'desc'])
|
||||
->field('webtitle,thinks,danwei')
|
||||
->field('thinks,danwei')
|
||||
->find();
|
||||
|
||||
// 查询用户登信息
|
||||
$list['username'] = session('username');
|
||||
$list['webtitle'] = config('shangma.webtitle');
|
||||
|
||||
// 查询用户姓名及用户拥有的权限
|
||||
$admin = new \app\admin\model\Admin;
|
||||
|
||||
Loaded 3 of 11 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user