From 2bb8f5611e9732aaac1f3c6e11db70226aaf77ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Fri, 7 Apr 2023 16:20:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8F=AD=E7=BA=A7=E8=B6=85?= =?UTF-8?q?=E8=BF=8710=E4=B8=AA=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/kaoshi/controller/KaoshiSet.php | 1 + app/kaoshi/controller/KsCanyu.php | 3 ++- app/kaoshi/controller/LuruFengong.php | 1 + app/kaoshi/model/LuruFengong.php | 1 + app/kaoshi/view/kaoshi_set/create.html | 3 ++- app/teach/controller/Subject.php | 2 +- app/teach/model/Subject.php | 14 ++++++++------ public/.example.Apache.htaccess | 8 ++++++++ public/.example.nginx.htaccess | 6 ++++++ public/.htaccess | 0 public/nginx.htaccess | 8 -------- 11 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 public/.example.Apache.htaccess create mode 100644 public/.example.nginx.htaccess delete mode 100755 public/.htaccess delete mode 100755 public/nginx.htaccess diff --git a/app/kaoshi/controller/KaoshiSet.php b/app/kaoshi/controller/KaoshiSet.php index 9047653d..49368c97 100755 --- a/app/kaoshi/controller/KaoshiSet.php +++ b/app/kaoshi/controller/KaoshiSet.php @@ -86,6 +86,7 @@ class KaoshiSet extends AdminBase ,'formpost' => 'POST' ,'url' => '/kaoshi/kaoshiset/save' ,'kaoshi_id' => $kaoshi_id + ,'all' => true ); // 获取考试时间 diff --git a/app/kaoshi/controller/KsCanyu.php b/app/kaoshi/controller/KsCanyu.php index b7f58fee..8a504731 100644 --- a/app/kaoshi/controller/KsCanyu.php +++ b/app/kaoshi/controller/KsCanyu.php @@ -70,6 +70,7 @@ class KsCanYu extends AdminBase ], 'POST'); $khSrc = new \app\kaohao\model\SearchCanYu; + $src['all'] = true; $bj = $khSrc->class($src); $src['all'] = true; $cnt = count($khSrc->class($src)); @@ -118,8 +119,8 @@ class KsCanYu extends AdminBase ], 'POST'); $ksset = new \app\kaoshi\model\KaoshiSet; - $sbj = $ksset->srcSubject($src); $src['all'] = true; + $sbj = $ksset->srcSubject($src); $cnt = count($ksset->srcSubject($src)); $data = reset_data($sbj, $cnt); diff --git a/app/kaoshi/controller/LuruFengong.php b/app/kaoshi/controller/LuruFengong.php index f7d7e33b..7b35ec89 100644 --- a/app/kaoshi/controller/LuruFengong.php +++ b/app/kaoshi/controller/LuruFengong.php @@ -220,6 +220,7 @@ class LuruFengong extends AdminBase ,'ruxuenian' => '' ,'kaoshi_id' => '' ,'limit' => 100 + ,'all' => true ], 'POST'); $lrfg = new \app\kaoshi\model\LuruFengong; $bj = $lrfg->srcMyLuruBanji($src); diff --git a/app/kaoshi/model/LuruFengong.php b/app/kaoshi/model/LuruFengong.php index a36df9c8..016aac75 100644 --- a/app/kaoshi/model/LuruFengong.php +++ b/app/kaoshi/model/LuruFengong.php @@ -156,6 +156,7 @@ class LuruFengong extends BaseModel 'kaoshi_id' => '' ,'school_id' => '' ,'ruxuenian' => '' + ,'all' => false ]; $src = array_cover($srcfrom, $src); $list = $this->srcMyLuruBase($src); diff --git a/app/kaoshi/view/kaoshi_set/create.html b/app/kaoshi/view/kaoshi_set/create.html index 7cbc7d30..d293c120 100755 --- a/app/kaoshi/view/kaoshi_set/create.html +++ b/app/kaoshi/view/kaoshi_set/create.html @@ -16,7 +16,8 @@ $sbj = new \app\teach\model\Subject; $src = [ 'status' => 1, - 'kaoshi' => 1 + 'kaoshi' => 1, + 'all' => true ]; $subject = $sbj->search($src); {/php} diff --git a/app/teach/controller/Subject.php b/app/teach/controller/Subject.php index 9265668a..c06f911d 100755 --- a/app/teach/controller/Subject.php +++ b/app/teach/controller/Subject.php @@ -263,7 +263,7 @@ class Subject extends AdminBase public function srcLieming() { // 获取参数 - $srcfrom = $this->request + $src = $this->request ->only([ 'searchval' => '' ,'id' diff --git a/app/teach/model/Subject.php b/app/teach/model/Subject.php index 5022a561..6dc79089 100755 --- a/app/teach/model/Subject.php +++ b/app/teach/model/Subject.php @@ -74,19 +74,21 @@ class Subject extends BaseModel ]; $src = array_cover($srcfrom, $src); - $list = $this::withTrashed() + $cnt = $this::withTrashed() ->where('lieming', $src['searchval']) - ->find(); + ->when($src['id'] > 0, function ($query) use($src) { + $query->where('id', '<>', $src['id']); + }) + ->count(); $data = ['msg' => '列标识已经存在!', 'val' => 0]; - if($list) + if($cnt > 0) { - if($src['id'] == $list->id){ - $data = ['msg' => '', 'val' => 1]; - } + $data = ['msg' => '列标识已经存在!', 'val' => 0]; }else{ $data = ['msg' => '', 'val' => 1]; } + return $data; } diff --git a/public/.example.Apache.htaccess b/public/.example.Apache.htaccess new file mode 100644 index 00000000..5971402c --- /dev/null +++ b/public/.example.Apache.htaccess @@ -0,0 +1,8 @@ + + Options +FollowSymlinks -Multiviews + RewriteEngine on + + RewriteCond %{REQUEST_FILENAME} !-d + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L] + \ No newline at end of file diff --git a/public/.example.nginx.htaccess b/public/.example.nginx.htaccess new file mode 100644 index 00000000..54ff4149 --- /dev/null +++ b/public/.example.nginx.htaccess @@ -0,0 +1,6 @@ +location / { + if (!-e $request_filename) { + rewrite ^(.*)$ /index.php?s=$1 last; + break; + } +} \ No newline at end of file diff --git a/public/.htaccess b/public/.htaccess deleted file mode 100755 index e69de29b..00000000 diff --git a/public/nginx.htaccess b/public/nginx.htaccess deleted file mode 100755 index 57defd49..00000000 --- a/public/nginx.htaccess +++ /dev/null @@ -1,8 +0,0 @@ -location / { - index index.html index.htm index.php; - #autoindex on; - if (!-e $request_filename) { - rewrite ^(.*)$ /index.php?s=/$1 last; - break; - } -} \ No newline at end of file