Browse Source

添加 setFactory方法

wu 8 months ago
parent
commit
125366c788
1 changed files with 16 additions and 0 deletions
  1. 16 0
      src/Company.php

+ 16 - 0
src/Company.php

@@ -36,6 +36,22 @@ class Company extends Save
         return false;
         return false;
     }
     }
 
 
+    public function setFactory()
+    {
+        $factory_id = Dever::input('factory_id');
+        $auth = $this->getAuth();
+        if($auth){
+            if (is_string($auth)) {
+                $auth = explode(',', $auth);
+            }
+
+            if (in_array($factory_id, $auth)) {
+                return $this->_add('factory', $factory_id, 3600 * 24 * 365);
+            }
+        }
+        return false;
+    }
+
     # 获取公司权限
     # 获取公司权限
     public function get()
     public function get()
     {
     {