cqpCow 1 year ago
parent
commit
81fb4e1b11
3 changed files with 3 additions and 19 deletions
  1. 1 9
      app/Model/InOutRecord.php
  2. 1 9
      app/Model/ProductInventorySet.php
  3. 1 1
      app/Service/EmployeeService.php

+ 1 - 9
app/Model/InOutRecord.php

@@ -15,7 +15,6 @@ class InOutRecord extends Model
 
     public static $user = [];
     public static $search = [];
-    public static $is_search = false;
     const range_function = '';
 
     public function __construct(array $attributes = [])
@@ -24,15 +23,8 @@ class InOutRecord extends Model
             self::$user = $attributes['userData'];
             self::$search = $attributes['search'] ?? [];
             self::$user['range_function'] = self::range_function;
-            self::$is_search = true;
-        }
-        parent::__construct($attributes);
-    }
-
-    protected static function boot(){
-        parent::boot();
-        if(self::$is_search){
             static::addGlobalScope(new ProductInventoryScope(self::$user, self::$search));
         }
+        parent::__construct($attributes);
     }
 }

+ 1 - 9
app/Model/ProductInventorySet.php

@@ -18,22 +18,14 @@ class ProductInventorySet extends Model
 
     public static $user = [];
     public static $search = [];
-    public static $is_search = false;
 
     public function __construct(array $attributes = [])
     {
         if(! empty($attributes['userData'])) {
             self::$user = $attributes['userData'];
             self::$search = $attributes['search'];
-            self::$is_search = true;
-        }
-        parent::__construct($attributes);
-    }
-
-    protected static function boot(){
-        parent::boot();
-        if(self::$is_search){
             static::addGlobalScope(new TopDepartmentScope(self::$user, self::$search));
         }
+        parent::__construct($attributes);
     }
 }

+ 1 - 1
app/Service/EmployeeService.php

@@ -1250,7 +1250,7 @@ class EmployeeService extends Service
         $is_all_depart = 0;
         if(! empty($depart)){
             //库存校验
-            $set_map = DB::table('depart_set')->where('del_time',0)->pluck('param_one','top_depart_id')->toArray();
+            $set_map = ProductInventorySet::where('del_time',0)->pluck('param_one','top_depart_id')->toArray();
 
             //所有部门
             $list = Depart::where('del_time',0)->get()->toArray();