diff --git a/app/Update/common.php b/app/Update/common.php new file mode 100644 index 00000000..95f24abd --- /dev/null +++ b/app/Update/common.php @@ -0,0 +1,43 @@ +where('id', $old_id)->value('title'); + $new_id = $new->where('title', $title)->value('id'); + + $new_id > 0 ? $new_id : $new_id = 0; + + return $new_id; +} + + +// Subject +function getNewSubject($old_id) +{ + $new = new \app\update\model\Subject; + $old = new \app\teach\model\Subject; + + $title = $old->where('id', $old_id)->value('title'); + $new_id = $new->where('title', $title)->value('id'); + + return $new_id; +} + + +// 鉴定等级 +function getNewDengji($dengji) +{ + $dj = [ + 0 => 11801 + ,1 => 11802 + ,2 => 11803 + ,3 => 11804 + ]; + return $dj[$dengji]; +} + diff --git a/app/Update/controller/Admin.php b/app/Update/controller/Admin.php new file mode 100644 index 00000000..84e841cd --- /dev/null +++ b/app/Update/controller/Admin.php @@ -0,0 +1,565 @@ +select()->toArray(); + $oldId = $old->column('id'); + $new->where('id', '>', 0)->delete(); + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $old->find($value)->getData(); + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + dump('Admin : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Admin : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // Banji + public function banji() + { + $new = new \app\update\model\Banji; + $old = new \app\teach\model\Banji; + + // 整理数据 + // $oldId = $old->select()->toArray(); + $oldId = $old->column('id'); + $new->where('id', '>', 0)->delete(); + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $old->find($value)->getData(); + $oldList['school_id'] = $oldList['school']; + $oldList['xueduan_id'] = 10302; + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + dump('Banji : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Banji : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // Chengji + public function chengji() + { + set_time_limit(0); + $new = new \app\update\model\Chengji; + $old = new \app\chengji\model\Chengji; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + unset($oldList['id']); + $oldList['defenlv'] = $oldList['defen']; + $newList[] = $oldList; + } + + $newList = $new->saveAll($newList); + $i = $newList->count(); + + dump('Chengji : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Chengji : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // DwRongyu + public function dwrongyu() + { + $new = new \app\update\model\DwRongyu; + $old = new \app\rongyu\model\DwRongyu; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['hjschool_id'] = $oldList['hjschool']; + $oldList['fzschool_id'] = $oldList['fzschool']; + $oldList['jiangxiang_id'] = getNewCategory($oldList['jiangxiang']); + $oldList['category_id'] = getNewCategory($oldList['category']); + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('DwRongyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'DwRongyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // DwRongyu + public function dwrongyucanyu() + { + $new = new \app\update\model\DwRongyuCanyu; + $old = new \app\rongyu\model\DwRongyuCanyu; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + unset($oldList['id']); + unset($oldList['update_time']); + unset($oldList['create_time']); + unset($oldList['delete_time']); + $oldList['rongyu_id'] = $oldList['rongyuid']; + $oldList['teacher_id'] = $oldList['teacherid']; + $newList[] = $oldList; + } + + $newList = $new->saveAll($newList); + $i = $newList->count(); + + dump('DwRongyuCanyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'DwRongyuCanyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // DwRongyu + public function fields() + { + $new = new \app\update\model\Fields; + $old = new \app\system\model\Fields; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + unset($oldList['id']); + $oldList['user_id'] = $oldList['userid']; + $newList[] = $oldList; + } + + $newList = $new->saveAll($newList); + $i = $newList->count(); + + dump('Fields : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Fields : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // JsRongyu + public function jsrongyu() + { + $new = new \app\update\model\JsRongyu; + $old = new \app\rongyu\model\JsRongyu; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['fzschool_id'] = $oldList['fzschool']; + $oldList['category_id'] = $oldList['category']; + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('JsRongyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'JsRongyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // JsRongyuCanyu + public function jsrongyucanyu() + { + $new = new \app\update\model\JsRongyuCanyu; + $old = new \app\rongyu\model\JsRongyuCanyu; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + unset($oldList['id']); + unset($oldList['update_time']); + unset($oldList['create_time']); + unset($oldList['delete_time']); + $oldList['category_id'] = $oldList['category']; + $oldList['rongyu_id'] = $oldList['rongyuid']; + $oldList['teacher_id'] = $oldList['teacherid']; + $newList[] = $oldList; + } + + $newList = $new->saveAll($newList); + $i = $newList->count(); + + dump('JsRongyuCanyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'JsRongyuCanyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // JsRongyuInfo + public function jsrongyuinfo() + { + $new = new \app\update\model\JsRongyuInfo; + $old = new \app\rongyu\model\JsRongyuInfo; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['rongyuce_id'] = $oldList['rongyuce']; + $oldList['hjschool_id'] = $oldList['hjschool']; + $oldList['subject_id'] = getNewSubject($oldList['subject']); + $oldList['jiangxiang_id'] = getNewCategory($oldList['jiangxiang']); + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('JsRongyuInfo : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'JsRongyuInfo : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // Kaohao + public function kaohao() + { + set_time_limit(0); + $new = new \app\update\model\Kaohao; + $old = new \app\kaohao\model\Kaohao; + + // 整理数据 + $oldId = $old + // ->limit(10) + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['kaoshi_id'] = $oldList['kaoshi']; + $oldList['school_id'] = $oldList['school']; + $oldList['banji_id'] = $oldList['banji']; + $oldList['student_id'] = $oldList['student']; + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('Kaohao : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Kaohao : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // Kaoshi + public function kaoshi() + { + $new = new \app\update\model\Kaoshi; + $old = new \app\Kaoshi\model\Kaoshi; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['zuzhi_id'] = $oldList['zuzhi']; + $oldList['xueqi_id'] = $oldList['xueqi']; + $oldList['category_id'] = $oldList['category']; + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('Kaoshi : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Kaoshi : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + + // Keti + public function Keti() + { + $new = new \app\update\model\Keti; + $old = new \app\Keti\model\Keti; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['lxdanwei_id'] = $oldList['lxdanweiid']; + $oldList['category_id'] = $oldList['category']; + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('Keti : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Keti : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // KetiCanyu + public function keticanyu() + { + $new = new \app\update\model\KetiCanyu; + $old = new \app\Keti\model\KetiCanyu; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + unset($oldList['id']); + unset($oldList['update_time']); + unset($oldList['create_time']); + unset($oldList['delete_time']); + $oldList['ketiinfo_id'] = $oldList['ketiinfoid']; + $oldList['teacher_id'] = $oldList['teacherid']; + $oldList['category_id'] = $oldList['category']; + $newList[] = $oldList; + } + + $newList = $new->saveAll($newList); + $i = $newList->count(); + + dump('KetiCanyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'KetiCanyu : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // KetiInfo + public function KetiINfo() + { + set_time_limit(0); + $new = new \app\update\model\KetiInfo; + $old = new \app\Keti\model\KetiInfo; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['ketice_id'] = $oldList['ketice']; + $oldList['subject_id'] = getNewSubject($oldList['subject']); + $oldList['fzdanwei_id'] = getNewCategory($oldList['fzdanweiid']); + $oldList['jddengji_id'] = getNewDengji($oldList['jddengji']); + $oldList['category_id'] = getNewCategory($oldList['category']); + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('KetiInfo : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'KetiInfo : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // School + public function school() + { + $new = new \app\update\model\School; + $old = new \app\system\model\School; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['xingzhi_id'] = getNewCategory($oldList['xingzhi']); + $oldList['jibie_id'] = getNewCategory($oldList['jibie']); + $oldList['xueduan_id'] = getNewCategory($oldList['xueduan']); + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('School : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'School : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + // Student + public function Student() + { + set_time_limit(0); + $new = new \app\update\model\Student; + $old = new \app\renshi\model\Student; + $pinyin = new \Overtrue\Pinyin\Pinyin; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['banji_id'] = $oldList['banji']; + $quanpin = $pinyin->sentence( $oldList['xingming']); + $oldList['shoupin'] = $pinyin->abbr( $oldList['xingming']); + $oldList['quanpin'] = trim(strtolower(str_replace(' ', '', $quanpin))); + + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('Student : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Student : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // Teacher + public function Teacher() + { + set_time_limit(0); + $new = new \app\update\model\Teacher; + $old = new \app\renshi\model\Teacher; + $pinyin = new \Overtrue\Pinyin\Pinyin; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['zhiwu_id'] = $oldList['zhiwu']; + $oldList['zhicheng_id'] = $oldList['zhicheng']; + $oldList['danwei_id'] = $oldList['danwei']; + $oldList['xueli_id'] = $oldList['xueli']; + $oldList['subject_id'] = $oldList['subject']; + $quanpin = $pinyin->sentence( $oldList['xingming']); + $oldList['shoupin'] = $pinyin->abbr( $oldList['xingming']); + $oldList['quanpin'] = trim(strtolower(str_replace(' ', '', $quanpin))); + + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('Teacher : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Teacher : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + + // Xueqi + public function xueqi() + { + $new = new \app\update\model\Xueqi; + $old = new \app\teach\model\Xueqi; + + // 整理数据 + $oldId = $old + ->select(); + + $new->where('id', '>', 0)->delete(); + + $i = 0; + foreach ($oldId as $key => $value) { + $oldList = $value->getData(); + $oldList['category_id'] = $oldList['category']; + + $newList = $new->create($oldList); + if ($newList) { + $i ++; + } + } + + dump('Xueqi : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'); + return 'Xueqi : 共' . count($oldId) . '条记录。创建' . $i . '条记录。'; + } + + +} diff --git a/app/Update/event.php b/app/Update/event.php new file mode 100644 index 00000000..4eff8908 --- /dev/null +++ b/app/Update/event.php @@ -0,0 +1,5 @@ + +// +---------------------------------------------------------------------- +use think\facade\Route; + + +// 学期管理 +Route::group('admin', function () { + Route::rule('index','admin/index','get'); # 信息列表 + Route::rule('admin','admin/admin','get'); # 信息列表 + Route::rule('banji','admin/banji','get'); # 信息列表 + Route::rule('chengji','admin/chengji','get'); # 信息列表 + Route::rule('dwrongyu','admin/dwrongyu','get'); # 信息列表 + Route::rule('dwrongyucanyu','admin/dwrongyucanyu','get'); # 信息列表 + Route::rule('fields','admin/fields','get'); # 信息列表 + Route::rule('jsrongyu','admin/jsrongyu','get'); # 信息列表 + Route::rule('jsrongyucanyu','admin/jsrongyucanyu','get'); # 信息列表 + Route::rule('jsrongyuinfo','admin/jsrongyuinfo','get'); # 信息列表 + Route::rule('kaohao','admin/kaohao','get'); # 信息列表 + Route::rule('kaoshi','admin/kaoshi','get'); # 信息列表 + Route::rule('keti','admin/keti','get'); # 信息列表 + Route::rule('keticanyu','admin/keticanyu','get'); # 信息列表 + Route::rule('ketiinfo','admin/ketiinfo','get'); # 信息列表 + Route::rule('school','admin/school','get'); # 信息列表 + Route::rule('student','admin/student','get'); # 信息列表 + Route::rule('teacher','admin/teacher','get'); # 信息列表 + Route::rule('xueqi','admin/xueqi','get'); # 信息列表 + }); + diff --git a/app/Update/view/admin/index.html b/app/Update/view/admin/index.html new file mode 100644 index 00000000..26e52225 --- /dev/null +++ b/app/Update/view/admin/index.html @@ -0,0 +1,210 @@ + +{extend name=".././view/list.html" /} +{block name="jsset"} + +{/block} +{block name="nav"} + + 系统管理 + 文件管理 + 文件列表 + +{/block} +{block name="search"} +
+ +
+ +
+
+{/block} +{block name="table"} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
数据库
+ +
+ Admin +
+
+
+ +
+ Banji +
+
+
+ +
+ Chengji +
+
+
+ +
+ DwRongyu +
+
+
+ +
+ DwRongyuCanyu +
+
+
+ +
+ Fields +
+
+
+ +
+ JsRongyu +
+
+
+ +
+ jsrongyucanyu +
+
+
+ +
+ jsrongyuinfo +
+
+
+ +
+ kaohao +
+
+
+ +
+ kaoshi +
+
+
+ +
+ keti +
+
+
+ +
+ keticanyu +
+
+
+ +
+ ketiinfo +
+
+
+ +
+ school +
+
+
+ +
+ student +
+
+
+ +
+ teacher +
+
+
+ +
+ xueqi +
+
+
+ +{/block} +{block name="myjs"} + +{/block} diff --git a/app/system/controller/Category.php b/app/system/controller/Category.php index 022bafb0..b2aff0f8 100644 --- a/app/system/controller/Category.php +++ b/app/system/controller/Category.php @@ -50,6 +50,7 @@ class Category extends BaseController ,'paixu' ,'glPid' => ['title'] ,'isupdate' + ,'flCategory' => ['id','title'] ,'status' ,'update_time' ]); diff --git a/app/system/model/Fields.php b/app/system/model/Fields.php index 97c3f0a4..e34bd37a 100644 --- a/app/system/model/Fields.php +++ b/app/system/model/Fields.php @@ -60,12 +60,14 @@ class Fields extends BaseModel return $data; } + // 上传人数据关联 public function flUser() { return $this->belongsTo('\app\admin\model\Admin', 'user_id', 'id'); } + // 文件种类数模型关联 public function flCategory() {