diff --git a/app/Luru/controller/Index.php b/app/Luru/controller/Index.php index 1343e062..9e10acad 100644 --- a/app/Luru/controller/Index.php +++ b/app/Luru/controller/Index.php @@ -10,10 +10,9 @@ use app\teach\model\Subject; class Index extends BaseControllerr { - // 初始化控制器 - function initialize() + protected function initialize() { - + deump('初始化'); } // 成绩列表 @@ -21,7 +20,7 @@ class Index extends BaseControllerr { // 设置要给模板赋值的信息 $list['webtitle'] = '已录列表'; - $list['dataurl'] = '/chengji/luru/data'; + $list['dataurl'] = '/luru/index/data'; $list['status'] = '/chengji/index/status'; // 获取学科列表 @@ -70,7 +69,7 @@ class Index extends BaseControllerr 'webtitle' => '扫码录成绩' ,'butname' => '录入' ,'formpost' => 'PUT' - ,'url' => '/chengji/malu' + ,'url' => '/luru/index/malu' ); // 模板赋值 diff --git a/app/Luru/route/luru.php b/app/Luru/route/luru.php new file mode 100644 index 00000000..393dd7fd --- /dev/null +++ b/app/Luru/route/luru.php @@ -0,0 +1,25 @@ + +// +---------------------------------------------------------------------- +use think\facade\Route; + +// 录入 +Route::group('index', function () { + Route::rule('malu', 'Index/malu', 'get'); # 扫码界面 + Route::rule('malusave', 'Index/malusave', 'put'); # 扫码保存 + Route::rule('read', 'Index/read', 'post'); # 扫码后读取成绩 + Route::rule('biaolu', 'Index/biaolu', 'get'); # 表格录入界面 + Route::rule('saveall', 'Index/saveAll', 'post'); # 保存表格录入信息 + Route::rule('edit/', 'Index/edit', 'get'); # 修改信息 + Route::rule('update/', 'Index/update', 'put'); # 更新信息 + Route::rule('index', 'Index/index', 'get'); # 成绩获取 + Route::rule('data', 'Index/ajaxData', 'post'); # 成绩获取 +}); + diff --git a/app/chengji/route/chengji.php b/app/chengji/route/chengji.php index bef4573b..99a3fa9b 100644 --- a/app/chengji/route/chengji.php +++ b/app/chengji/route/chengji.php @@ -78,18 +78,3 @@ Route::group('schtj', function () { Route::rule('tongji','Schtongji/tongji','post'); # 统计各年级成绩 Route::rule('schorder','Schtongji/schOrder','post'); # 统计各班级成绩 }); - - -// 录入 -Route::group('luru', function () { - Route::rule('malu', 'Luru/malu', 'get'); # 扫码界面 - Route::rule('malusave', 'Luru/malusave', 'put'); # 扫码保存 - Route::rule('read', 'Luru/read', 'post'); # 扫码后读取成绩 - Route::rule('biaolu', 'Luru/biaolu', 'get'); # 表格录入界面 - Route::rule('saveall', 'Luru/saveAll', 'post'); # 保存表格录入信息 - Route::rule('edit/', 'Luru/edit', 'get'); # 修改信息 - Route::rule('update/', 'Luru/update', 'put'); # 更新信息 - Route::rule('index', 'Luru/index', 'get'); # 成绩获取 - Route::rule('data', 'Luru/ajaxData', 'post'); # 成绩获取 -}); - diff --git a/app/student/controller/Index.php b/app/student/controller/Index.php index 64fd3cb5..3de9a784 100644 --- a/app/student/controller/Index.php +++ b/app/student/controller/Index.php @@ -604,4 +604,24 @@ class Index extends AdminBase ->select(); return json($list); } + + + // 重置密码 + public function resetpassword($id) + { + // 生成密码 + $md5 = new \WhiteHat101\Crypt\APR1_MD5; + $password = $md5->hash('123456'); + + // 查询用户信息 + $data = STU::where('id', $id)->update(['password' => $password]); + // 根据更新结果设置返回提示信息 + $data ? $data = ['msg' => '密码已经重置为:
123456', 'val' => 1] + : $data = ['msg' => '数据处理错误', 'val' => 0]; + + // 返回信息 + return json($data); + } + + } diff --git a/app/student/route/student.php b/app/student/route/student.php index 2a0d8da6..c1672f28 100644 --- a/app/student/route/student.php +++ b/app/student/route/student.php @@ -33,6 +33,7 @@ Route::group('index', function () { Route::rule('databy','Index/ajaxdataBy','post'); # 获取数据 Route::rule('dellist','Index/delList','get'); # 信息列表 Route::rule('datadel','Index/ajaxdataDel','post'); # 获取数据 + Route::rule('resetpassword/','Index/resetpassword','post'); # 重置教师密码 }); diff --git a/app/student/view/index/index.html b/app/student/view/index/index.html index 24278d85..d2206c03 100644 --- a/app/student/view/index/index.html +++ b/app/student/view/index/index.html @@ -78,6 +78,7 @@ + @@ -100,7 +101,7 @@ }}, {field: 'status', title: '是否参加考试',templet:'#kaoshi', sort: true}, {field: 'status', title: '状态',templet:'#status', sort: true}, - {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:140} + {field: 'id', title: '操作',toolbar: '#barDemo',minWidth:180} ]]; // 提交搜索条件后重载表格 @@ -154,6 +155,9 @@ case 'status':// 状态 cjgl.status(obj,"{:url('setstatus')}"); break; + case 'reset':// 编辑 + cjgl.resetpassword(obj.data.xingming,"/student/index/resetpassword/"+obj.data.id); + break; }; }); diff --git a/app/teacher/controller/Index.php b/app/teacher/controller/Index.php index 5827208d..6100a0f4 100644 --- a/app/teacher/controller/Index.php +++ b/app/teacher/controller/Index.php @@ -509,5 +509,23 @@ class Index extends AdminBase } + // 重置密码 + public function resetpassword($id) + { + // 生成密码 + $md5 = new \WhiteHat101\Crypt\APR1_MD5; + $password = $md5->hash('123456'); + + // 查询用户信息 + $data = TC::where('id', $id)->update(['password' => $password]); + // 根据更新结果设置返回提示信息 + $data ? $data = ['msg' => '密码已经重置为:
123456', 'val' => 1] + : $data = ['msg' => '数据处理错误', 'val' => 0]; + + // 返回信息 + return json($data); + } + + } diff --git a/app/teacher/route/teacher.php b/app/teacher/route/teacher.php index 6ea6d69e..9ad98b0b 100644 --- a/app/teacher/route/teacher.php +++ b/app/teacher/route/teacher.php @@ -31,4 +31,5 @@ Route::group('index', function () { Route::rule('dellist','Index/delList','get'); # 信息列表 Route::rule('datadel','Index/ajaxDataDel','post'); # 获取数据 Route::rule('redel/','Index/reDel','delete'); # 获取学生成绩 -}); \ No newline at end of file + Route::rule('resetpassword/','Index/resetpassword','post'); # 重置教师密码 +}); diff --git a/app/teacher/view/index/index.html b/app/teacher/view/index/index.html index 8b5970de..f402c904 100644 --- a/app/teacher/view/index/index.html +++ b/app/teacher/view/index/index.html @@ -93,6 +93,7 @@ @@ -169,6 +170,9 @@ case 'edit':// 编辑 cjgl.add('编辑教师','/teacher/index/edit/'+obj.data.id,'','',true); break; + case 'reset':// 编辑 + cjgl.resetpassword(obj.data.xingming,"/teacher/index/resetpassword/"+obj.data.id); + break; }; }); }); diff --git a/database/migrations/20181028023517_teacher.php b/database/migrations/20181028023517_teacher.php index 8eccd071..d296b568 100644 --- a/database/migrations/20181028023517_teacher.php +++ b/database/migrations/20181028023517_teacher.php @@ -47,7 +47,7 @@ class Teacher extends Migrator ->addColumn('quanpin','string',['limit'=>30,'default'=>'a','null'=>false,'comment'=>'全拼']) ->addColumn('shoupin','string',['limit'=>5,'default'=>'a','null'=>false,'comment'=>'简拼']) ->addColumn('tuixiu','boolean',['limit'=>1,'default'=>0,'null'=>false,'comment'=>'是否已经退休']) - ->addColumn('phone','string',['limit'=>11,'null'=>true,'comment'=>'手机号']) + ->addColumn('phone','string',['limit'=>11,'default'=>0,'null'=>false,'comment'=>'手机号']) ->addColumn('status','boolean',['limit'=>1,'default'=>true,'null'=>false,'comment'=>'状态']) ->addColumn('password','string',['limit'=>137,'null'=>false,'default'=>'$apr1$RSUodBwI$zOhVq9RQWfQDOW2sbeCDS1','comment'=>'登录密码']) ->addColumn('denglucishu','integer',['limit'=>5,'default'=>0,'null'=>false,'comment'=>'登录次数']) diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index fbf14faa..3e27e8b9 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -29,55 +29,55 @@ class Rule extends Seeder ], ['id' => 101 ,'title' => '扫码录入' - ,'name' => 'chengji/luru/malu' + ,'name' => 'luru/index/malu' ,'paixu' => 1 ,'ismenu' => 1 ,'pid' => 1 - ,'url' => '/chengji/luru/malu' + ,'url' => '/luru/index/malu' ], ['id' => 10101 ,'title' => '扫码查询' - ,'name' => 'chengji/Luru/read' + ,'name' => '/luru/index/read' ,'paixu' => 1 ,'pid' => 101 ] ,['id' => 10102 ,'title' => '扫码保存' - ,'name' => 'chengji/luru/malusave' + ,'name' => '/luru/index/malusave' ,'paixu' => 2 ,'pid' => 101 ], ['id' => 102 ,'title' => '表格录入' - ,'name' => 'chengji/luru/biaolu' + ,'name' => '/luru/index/biaolu' ,'paixu' => 2 ,'ismenu' => 1 ,'pid' => 1 - ,'url' => '/chengji/luru/biaolu' + ,'url' => '/luru/index/biaolu' ], ['id' => 10201 ,'title' => '表格保存' - ,'name' => 'chengji/luru/saveall' + ,'name' => '/luru/index/saveall' ,'paixu' => 1 ,'pid' => 102 ], ['id' => 10202 ,'title' => '表格上传' - ,'name' => 'chengji/luru/upload' + ,'name' => '/luru/index/upload' ,'paixu' => 2 ,'pid' => 102 ], ['id' => 103 ,'title' => '已录列表' - ,'name' => 'chengji/luru/index' + ,'name' => '/luru/index/index' ,'paixu' => 2 ,'ismenu' => 1 ,'pid' => 1 - ,'url' => '/chengji/luru/index' + ,'url' => '/luru/index/index' ], ['id' => 10301 ,'title' => '成绩更新' - ,'name' => 'chengji/luru/update' + ,'name' => '/luru/index/update' ,'paixu' => 1 ,'pid' => 103 ], @@ -607,6 +607,12 @@ class Rule extends Seeder ,'name' => 'student/chengji/index' ,'paixu' => 14 ,'pid' => 401 + ], + ['id' => 40115 + ,'title' => '重置密码' + ,'name' => 'student/index/resetpassword' + ,'paixu' => 15 + ,'pid' => 401 ], // 师生名单 ['id' => 402 @@ -1599,6 +1605,12 @@ class Rule extends Seeder ,'paixu' => 11 ,'pid' => 1001 ], + ['id' => 100112 + ,'title' => '重置密码' + ,'name' => 'teacher/index/resetpassword' + ,'paixu' => 7 + ,'pid' => 1001 + ], ['id' => 1002 ,'title' => '删除教师' ,'name' => 'teacher/index/dellist' diff --git a/database/seeds/SystemBase.php b/database/seeds/SystemBase.php index a5e35113..eec45264 100644 --- a/database/seeds/SystemBase.php +++ b/database/seeds/SystemBase.php @@ -22,7 +22,7 @@ class SystemBase extends Seeder 'description' => '前端采用X-admin,后端采用Thinkphp。寻找最方便的录入成绩方法,提供最丰富的统计项目。', 'thinks' => 'ThinkPHP,X-admin,百度Echarts,jquwery', 'danwei' => '大连长岛经济区', - 'grademax' => 6, + 'gradelist' => '一年级|二年级|三年级|四年级|五年级|六年级', 'classmax' => 30, 'classalias' => 0 ];