| 
					
				 | 
			
			
				@@ -0,0 +1,36 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+<?php
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+|--------------------------------------------------------------------------
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+| 获取小程序二维码
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+|--------------------------------------------------------------------------
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+*/
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+namespace Applet\Src;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Dever;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+use Main\Lib\Wechat;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+class Code
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+{
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public function get()
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $project = Dever::input('project');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $param['path'] = Dever::input('path', 'pages/index/index');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $param['param'] = Dever::input('send');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $update = Dever::input('update', 2);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $file = Dever::pathDay('upload/applet/code', false) . $project . '_' . md5($param['path'] . '_' . $param['param']) . '.jpg';
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!is_file($file) || $update == 1) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $wechat = new Wechat($project, 'applet');
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            $data = $wechat->curl('code', $param, true);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if ($data) {
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                file_put_contents($file, $data);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        $file = Dever::pic($file);
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return $file;
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    }
 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |