Browse Source

产品唯一规则修改

cqpCow 11 months ago
parent
commit
a516996647
1 changed files with 3 additions and 3 deletions
  1. 3 3
      app/Service/ProductService.php

+ 3 - 3
app/Service/ProductService.php

@@ -621,17 +621,17 @@ class ProductService extends Service
         $top_depart_id = $user['head'] ?? [];
         $top_depart_id = $top_depart_id['id'] ?? 0;
         if($is_add){
-            $bool = Product::whereRaw("(binary code = '{$data['code']}' AND title = '{$data['title']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
+            $bool = Product::whereRaw("(binary code = '{$data['code']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
                 ->where('del_time',0)
                 ->exists();
         }else{
             if(empty($data['id'])) return [false,'ID不能为空'];
-            $bool = Product::whereRaw("(binary code = '{$data['code']}' AND title = '{$data['title']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
+            $bool = Product::whereRaw("(binary code = '{$data['code']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
                 ->where('id','<>',$data['id'])
                 ->where('del_time',0)
                 ->exists();
         }
-        if($bool) return [false,'产品名称与编码不能重复'];
+        if($bool) return [false,'产品编码不能重复'];
 
         return [true, $data];
     }