| 
					
				 | 
			
			
				@@ -7,13 +7,18 @@ namespace app\api\controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Endroid\QrCode\Builder\Builder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Endroid\QrCode\Label\Alignment\LabelAlignmentCenter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-use Endroid\QrCode\Label\Alignment\LabelAlignmentLeft; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Endroid\QrCode\Label\Font\NotoSans; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use Endroid\QrCode\Writer\PngWriter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 use think\facade\Log; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use ZxingSPE\QrReader; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 class Qrcode extends Base 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 在线生成二维码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 示例:https://api.ycxxkj.com/index.php/api/qrcode/online/text/WT202410012092476944/size/500/label/WT202410012092476944/lable_size/100 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return \think\Response 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public function online() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         $param = input("param."); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -43,4 +48,19 @@ class Qrcode extends Base 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return response($result->getString(), 200)->contentType($result->getMimeType()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 识别图片二维码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return void 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @throws \Exception 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function read() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $url = input("url", ""); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!$url) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $this->error("url为空"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $qrcodeReader = new QrReader($url); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $qrcodeText = $qrcodeReader->text(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $this->success(["text" => $qrcodeText]); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |