dever 4 years ago
parent
commit
c4e454eaee
1 changed files with 9 additions and 4 deletions
  1. 9 4
      src/Api.php

+ 9 - 4
src/Api.php

@@ -13,24 +13,29 @@ class Api
         Dever::apply('lib/phpqrcode');
     }
 
-    public function qrcode($string, $local = false, $logo = false)
+    public function qrcode($string, $local = false, $logo = false, $uid = false)
     {
         if ($local) {
             $this->config['local'] = true;
         }
         if ($this->config['local']) {
-            $result = $this->create($string, $local, $logo);
+            $result = $this->create($string, $local, $logo, $uid);
         } else {
             $result = $this->create($string);
         }
         return $result;
     }
 
-    private function create($value, $local = false, $logo = false)
+    private function create($value, $local = false, $logo = false, $uid = false)
     {
         $file = false;
         if ($local) {
-            $path = Dever::pathDay($this->path);
+            if ($uid) {
+                $path = Dever::pathAvatar($this->path, $uid);
+            } else {
+                $path = Dever::pathDay($this->path);
+            }
+            
             $file = $path . $local . '.png';
         }
         if (!is_file($file)) {