diff --git a/application/chengji/controller/Index.php b/application/chengji/controller/Index.php index 3b00864b..951d912b 100644 --- a/application/chengji/controller/Index.php +++ b/application/chengji/controller/Index.php @@ -16,48 +16,5 @@ class Index extends Base return $this->fetch(); } - // 生成考号 - public function kaohao() - { - return $this->fetch(); - } - - // 保存考号 - public function kaohaosave() - { - // 获取表单数据 - $list = request()->only(['kaoshi','banjiids'],'post'); - // 获取参加考试班级 - $list['banjiids'] = implode(',',$list['banjiids']); - - // 获取参加考试学生名单 - $stulist = Student::where('status',1) - ->where('banji','in',$list['banjiids']) - ->field('id,school,banji') - ->append(['nianji']) - ->select(); - - // 组合参加考试学生信息 - $stus = array(); - foreach ($stulist as $key => $value) { - $stus[] = [ - 'kaoshi' => $list['kaoshi'], - 'school' => $value->school, - 'ruxuenian' => $value->nianji, - 'banji' => $value->banji, - 'student' => $value->id - ]; - } - - // 声明成绩数据模型类 - $cj = new Chengji(); - $data = $cj->saveAll($stus); - - - // 根据更新结果设置返回提示信息 - $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; - - // 返回信息 - return json($data); - } + } diff --git a/application/teach/controller/Kaoshi.php b/application/teach/controller/Kaoshi.php index c67ea2ae..4c5bb7ce 100644 --- a/application/teach/controller/Kaoshi.php +++ b/application/teach/controller/Kaoshi.php @@ -6,6 +6,10 @@ namespace app\teach\controller; use app\common\controller\Base; // 引用学期数据模型类 use app\teach\model\Kaoshi as KS; +// 引用学生类 +use app\renshi\model\Student; +// 引用成绩类 +use app\chengji\model\Chengji; class Kaoshi extends Base { @@ -298,4 +302,49 @@ class Kaoshi extends Base // 返回信息 return json($data); } + + // 生成考号 + public function kaohao() + { + return $this->fetch(); + } + + // 保存考号 + public function kaohaosave() + { + // 获取表单数据 + $list = request()->only(['kaoshi','banjiids'],'post'); + // 获取参加考试班级 + $list['banjiids'] = implode(',',$list['banjiids']); + + // 获取参加考试学生名单 + $stulist = Student::where('status',1) + ->where('banji','in',$list['banjiids']) + ->field('id,school,banji') + ->append(['nianji']) + ->select(); + + // 组合参加考试学生信息 + $stus = array(); + foreach ($stulist as $key => $value) { + $stus[] = [ + 'kaoshi' => $list['kaoshi'], + 'school' => $value->school, + 'ruxuenian' => $value->nianji, + 'banji' => $value->banji, + 'student' => $value->id + ]; + } + + // 声明成绩数据模型类 + $cj = new Chengji(); + $data = $cj->saveAll($stus); + + + // 根据更新结果设置返回提示信息 + $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0]; + + // 返回信息 + return json($data); + } } diff --git a/application/teach/view/kaoshi/index.html b/application/teach/view/kaoshi/index.html index 7b9a40cf..22590634 100644 --- a/application/teach/view/kaoshi/index.html +++ b/application/teach/view/kaoshi/index.html @@ -96,12 +96,15 @@ startbut = ''; // 编辑按钮 editbut = ''; + // 生成考号 + kaohaobut = ''; + // 删除按钮 delbut = ''; if(row.status == '已停用') { - buts = startbut + editbut + delbut; + buts = startbut + editbut + kaohaobut + delbut; }else{ - buts = stopbut + editbut + delbut; + buts = stopbut + editbut + kaohaobut + delbut; } return buts; diff --git a/application/chengji/view/index/kaohao.html b/application/teach/view/kaoshi/kaohao.html similarity index 97% rename from application/chengji/view/index/kaohao.html rename to application/teach/view/kaoshi/kaohao.html index 16a15f48..8211f46c 100644 --- a/application/chengji/view/index/kaohao.html +++ b/application/teach/view/kaoshi/kaohao.html @@ -1,6 +1,6 @@ {extend name="common@create" /} {block name="formaa"} -
+
diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index 9147202b..1647679c 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -42,7 +42,6 @@ class Rule extends Seeder // 成绩采集 ['id'=>51,'title'=>'扫码录入','name'=>'chengji/Index/malu','paixu'=>1,'ismenu' =>true,'pid' =>5,'url'=>'/chengji',], ['id'=>52,'title'=>'表格录入','name'=>'chengji/Student/biaolu','paixu'=>2,'ismenu' =>true,'pid' =>5,'url'=>'/chengji',], - ['id'=>53,'title'=>'生成考号','name'=>'chengji/Index/kaohao','paixu'=>3,'ismenu' =>true,'pid' =>5,'url'=>'/chengji/kaohao',], // 教务管理 diff --git a/route/chengji.php b/route/chengji.php index 409960f5..c7045064 100644 --- a/route/chengji.php +++ b/route/chengji.php @@ -11,8 +11,7 @@ //系统设置路由 Route::get('chengji/erweima','chengji/Index/erweima'); -Route::get('chengji/kaohao','chengji/Index/kaohao'); -Route::post('chengji/kaohao','chengji/Index/kaohaosave'); + diff --git a/route/teach.php b/route/teach.php index c29056e4..5ac5ab63 100644 --- a/route/teach.php +++ b/route/teach.php @@ -17,6 +17,8 @@ Route::resource('banji','teach/Banji'); Route::post('banji/:id/yidong','teach/Banji/yidong'); // 定义班级移动post规则 Route::post('banji/mybanji','teach/Banji/mybanji'); // 定义GET请求路由规则 Route::post('banji/banjilist','teach/Banji/banjilist'); // 定义GET请求路由规则 +Route::get('kaoshi/kaohao','teach/Kaoshi/kaohao'); +Route::post('kaoshi/kaohao','teach/Kaoshi/kaohaosave');