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/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/system/controller/SystemBase.php b/app/system/controller/SystemBase.php index 7066f32a..2e8d4617 100755 --- a/app/system/controller/SystemBase.php +++ b/app/system/controller/SystemBase.php @@ -95,4 +95,197 @@ class SystemBase extends AdminBase return json($data); } + + // 系统初始化 + public function resetMayi() + { + + $data = ['msg' => '初始化成功', 'val' => 1]; + try { + // 删除管理员 + $obj = new \app\admin\model\Admin; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 2); + }); + + // 删除用户组 + $obj = new \app\admin\model\AuthGroup; + $list = $obj::destroy(function ($query) { + $query->where('id', '>', 1); + }); + + // 删除用户与用户组对应 + $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/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/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=''}">
+
+ +
+ + 初始化 +
+