diff --git a/app/Luru/common.php b/app/Luru/common.php
index d433d0cb..c3779525 100644
--- a/app/Luru/common.php
+++ b/app/Luru/common.php
@@ -1,2 +1,149 @@
$manfen) {
+ $data['val'] = 0;
+ $data['msg'] = '得分必须必须小于等于'.$manfen;
+ return $data;
+ }
+
+ // if ( ($defen*10)%5 != 0 ) {
+ // $data['val'] = 0;
+ // $data['msg'] = '得分必须只能是x.5';
+ // return $data;
+ // }
+
+ return $data;
+}
+
+
+
+ /**
+ * 从统计结果中获取条形统计图中需要的各项目成绩
+ *
+ * @access public
+ * @param arr 统计结果
+ * @param xm 要统计的项目
+ * @return array 返回类型
+ */
+ function tiaoxingOnexiangmu($jg, $xm)
+ {
+ $chengji = array();
+ $series = array();
+ foreach ($jg as $key => $value) {
+ if($key ==0)
+ {
+ $chengji[$key][] = '项目';
+ foreach ($value['chengji'] as $k => $val) {
+ $chengji[$key][] = $val['title'];
+ $series[] = ['type'=>'bar'];
+ }
+ }
+ # code...
+ if( isset($value['banji_title']))
+ {
+ $temp = $value['school_jiancheng'].$value['banji_title'];
+ }else{
+ $temp = $value['school_jiancheng'];
+ }
+ $chengji[$key+1][] = $temp;
+ foreach ($value['chengji'] as $k => $val) {
+ $chengji[$key+1][] = $val[$xm];
+ }
+ }
+ $data = [
+ 'data'=>$chengji,
+ 'series'=>$series,
+ ];
+
+ return $data;
+ }
+
+
+ /**
+ * 从统计结果中获取条形箱体图需要的各项目成绩
+ *
+ * @access public
+ * @param arr 统计结果
+ * @param xm 要统计的项目
+ * @return array 返回类型
+ */
+ function xiangti($jg)
+ {
+ $data = array();
+ $axisData = array();
+ $chengji = array();
+ $category = array();
+
+ foreach ($jg as $key => $value) {
+ if ($key ==0) {
+ foreach ($value['chengji'] as $k => $val) {
+ $category[$k] = $val['title'];
+ }
+ }
+
+ foreach ($value['chengji'] as $k => $val) {
+ $chengji[$k][$key][0] = $val['sifenwei']['min'];
+ $chengji[$k][$key][1] = $val['sifenwei']['q1'];
+ $chengji[$k][$key][2] = $val['sifenwei']['q2'];
+ $chengji[$k][$key][3] = $val['sifenwei']['q3'];
+ $chengji[$k][$key][4] = $val['sifenwei']['max'];
+ }
+
+ if (isset($value['banji_title'])) {
+ $temp = $value['school_jiancheng'] . $value['banji_title'];
+ } else {
+ $temp = $value['school_jiancheng'];
+ }
+
+ $axisData[] = $temp;
+ }
+
+ $data = [
+ 'axisData' => $axisData
+ ,'boxData' => $chengji
+ ,'category' => $category
+ ];
+
+ return $data;
+ }
+
+ /**
+ * 把给定的成绩进行排序
+ * @access public
+ * @param array $arr 要计算的一维数组成绩
+ * @return array $result 返回成绩排序结果
+ */
+ function tjOrder($cj,$type = 'desc')
+ {
+ if ($type == 'desc') {
+ arsort($cj);
+ } else {
+ asort($cj);
+ }
+
+ return $cj;
+ }
\ No newline at end of file
diff --git a/app/Luru/controller/Index.php b/app/Luru/controller/Index.php
index 9e10acad..5248b2ab 100644
--- a/app/Luru/controller/Index.php
+++ b/app/Luru/controller/Index.php
@@ -2,17 +2,39 @@
declare (strict_types = 1);
// 引用控制器基类
-namespace app\BaseControllerr;
+namespace app\luru\controller;
// 引用控制器基类
+use app\BaseController;
use app\chengji\model\Chengji;
use app\teach\model\Subject;
-class Index extends BaseControllerr
+
+class Index extends BaseController
{
+ protected $middleware = [];
+
+ protected $userid = '';
+
protected function initialize()
{
- deump('初始化');
+ $online = session('onlineCategory');
+ if($online == 'teacher')
+ {
+ $this->middleware = [
+ 'online'
+ ,'terlogin'
+ ];
+ $this->userid = session('teacher.userid');
+
+ }else{
+ $this->middleware = [
+ 'online'
+ ,'login'
+ ,'auth'
+ ];
+ $this->userid = $this->userid;
+ }
}
// 成绩列表
@@ -49,7 +71,7 @@ class Index extends BaseControllerr
,'order' => 'desc'
,'subject_id' => ''
,'searchval'
- ,'user_id' => session('admin.userid')
+ ,'teacher_id' => $this->userid
], 'POST');
// 根据条件查询数据
@@ -138,7 +160,7 @@ class Index extends BaseControllerr
$data = [
'kaohao_id' => $list['kaohao_id']
,'subject_id' => $list['subject_id']
- ,'user_id' => session('admin.userid')
+ ,'teacher_id' => $this->userid
,'defen' => $list['defen']
,'defenlv' => $list['defen'] / $manfen * 100
];
@@ -212,13 +234,13 @@ class Index extends BaseControllerr
$cjone->defen = $list['newdefen'];
$cjone->defenlv = $list['newdefen'] / $manfen * 100;
- $cjone->user_id = session('admin.userid');
+ $cjone->teacher_id = $this->userid;
$data = $cjone->save();
} else {
$data = [
'kaohao_id' => $list['kaohao_id']
,'subject_id' => $subject_id
- ,'user_id' => session('admin.userid')
+ ,'teacher_id' => $this->userid
,'defen' => $list['newdefen']
,'defenlv' => $list['newdefen'] / $manfen * 100
];
@@ -241,6 +263,12 @@ class Index extends BaseControllerr
$val = input('post.val');
// 实例化系统设置类
$val = \app\facade\Tools::decrypt($val, 'dlbz');
+ $yz = strstr($val, '|');
+ if($yz == false)
+ {
+ $cjlist = array();
+ return json($cjlist);
+ }
$list = explode('|', $val);
$id = $list[0];
$subject_id = $list[1];
@@ -326,7 +354,7 @@ class Index extends BaseControllerr
}
}
- $user_id = session('admin.userid'); # 获取用户id
+ $user_id = $this->userid; # 获取用户id
$data = array();
// 重新组合数组
@@ -362,7 +390,7 @@ class Index extends BaseControllerr
$cjone->restore();
$cjone->defen = $defen;
$cjone->defenlv = $defen / $manfen * 100;
- $cjone->user_id = $user_id;
+ $cjone->teacher_id = $user_id;
$cjone->save();
}
} else {
@@ -370,7 +398,7 @@ class Index extends BaseControllerr
$data = [
'kaohao_id' => $val[1]
,'subject_id' => $value['id']
- ,'user_id' => $user_id
+ ,'teacher_id' => $user_id
,'defen' => $defen
,'defenlv' => $defen / $manfen * 100
];
diff --git a/app/Luru/view/index/biaolu.html b/app/Luru/view/index/biaolu.html
new file mode 100644
index 00000000..d0d68f53
--- /dev/null
+++ b/app/Luru/view/index/biaolu.html
@@ -0,0 +1,225 @@
+{extend name=".././view/createhref.html" /}
+{block name="form"}
+
+
+
+
+
+
+{/block}
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/Luru/view/index/index.html b/app/Luru/view/index/index.html
new file mode 100644
index 00000000..1e734093
--- /dev/null
+++ b/app/Luru/view/index/index.html
@@ -0,0 +1,151 @@
+
+{extend name=".././view/list.html" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 成绩采集
+ 已录成绩
+
+{/block}
+{block name="search"}
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
diff --git a/app/Luru/view/index/malu.html b/app/Luru/view/index/malu.html
new file mode 100644
index 00000000..652a3904
--- /dev/null
+++ b/app/Luru/view/index/malu.html
@@ -0,0 +1,126 @@
+{extend name=".././view/create.html" /}
+
+{block name="form"}
+
+
+
+
+
+
+
学校
+
+
班级
+
+
姓名
+
+
学科
+
+
+
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/chengji/common.php b/app/chengji/common.php
deleted file mode 100644
index 3b8a600b..00000000
--- a/app/chengji/common.php
+++ /dev/null
@@ -1,149 +0,0 @@
- $manfen) {
- $data['val'] = 0;
- $data['msg'] = '得分必须必须小于等于'.$manfen;
- return $data;
- }
-
- // if ( ($defen*10)%5 != 0 ) {
- // $data['val'] = 0;
- // $data['msg'] = '得分必须只能是x.5';
- // return $data;
- // }
-
- return $data;
-}
-
-
-
- /**
- * 从统计结果中获取条形统计图中需要的各项目成绩
- *
- * @access public
- * @param arr 统计结果
- * @param xm 要统计的项目
- * @return array 返回类型
- */
- function tiaoxingOnexiangmu($jg, $xm)
- {
- $chengji = array();
- $series = array();
- foreach ($jg as $key => $value) {
- if($key ==0)
- {
- $chengji[$key][] = '项目';
- foreach ($value['chengji'] as $k => $val) {
- $chengji[$key][] = $val['title'];
- $series[] = ['type'=>'bar'];
- }
- }
- # code...
- if( isset($value['banji_title']))
- {
- $temp = $value['school_jiancheng'].$value['banji_title'];
- }else{
- $temp = $value['school_jiancheng'];
- }
- $chengji[$key+1][] = $temp;
- foreach ($value['chengji'] as $k => $val) {
- $chengji[$key+1][] = $val[$xm];
- }
- }
- $data = [
- 'data'=>$chengji,
- 'series'=>$series,
- ];
-
- return $data;
- }
-
-
- /**
- * 从统计结果中获取条形箱体图需要的各项目成绩
- *
- * @access public
- * @param arr 统计结果
- * @param xm 要统计的项目
- * @return array 返回类型
- */
- function xiangti($jg)
- {
- $data = array();
- $axisData = array();
- $chengji = array();
- $category = array();
-
- foreach ($jg as $key => $value) {
- if ($key ==0) {
- foreach ($value['chengji'] as $k => $val) {
- $category[$k] = $val['title'];
- }
- }
-
- foreach ($value['chengji'] as $k => $val) {
- $chengji[$k][$key][0] = $val['sifenwei']['min'];
- $chengji[$k][$key][1] = $val['sifenwei']['q1'];
- $chengji[$k][$key][2] = $val['sifenwei']['q2'];
- $chengji[$k][$key][3] = $val['sifenwei']['q3'];
- $chengji[$k][$key][4] = $val['sifenwei']['max'];
- }
-
- if (isset($value['banji_title'])) {
- $temp = $value['school_jiancheng'] . $value['banji_title'];
- } else {
- $temp = $value['school_jiancheng'];
- }
-
- $axisData[] = $temp;
- }
-
- $data = [
- 'axisData' => $axisData
- ,'boxData' => $chengji
- ,'category' => $category
- ];
-
- return $data;
- }
-
- /**
- * 把给定的成绩进行排序
- * @access public
- * @param array $arr 要计算的一维数组成绩
- * @return array $result 返回成绩排序结果
- */
- function tjOrder($cj,$type = 'desc')
- {
- if ($type == 'desc') {
- arsort($cj);
- } else {
- asort($cj);
- }
-
- return $cj;
- }
\ No newline at end of file
diff --git a/app/chengji/controller/Index.php b/app/chengji/controller/Index.php
index f5f2783b..843dacd0 100644
--- a/app/chengji/controller/Index.php
+++ b/app/chengji/controller/Index.php
@@ -618,16 +618,16 @@ class Index extends AdminBase
$data = $chengji
->where('kaohao_id',$src['kaohao'])
- ->field('id,kaohao_id,subject_id,user_id,defen,update_time')
+ ->field('id,kaohao_id,subject_id,teacher_id,defen,update_time')
->order([$src['field']=>$src['order']])
->with([
'subjectName'=>function($query){
$query->field('id,title');
},
'userName'=>function($query){
- $query->field('id,school_id,xingming')
+ $query->field('id,danwei_id,xingming')
->with([
- 'adSchool'=>function($query){
+ 'jsDanwei'=>function($query){
$query->field('id,jiancheng');
}
]);
diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php
index 8e70307e..05df9baf 100644
--- a/app/chengji/model/Chengji.php
+++ b/app/chengji/model/Chengji.php
@@ -18,7 +18,7 @@ class Chengji extends BaseModel
// 学科关联
public function userName()
{
- return $this->belongsTo('\app\admin\model\Admin','user_id','id');
+ return $this->belongsTo('\app\teacher\model\Teacher','teacher_id','id');
}
diff --git a/app/chengji/view/index/index.html b/app/chengji/view/index/index.html
index 58ae63a8..0fac9fda 100644
--- a/app/chengji/view/index/index.html
+++ b/app/chengji/view/index/index.html
@@ -168,7 +168,7 @@
// 修改服务器数据
$.ajax({
- url:"/chengji/luru/update/"+rowdata.id,
+ url:"/luru/index/update/"+rowdata.id,
type:'PUT',
data:{
"colname":colname,
diff --git a/app/chengji/view/index/read_add.html b/app/chengji/view/index/read_add.html
index bef01e0b..8f472ec5 100644
--- a/app/chengji/view/index/read_add.html
+++ b/app/chengji/view/index/read_add.html
@@ -47,9 +47,9 @@
var str='';
if(d.userName)
{
- if(d.userName.adSchool)
+ if(d.userName.jsDanwei)
{
- str = d.userName.adSchool.jiancheng + ' ' + d.userName.xingming;
+ str = d.userName.jsDanwei.jiancheng + ' ' + d.userName.xingming;
}
}
return str;
@@ -62,7 +62,7 @@
options.where = {
kaohao:"{$list.kaohao}"
}
-
+
// 提交搜索条件后重载表格
layui.use(['table','cjgl'],function(){
@@ -97,7 +97,7 @@
,colname = obj.field
,rowdata = obj.data;
- // 修改服务器数据
+ // 修改服务器数据
$.ajax({
url:"/chengji/"+rowdata.id,
type:'PUT',
@@ -117,7 +117,7 @@
layer.msg('数据扔半道啦。',function(){});
},
});
- })
+ })
});
-{/block}
\ No newline at end of file
+{/block}
diff --git a/app/controller/TeacherSearchChengji/Luru.php b/app/controller/TeacherSearchChengji/Luru.php
deleted file mode 100644
index f2140925..00000000
--- a/app/controller/TeacherSearchChengji/Luru.php
+++ /dev/null
@@ -1,85 +0,0 @@
-error('很长时间没有操作,登录超时啦~','/login/student');
- }else{
- $category = session('onlineCategory');
- if ($category != 'student')
- {
- $this->error('请使用学生帐号登录', '/login/student');
- }
- }
-
- // 尝试从session中获取用户名和密码
- $username = session('?student.username') ? $username = session('student.username') : $username = '';
- $password = session('?student.password') ? $password = session('student.password') : $password = '';
- // 尝试从cookie中获取用户名和密码
- if (strlen($username)<1 )
- {
- $username = cookie('?username') ? $username = cookie('username') : $username = '';
- $password = cookie('?password') ? $password = cookie('password') : $password = '';
- }
-
+ $category = session('onlineCategory');
$isajax = $request->isAjax();
-
- // 如果没有获取到用户名和密码,则跳转到登录页面
- if(strlen($username)<1)
+ if ($category != 'student')
{
- if($isajax)
- {
- $this->error('很长时间没有操作,登录超时啦~', '/login/err');
- }else{
- echo "";
- }
+
+ \app\facade\OnLine::jump('/login/student', '请使用学生帐号登录');
}
+ $userInfo = \app\facade\OnLine::getLoginInfo('student');
+
// 检验用户名或密码是否正确
$yz = new \app\login\controller\Student;
- $yz = $yz->check($username,$password);
- if($yz['status'] == 0){
- if($isajax)
- {
- $this->error('密码刚才修改过了,请重新登录~', '/login/err');
- }else{
- echo "";
- }
+ $yz = $yz->check($userInfo['username'],$userInfo['password']);
+ if($yz['status'] == 0){
+ \app\facade\OnLine::jump('/login/student', '请使用新密码登录');
}
return $next($request);
diff --git a/app/middleware/TeacherLogin.php b/app/middleware/TeacherLogin.php
index c6d6448a..ebc13ced 100644
--- a/app/middleware/TeacherLogin.php
+++ b/app/middleware/TeacherLogin.php
@@ -15,40 +15,22 @@ class TeacherLogin
*/
public function handle($request, \Closure $next)
{
- // 尝试从session中获取用户名和密码
- $username = session('?teacher.username') ? $username = session('teacher.username') : $username = '';
- $password = session('?teacher.password') ? $password = session('teacher.password') : $password = '';
- // 尝试从cookie中获取用户名和密码
- if (strlen($username)<1 )
- {
- $username = cookie('?username') ? $username = cookie('username') : $username = '';
- $password = cookie('?password') ? $password = cookie('password') : $password = '';
- }
-
+ $category = session('onlineCategory');
$isajax = $request->isAjax();
-
- // 如果没有获取到用户名和密码,则跳转到登录页面
- if(strlen($username)<1)
+ if ($category != 'teacher')
{
- if($isajax)
- {
- $this->error('很长时间没有操作,登录超时啦~');
- }else{
- echo "";
- }
+
+ \app\facade\OnLine::jump('/login/teacher', '请使用教师帐号登录');
}
+ $userInfo = \app\facade\OnLine::getLoginInfo('teacher');
+
// 检验用户名或密码是否正确
$yz = new \app\login\controller\Teacher;
- $yz = $yz->check($username,$password);
- if($yz['status'] == 0){
- if($isajax)
- {
- $this->error('密码刚才修改过了,请重新登录~','/login/err');
- }else{
- echo "";
- }
+ $yz = $yz->check($userInfo['username'],$userInfo['password']);
+ if($yz['status'] == 0){
+ \app\facade\OnLine::jump('/login/teacher', '请使用新密码登录');
}
return $next($request);
diff --git a/app/middleware/UserLogin.php b/app/middleware/UserLogin.php
index 880eef79..27132d99 100644
--- a/app/middleware/UserLogin.php
+++ b/app/middleware/UserLogin.php
@@ -18,7 +18,7 @@ class UserLogin
$isajax = $request->isAjax();
if ($category != 'admin')
{
-
+
\app\facade\OnLine::jump('/login', '请使用管理员帐号登录');
}
diff --git a/app/teacherSearchChengji/controller/Index.php b/app/teacherSearchChengji/controller/Index.php
index 876abb56..07af9a56 100644
--- a/app/teacherSearchChengji/controller/Index.php
+++ b/app/teacherSearchChengji/controller/Index.php
@@ -42,15 +42,15 @@ class Index extends TeacherSearchBase
,'authCid' => [
[
'title' => '扫码录入'
- ,'url' => '/teachersearchchengji/index/banji'
+ ,'url' => '/luru/index/malu'
]
,[
'title' => '表格录入'
- ,'url' => '/teachersearchchengji/index/banji'
+ ,'url' => '/luru/index/biaolu'
]
,[
'title' => '已录成绩'
- ,'url' => '/teachersearchchengji/index/banji'
+ ,'url' => '/luru/index/index'
]
]
]
diff --git a/database/migrations/20190430034853_chengji.php b/database/migrations/20190430034853_chengji.php
index 6850438c..1fc983b6 100644
--- a/database/migrations/20190430034853_chengji.php
+++ b/database/migrations/20190430034853_chengji.php
@@ -35,7 +35,7 @@ class Chengji extends Migrator
$table
->addColumn('kaohao_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'考试'])
->addColumn('subject_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'学科'])
- ->addColumn('user_id','string',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'学生'])
+ ->addColumn('teacher_id','integer',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'学生'])
->addColumn('defen','decimal',['precision'=>5,'scale'=>1,'default'=>Null,'null'=>false,'comment'=>'得分'])
->addColumn('defenlv','decimal',['precision'=>6,'scale'=>2,'default'=>Null,'null'=>false,'comment'=>'得分率'])
diff --git a/database/seeds/Category.php b/database/seeds/Category.php
index 68db202c..920183de 100644
--- a/database/seeds/Category.php
+++ b/database/seeds/Category.php
@@ -267,6 +267,15 @@ class Category extends Seeder
['id' => 12004,'title' => '学校排序','p_id' => 120,'paixu' => 4,'isupdate' => 0],
['id' => 12005,'title' => '区统计','p_id' => 120,'paixu' => 5,'isupdate' => 0],
['id' => 12006,'title' => '区排序','p_id' => 120,'paixu' => 6,'isupdate' => 0],
+ ['id' => 121
+ ,'title' => '成绩录入用户类型'
+ ,'p_id' => 0
+ ,'paixu' => 21
+ ,'isupdate' => 0
+ ],
+ // 课题或荣誉角色
+ ['id' => 12101,'title' => '班级统计','p_id' => 121,'paixu' => 1,'isupdate' => 0],
+ ['id' => 12102,'title' => '班级排序','p_id' => 121,'paixu' => 2,'isupdate' => 0],
];
// 保存数据
$this->table('category')->insert($rows)->save();
diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php
index 3e27e8b9..c4befcbf 100644
--- a/database/seeds/Rule.php
+++ b/database/seeds/Rule.php
@@ -37,19 +37,19 @@ class Rule extends Seeder
],
['id' => 10101
,'title' => '扫码查询'
- ,'name' => '/luru/index/read'
+ ,'name' => 'luru/index/read'
,'paixu' => 1
,'pid' => 101
]
,['id' => 10102
,'title' => '扫码保存'
- ,'name' => '/luru/index/malusave'
+ ,'name' => 'luru/index/malusave'
,'paixu' => 2
,'pid' => 101
],
['id' => 102
,'title' => '表格录入'
- ,'name' => '/luru/index/biaolu'
+ ,'name' => 'luru/index/biaolu'
,'paixu' => 2
,'ismenu' => 1
,'pid' => 1
@@ -57,19 +57,19 @@ class Rule extends Seeder
],
['id' => 10201
,'title' => '表格保存'
- ,'name' => '/luru/index/saveall'
+ ,'name' => 'luru/index/saveall'
,'paixu' => 1
,'pid' => 102
],
['id' => 10202
,'title' => '表格上传'
- ,'name' => '/luru/index/upload'
+ ,'name' => 'luru/index/upload'
,'paixu' => 2
,'pid' => 102
],
['id' => 103
,'title' => '已录列表'
- ,'name' => '/luru/index/index'
+ ,'name' => 'luru/index/index'
,'paixu' => 2
,'ismenu' => 1
,'pid' => 1