From 3b8e2efed5b14e5c3eba9ea74bd551b80cfe185b Mon Sep 17 00:00:00 2001 From: win7 Date: Fri, 27 Dec 2019 15:36:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E9=AA=8C=E8=AF=81=E3=80=81=E7=8F=AD=E7=BA=A7=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common.php | 13 ++++++++++++- database/seeds/Rule.php | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) 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],