|
@@ -518,13 +518,16 @@ class ProductService extends Service
|
|
|
$data['top_depart_id'] = $user['depart_map'][$data['depart_id']] ?? 0;
|
|
|
}
|
|
|
|
|
|
+ //总社id
|
|
|
+ $top_depart_id = $user['head'] ?? [];
|
|
|
+ $top_depart_id = $top_depart_id['id'] ?? 0;
|
|
|
if($is_add){
|
|
|
- $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}') AND top_depart_id = {$data['top_depart_id']}")
|
|
|
+ $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}') 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']}' OR title = '{$data['title']}') AND top_depart_id = {$data['top_depart_id']}")
|
|
|
+ $bool = Product::whereRaw("(binary code = '{$data['code']}' OR title = '{$data['title']}') AND (top_depart_id = {$data['top_depart_id']} OR top_depart_id = {$top_depart_id})")
|
|
|
->where('id','<>',$data['id'])
|
|
|
->where('del_time',0)
|
|
|
->exists();
|