Quellcode durchsuchen

bug处理第一阶段再优化

wufeng vor 2 Jahren
Ursprung
Commit
399877fe8f
2 geänderte Dateien mit 4 neuen und 4 gelöschten Zeilen
  1. 2 2
      app/admin/controller/Specs.php
  2. 2 2
      app/admin/controller/Unit.php

+ 2 - 2
app/admin/controller/Specs.php

@@ -38,7 +38,7 @@ class Specs extends Base
             ->field('id')
             ->where(['is_del'=>0,'spec_name'=>$spec_name])
             ->findOrEmpty();
-        if(!$tmp) return json_show(1004,'该规格值已存在');
+        if(!empty($tmp)) return json_show(1004,'该规格值已存在');
 
         $data = [
             "spec_name"=>$spec_name,
@@ -179,7 +179,7 @@ class Specs extends Base
             ->where(['is_del'=>0,'spec_name'=>$spec_name])
             ->where('id','<>',$id)
             ->findOrEmpty();
-        if(!$tmp) return json_show(1004,'该规格值已存在');
+        if(!empty($tmp)) return json_show(1004,'该规格值已存在');
 
         $data = [
             "id"=>$id,

+ 2 - 2
app/admin/controller/Unit.php

@@ -29,7 +29,7 @@ class Unit extends Base
             ->field('id')
             ->where(['is_del' => 0, "unit" => $param['unit']])
             ->findOrEmpty();
-        if (!$tmp) return json_show(1004, '该单位已存在');
+        if (!empty($tmp)) return json_show(1004, '该单位已存在');
 
 //        $token = isset($this->post['token'])&&$this->post['token']!='' ? trim($this->post['token']):"";
 //        if($token==''){
@@ -151,7 +151,7 @@ class Unit extends Base
             ->where(['is_del' => 0, "unit" => $unit])
             ->where('id','<>',$id)
             ->findOrEmpty();
-        if (!$tmp) return json_show(1004, '该单位已存在');
+        if (!empty($tmp)) return json_show(1004, '该单位已存在');
 
         $data = [
             "id" => $id,