增加系统初始化
This commit is contained in:
1 parent
02f27c34b7
commit
c7e73586a4
4 files changed
+224
-28
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user