From c88b233adc2994b4ce23999e64f7860973269944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Wed, 13 Jan 2021 15:42:28 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E5=AD=A6=E7=94=9F=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/student/model/Student.php | 8 +++++--- app/teach/model/Banji.php | 8 +++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/student/model/Student.php b/app/student/model/Student.php index da085b3f..a7ee0d3a 100755 --- a/app/student/model/Student.php +++ b/app/student/model/Student.php @@ -216,7 +216,7 @@ class Student extends BaseModel // 获取电子表格中身份证号 $xlsStuList = array_column($value, 2); $xlsStuList = array_map('strtoupper', $xlsStuList); # 将小写字母转换成大写字母 - $xlsStuList = array_map('trim', $xlsStuList); # 将大写字母转换成小写字母 + $xlsStuList = array_map('trim', $xlsStuList); # 过滤空格 // 获取数据库中身份证号 $serStulist = self::withTrashed() @@ -230,8 +230,10 @@ class Student extends BaseModel $add = array_diff($xlsStuList, $sfzh); $del = array_diff($sfzh, $xlsStuList); + + // 从新增的数据中查找是否有已经存在,但是班级不正确的信息。 - $add_temp = self::onlyTrashed() + $add_temp = self::withTrashed() ->where('shenfenzhenghao', 'in', $add) ->field('shenfenzhenghao') ->column('shenfenzhenghao', 'id'); @@ -259,7 +261,7 @@ class Student extends BaseModel $shoupin = $pinyin->abbr($value[$jj_k][1]); $oneStu->xingming = $value[$jj_k][1]; - $oneStu->banji = $key; + $oneStu->banji_id = $key; $oneStu->quanpin = trim(strtolower(str_replace(' ', '', $quanpin))); $oneStu->shoupin = trim(strtolower(str_replace(' ', '', $shoupin))); $oneStu->save(); diff --git a/app/teach/model/Banji.php b/app/teach/model/Banji.php index 9e4377b5..71b96a32 100755 --- a/app/teach/model/Banji.php +++ b/app/teach/model/Banji.php @@ -295,16 +295,14 @@ class Banji extends BaseModel break; } } + // 去掉年级,获取班级 + $str = str_replace($njlist[$nj], '', $str); // 获取班级 foreach ($bjlist as $key => $value) { - $bj = stripos($str, $value, 0); - $bjLen = strlen($value); - if(($bj + $bjLen) === $len) - { + if ($value === $str) { $bj = $key; break; } - } if($nj > 0 && $bj > 0) From c49be95b044cd8457b52ecfaec94c2d30c017286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Thu, 14 Jan 2021 19:46:03 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=80=83=E8=AF=95?= =?UTF-8?q?=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- database/migrations/20210107070200_kaoshi_up.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/database/migrations/20210107070200_kaoshi_up.php b/database/migrations/20210107070200_kaoshi_up.php index dcb5724c..6473ff4a 100644 --- a/database/migrations/20210107070200_kaoshi_up.php +++ b/database/migrations/20210107070200_kaoshi_up.php @@ -32,9 +32,9 @@ class KaoshiUp extends Migrator $table = $this->table('kaoshi'); $table - ->addColumn('user_id','integer',array('after' => 'category_id'),['limit'=>11,'default'=>0,'null'=>false,'comment'=>'用户ID']) - ->addColumn('user_group','string',array('after' => 'user_id'),['limit'=>25,'default'=>'a','null'=>false,'comment'=>'用户组']) - ->addColumn('jibie_id','integer',array('after' => 'user_group'),['limit'=>11,'default'=>1,'null'=>false,'comment'=>'级别ID']) + ->addColumn('user_id','integer',['after' => 'category_id','limit'=>11,'default'=>0,'null'=>false,'comment'=>'用户ID']) + ->addColumn('user_group','string',['after' => 'user_id','limit'=>25,'default'=>'a','null'=>false,'comment'=>'用户组']) + ->addColumn('jibie_id','integer',['after' => 'user_group','limit'=>11,'default'=>1,'null'=>false,'comment'=>'级别ID']) ->update(); } @@ -45,7 +45,9 @@ class KaoshiUp extends Migrator $table = $this->table('kaoshi'); $table - ->removeColumn('user_id', 'user_group', 'jibie_id') + ->removeColumn('jibie_id') + ->removeColumn('user_group') + ->removeColumn('jibie_id') ->update(); } } From dbf63e3c5c84a207bb6dede7787e76bd6c804061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Thu, 14 Jan 2021 20:18:39 +0800 Subject: [PATCH 3/6] 0 --- ...70200_kaoshi_up.php => 20210107070200_kaoshi_add_user.php} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename database/migrations/{20210107070200_kaoshi_up.php => 20210107070200_kaoshi_add_user.php} (95%) diff --git a/database/migrations/20210107070200_kaoshi_up.php b/database/migrations/20210107070200_kaoshi_add_user.php similarity index 95% rename from database/migrations/20210107070200_kaoshi_up.php rename to database/migrations/20210107070200_kaoshi_add_user.php index 6473ff4a..81a3d81b 100644 --- a/database/migrations/20210107070200_kaoshi_up.php +++ b/database/migrations/20210107070200_kaoshi_add_user.php @@ -3,7 +3,7 @@ use think\migration\Migrator; use think\migration\db\Column; -class KaoshiUp extends Migrator +class KaoshiAddUser extends Migrator { /** * Change Method. @@ -45,7 +45,7 @@ class KaoshiUp extends Migrator $table = $this->table('kaoshi'); $table - ->removeColumn('jibie_id') + ->removeColumn('user_id') ->removeColumn('user_group') ->removeColumn('jibie_id') ->update(); From dd9af7f47f610b58c33300cb1d43fd75cbcce97f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Fri, 15 Jan 2021 20:39:04 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=95=99=E5=B8=88=E9=94=99=E8=AF=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/luru/controller/Index.php | 10 +++++++++- app/teacher/controller/Index.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/luru/controller/Index.php b/app/luru/controller/Index.php index 00312c9f..f1b4d65d 100755 --- a/app/luru/controller/Index.php +++ b/app/luru/controller/Index.php @@ -523,7 +523,15 @@ class Index extends BaseController $sheet->setCellValue('A' . $i, $i - 3); $sheet->setCellValue('B' . $i, $md5::encrypt((string)$kh->id, 'dlbz')); $sheet->setCellValue('C' . $i, $bj->banjiTitle); - $sheet->setCellValue('D' . $i, $kh->cjStudent->xingming); + $sheet->setCellValue('D' . $i, $kh->cjStudent['xingming']); + // if(isset($kh->cjStudent->xingming)) + // { + // $sheet->setCellValue('D' . $i, $kh->cjStudent->xingming); + // }else{ + // halt($kh->toArray()); + // $sheet->setCellValue('D' . $i, '学生已经被删除'); + // } + $i ++; } } diff --git a/app/teacher/controller/Index.php b/app/teacher/controller/Index.php index 9517d469..ffe65b51 100755 --- a/app/teacher/controller/Index.php +++ b/app/teacher/controller/Index.php @@ -410,7 +410,7 @@ class Index extends AdminBase ], 'POST'); // 实例化操作表格类 - $teacherinfo = \app\facade\File::readXls(public_path() . 'uploads\\' . $list['url']); + $teacherinfo = \app\facade\File::readXls(public_path() . 'uploads/' . $list['url']); // 判断表格是否正确 if("教师基本情况表" != $teacherinfo[0][0] || '姓名*' != $teacherinfo[2][1] || '性别*' != $teacherinfo[2][2]) From 55b6ce35c1cf113fcb21de661c30918d0ec58813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Sun, 17 Jan 2021 09:20:41 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=BC=94=E7=A4=BA=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/system/controller/SystemBase.php | 26 ++++++++++ app/system/route/system.php | 1 + .../20210117005351_rule_addsystemreset.php | 49 +++++++++++++++++++ database/seeds/Rule.php | 7 +++ 4 files changed, 83 insertions(+) create mode 100644 database/migrations/20210117005351_rule_addsystemreset.php diff --git a/app/system/controller/SystemBase.php b/app/system/controller/SystemBase.php index 7066f32a..2ac80759 100755 --- a/app/system/controller/SystemBase.php +++ b/app/system/controller/SystemBase.php @@ -95,4 +95,30 @@ class SystemBase extends AdminBase return json($data); } + + // 系统初始化 + public function resetMayi() + { + // 删除班级 + $bjObj = new \app\teach\model\Banji; + $bjList = $bjObj->where('id', '>', 0)->select(); + $bj = $bjList->force()->delete(); + + // 删除学生信息 + $stuObj = new \app\student\model\Student; + $stuList = $stuObj->where('id', '>', 0)->select(); + $stu = $stuList->force()->delete(); + + // 删除教师信息 + $terObj = new \app\teacher\model\Teacher; + $terList = $terObj->where('id', '>', 0)->select(); + $ter = $terList->force()->delete(); + + $bj && $stu && $ter ? $data = ['msg' => '添加成功', 'val' => 1] + : $data = ['msg' => '数据处理错误', 'val' => 0]; + + // 返回信息 + return json($data); + } + } diff --git a/app/system/route/system.php b/app/system/route/system.php index 7d4de44a..b5706d24 100755 --- a/app/system/route/system.php +++ b/app/system/route/system.php @@ -14,6 +14,7 @@ use think\facade\Route; Route::group('/', function () { Route::rule('', 'SystemBase/edit', 'get'); # 系统配置页面 Route::rule('update/', 'SystemBase/update', 'put'); # 配置更新 + Route::rule('reset', 'SystemBase/resetMayi', 'post'); # 配置更新 }); // 文件管理 diff --git a/database/migrations/20210117005351_rule_addsystemreset.php b/database/migrations/20210117005351_rule_addsystemreset.php new file mode 100644 index 00000000..e91694ff --- /dev/null +++ b/database/migrations/20210117005351_rule_addsystemreset.php @@ -0,0 +1,49 @@ + 707 + ,'title' => '删除演示数据' + ,'name' => 'system/systembase/resetmayi' + ,'paixu' => 7 + ,'pid' => 7 + ,'ismenu' => 1 + ], + ]; + + // this is a handy shortcut + $this->insert('auth_rule', $singleRow); + } + + public function down() + { + $this->execute('DELETE FROM cj_auth_rule where id=707'); + } +} diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index 8b121a57..7e10c6ea 100755 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -1282,6 +1282,13 @@ class Rule extends Seeder ,'paixu' => 7 ,'pid' => 706 ], + ['id' => 707 + ,'title' => '删除演示数据' + ,'name' => 'system/systembase/resetmayi' + ,'paixu' => 7 + ,'pid' => 7 + ,'ismenu' => 1 + ], /*====================================================================== * 考试管理 From c7e73586a434044e537549630336073d940bff9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Sun, 17 Jan 2021 15:21:15 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/system/controller/SystemBase.php | 195 ++++++++++++++++-- app/system/view/system_base/edit.html | 33 ++- .../20210117005351_rule_addsystemreset.php | 9 +- database/seeds/Rule.php | 15 +- 4 files changed, 224 insertions(+), 28 deletions(-) diff --git a/app/system/controller/SystemBase.php b/app/system/controller/SystemBase.php index 2ac80759..2e8d4617 100755 --- a/app/system/controller/SystemBase.php +++ b/app/system/controller/SystemBase.php @@ -99,23 +99,190 @@ class SystemBase extends AdminBase // 系统初始化 public function resetMayi() { - // 删除班级 - $bjObj = new \app\teach\model\Banji; - $bjList = $bjObj->where('id', '>', 0)->select(); - $bj = $bjList->force()->delete(); - // 删除学生信息 - $stuObj = new \app\student\model\Student; - $stuList = $stuObj->where('id', '>', 0)->select(); - $stu = $stuList->force()->delete(); + $data = ['msg' => '初始化成功', 'val' => 1]; + try { + // 删除管理员 + $obj = new \app\admin\model\Admin; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 2); + }); - // 删除教师信息 - $terObj = new \app\teacher\model\Teacher; - $terList = $terObj->where('id', '>', 0)->select(); - $ter = $terList->force()->delete(); + // 删除用户组 + $obj = new \app\admin\model\AuthGroup; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 1); + }); - $bj && $stu && $ter ? $data = ['msg' => '添加成功', 'val' => 1] - : $data = ['msg' => '数据处理错误', 'val' => 0]; + // 删除用户与用户组对应 + $obj = new \app\admin\model\AuthGroupAccess; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除班主任 + $obj = new \app\teach\model\BanZhuRen; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除班级 + $obj = new \app\teach\model\Banji; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除成绩 + $obj = new \app\chengji\model\Chengji; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除单位荣誉 + $obj = new \app\rongyu\model\DwRongyu; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除单位荣誉参与 + $obj = new \app\rongyu\model\DwRongyuCanyu; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // // 删除分工 + // $obj = new \app\rongyu\model\FenGong; + // $list = $obj::destroy(function ($query) { + // $query->where('id', '>', 0); + // }); + // + // 删除文件 + $obj = new \app\system\model\Fields; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除教师荣誉 + $obj = new \app\rongyu\model\JsRongyu; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除教师荣誉参与 + $obj = new \app\rongyu\model\JsRongyuCanyu; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除教师荣誉信息 + $obj = new \app\rongyu\model\JsRongyuInfo; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除考号 + $obj = new \app\kaohao\model\Kaohao; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除考试 + $obj = new \app\kaoshi\model\Kaoshi; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除单位荣誉参与 + $obj = new \app\kaoshi\model\KaoshiSet; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除课程表 + // $obj = new \app\rongyu\model\DwRongyuCanyu; + // $list = $obj::destroy(function ($query) { + // $query->where('id', '>', 0); + // }); + // + // 删除课程表临时表 + // $obj = new \app\rongyu\model\DwRongyuCanyu; + // $list = $obj::destroy(function ($query) { + // $query->where('id', '>', 0); + // }); + // + // 删除课节 + // $obj = new \app\rongyu\model\DwRongyuCanyu; + // $list = $obj::destroy(function ($query) { + // $query->where('id', '>', 0); + // }); + // + // 删除课题删 + $obj = new \app\keti\model\Keti; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除课题参与 + $obj = new \app\keti\model\KetiCanyu; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除课题信息 + $obj = new \app\keti\model\ketiInfo; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除单位 + $obj = new \app\system\model\School; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除学生信息 + $obj = new \app\student\model\Student; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除教师信息 + $obj = new \app\teacher\model\Teacher; + $list = $obj::where('id', '>', 1)->delete(); + + // 删除班级成绩统计 + $obj = new \app\chengji\model\TongjiBj; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除统计记录 + $obj = new \app\kaoshi\model\TongjiLog; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除年级成绩统计 + $obj = new \app\chengji\model\TongjiNj; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除学校成绩统计 + $obj = new \app\chengji\model\TongjiSch; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 0); + }); + + // 删除学期 + $obj = new \app\teach\model\Xueqi; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 1); + }); + + } catch (ValidateException $e) { + $data = ['msg' => '初始化失败', 'val' => 0]; + } // 返回信息 return json($data); diff --git a/app/system/view/system_base/edit.html b/app/system/view/system_base/edit.html index c405d892..b30920a4 100755 --- a/app/system/view/system_base/edit.html +++ b/app/system/view/system_base/edit.html @@ -51,11 +51,11 @@
+ autocomplete="off" placeholder="各年级的最多班级数" class="layui-input" value="{$list.data.classmax|default=''}">
@@ -191,6 +191,15 @@ autocomplete="off" class="layui-input" value="{$list.data.danwei|default=''}">
+
+ +
+ + 初始化 +
+