Merge branch 'master' into auth

This commit is contained in:
巴掌 committed 2021-01-17 09:20:55 +08:00
commit 02f27c34b7
4 files changed
+83

No files matched your search

+26
View File
@@ -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);
}
}
+1
View File
@@ -14,6 +14,7 @@ use think\facade\Route;
Route::group('/', function () {
Route::rule('', 'SystemBase/edit', 'get'); # 系统配置页面
Route::rule('update/<id>', 'SystemBase/update', 'put'); # 配置更新
Route::rule('reset', 'SystemBase/resetMayi', 'post'); # 配置更新
});
// 文件管理
@@ -0,0 +1,49 @@
<?php
use think\migration\Migrator;
use think\migration\db\Column;
class RuleAddsystemreset extends Migrator
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function up()
{
$singleRow = [
['id' => 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');
}
}
Loaded 3 of 4 files, more files were not shown because too many files have changed in this diff. Show more