panlumeng 3 years ago
parent
commit
cf6b687082
1 changed files with 4 additions and 3 deletions
  1. 4 3
      app/admin/controller/Customar.php

+ 4 - 3
app/admin/controller/Customar.php

@@ -27,11 +27,12 @@ class Customar extends BaseController
         if ($companyName == "") {
             return error_show(1002, "参数companyName不能为空");
         }
-        $rename = Db::name('customer_info')->where(['is_del' => 0, 'companyName' => $companyName])->find();
-        if (!empty($rename)) {
+        $parent = isset($this->post['parent']) && $this->post['parent'] !== "" ? intval($this->post['parent'] ) : "";
+        $rename = Db::name('customer_org1')->where(['is_del' =>0,'id'=>$parent])->find();
+        $item = Db::name('customer_info')->where(['itemid'=>$rename['id'],'companyName'=>$companyName,'is_del'=>0])->find();
+        if ($item!=false) {
             return error_show(1002, "公司名称已存在");
         }
-        $parent = isset($this->post['parent']) && $this->post['parent'] !== "" ? intval($this->post['parent'] ) : "";
 //        if ($parent === "") {
 //            return error_show(1002, "参数parent不能为空");
 //        }