|
@@ -149,9 +149,9 @@ class ProductService extends Service
|
|
->exists();
|
|
->exists();
|
|
}else{
|
|
}else{
|
|
if($this->isEmpty($data,'id')) return [false,'id不能为空!'];
|
|
if($this->isEmpty($data,'id')) return [false,'id不能为空!'];
|
|
-
|
|
|
|
|
|
+ $top_depart_id = ProductCategory::where('id',$data['id'])->value('top_depart_id');
|
|
$bool = ProductCategory::where('title',$value['title'])
|
|
$bool = ProductCategory::where('title',$value['title'])
|
|
- ->where('top_depart_id',$data['top_depart_id'])
|
|
|
|
|
|
+ ->where('top_depart_id',$top_depart_id)
|
|
->where('id','<>',$data['id'])
|
|
->where('id','<>',$data['id'])
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
->exists();
|
|
->exists();
|
|
@@ -597,12 +597,13 @@ class ProductService extends Service
|
|
$data['top_depart_id'] = $user['depart_map'][$data['depart_id']] ?? 0;
|
|
$data['top_depart_id'] = $user['depart_map'][$data['depart_id']] ?? 0;
|
|
|
|
|
|
if($is_add){
|
|
if($is_add){
|
|
- $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}')")
|
|
|
|
|
|
+ $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}') AND top_depart_id = {$data['top_depart_id']}")
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
->exists();
|
|
->exists();
|
|
}else{
|
|
}else{
|
|
if(empty($data['id'])) return [false,'ID不能为空'];
|
|
if(empty($data['id'])) return [false,'ID不能为空'];
|
|
- $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}')")
|
|
|
|
|
|
+ $top_depart_id = Product::where('id',$data['id'])->value('top_depart_id');
|
|
|
|
+ $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}') AND top_depart_id = {$top_depart_id}")
|
|
->where('id','<>',$data['id'])
|
|
->where('id','<>',$data['id'])
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
->exists();
|
|
->exists();
|