cqpCow 1 anno fa
parent
commit
7a01a692f5
1 ha cambiato i file con 2 aggiunte e 11 eliminazioni
  1. 2 11
      app/Model/Customer.php

+ 2 - 11
app/Model/Customer.php

@@ -22,8 +22,6 @@ class Customer extends Model
 
     public static $user = [];
     public static $search = [];
-    public static $is_search = false;
-    public static $is_pond_state = true;
     public static $limitKey = "customerPondState";
     const range_function = 'customerRange';
 
@@ -33,16 +31,9 @@ class Customer extends Model
             self::$user = $attributes['userData'];
             self::$search = $attributes['search'];
             self::$user['range_function'] = self::range_function;
-            self::$is_search = true;
-            if(! empty(self::$search['pond_state'])) self::$is_pond_state = false;
+            //进入公海池 去掉限制
+            if(! empty(self::$search['pond_state']))  static::addGlobalScope(new DepartmentScope(self::$user, self::$search));
         }
         parent::__construct($attributes);
     }
-
-    protected static function boot(){
-        parent::boot();
-        if(self::$is_search && self::$is_pond_state){
-            static::addGlobalScope(new DepartmentScope(self::$user, self::$search));
-        }
-    }
 }