diff --git a/app/common.php b/app/common.php index bf8a6fc7..27954193 100644 --- a/app/common.php +++ b/app/common.php @@ -235,6 +235,17 @@ function teacherNames($list = array()) */ function saveFileInfo($file,$list,$isSave=false) { + $hash = $file->hash('sha1'); + $f = new \app\system\model\Fields; + $serFile = $f::where('hash',$hash)->find(); + if($serFile) + { + $data['msg'] = '文件已经存在'; + $data['val'] = true; + $data['url'] = $serFile->url; + return $data; + } + // 上传文件到本地服务器 $savename = \think\facade\Filesystem::disk('public')->putFile($list['serurl'], $file); // 重新组合文件路径 @@ -250,7 +261,7 @@ function teacherNames($list = array()) $list['category'] = $list['category']; $list['bianjitime'] = $file->getMTime(); $list['extension'] = $file->getOriginalExtension(); - $f = new \app\system\model\Fields; + $saveinfo = $f::create($list); } diff --git a/database/seeds/Rule.php b/database/seeds/Rule.php index 2b069195..545990d1 100644 --- a/database/seeds/Rule.php +++ b/database/seeds/Rule.php @@ -159,7 +159,8 @@ class Rule extends Seeder ['title'=>'添加','name'=>'teach/Banji/create','paixu' =>1,'pid'=>502], ['title'=>'保存','name'=>'teach/Banji/save','paixu' =>2,'pid'=>502], ['title'=>'移动','name'=>'teach/Banji/yidong','paixu'=>3,'pid'=>502], - ['title'=>'状态','name'=>'teach/Banji/setStatus','paixu'=>4,'pid'=>502], + ['title'=>'删除','name'=>'teach/Banji/delete','paixu'=>4,'pid'=>502], + ['title'=>'状态','name'=>'teach/Banji/setStatus','paixu'=>5,'pid'=>502], // 学科列表权限 ['title'=>'添加','name'=>'teach/Subject/create','paixu' =>1,'pid'=>503], ['title'=>'保存','name'=>'teach/Subject/save','paixu' =>2,'pid'=>503],