| 
					
					
						
							
						
					
					
				 | 
				@ -7,6 +7,7 @@ use Dcat\Admin\Repositories\Repository; | 
			
		
		
	
		
			
				 | 
				 | 
				use EasyWeChat\Factory; | 
				 | 
				 | 
				use EasyWeChat\Factory; | 
			
		
		
	
		
			
				 | 
				 | 
				use GuzzleHttp\Exception\GuzzleException; | 
				 | 
				 | 
				use GuzzleHttp\Exception\GuzzleException; | 
			
		
		
	
		
			
				 | 
				 | 
				use Illuminate\Pagination\LengthAwarePaginator; | 
				 | 
				 | 
				use Illuminate\Pagination\LengthAwarePaginator; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				use Illuminate\Support\Facades\Cache; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				/** | 
				 | 
				 | 
				/** | 
			
		
		
	
		
			
				 | 
				 | 
				 * 小程序模板 | 
				 | 
				 | 
				 * 小程序模板 | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -15,10 +16,7 @@ use Illuminate\Pagination\LengthAwarePaginator; | 
			
		
		
	
		
			
				 | 
				 | 
				 */ | 
				 | 
				 | 
				 */ | 
			
		
		
	
		
			
				 | 
				 | 
				class MiniProgramTemplate extends Repository | 
				 | 
				 | 
				class MiniProgramTemplate extends Repository | 
			
		
		
	
		
			
				 | 
				 | 
				{ | 
				 | 
				 | 
				{ | 
			
		
		
	
		
			
				 | 
				 | 
					public function getPrimaryKeyColumn() | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
					{ | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
						return 'template_id'; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
					} | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
					protected $keyName = 'template_id'; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
					/** | 
				 | 
				 | 
					/** | 
			
		
		
	
		
			
				 | 
				 | 
					 * 查询表格数据 | 
				 | 
				 | 
					 * 查询表格数据 | 
			
		
		
	
	
		
			
				| 
					
					
					
						
							
						
					
				 | 
				@ -37,15 +35,21 @@ class MiniProgramTemplate extends Repository | 
			
		
		
	
		
			
				 | 
				 | 
							'aes_key'  => $setting['service_aeskey'], | 
				 | 
				 | 
							'aes_key'  => $setting['service_aeskey'], | 
			
		
		
	
		
			
				 | 
				 | 
						]; | 
				 | 
				 | 
						]; | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
						$openPlatform = Factory::openPlatform($config); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
						$codeTemplate = $openPlatform['code_template']; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
						if (empty($codeTemplate) || (!$list = $codeTemplate->list())) { | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							$data['total'] = 0; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							$data['subjects'] = []; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
						$cache_key = 'mini_program:template_list'; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
						if ($data['subjects'] = Cache::get($cache_key)) { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							$data['total'] = count($data['subjects']); | 
			
		
		
	
		
			
				 | 
				 | 
						} else { | 
				 | 
				 | 
						} else { | 
			
		
		
	
		
			
				 | 
				 | 
							$data['total'] = count($list['template_list']); | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
							$data['subjects'] = $list['template_list'] ?? []; | 
				 | 
				 | 
				 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							$openPlatform = Factory::openPlatform($config); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							$codeTemplate = $openPlatform['code_template']; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							if (empty($codeTemplate) || (!$list = $codeTemplate->list())) { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								$data['total'] = 0; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								$data['subjects'] = []; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							} else { | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								$data['total'] = count($list['template_list']); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								$data['subjects'] = $list['template_list'] ?? []; | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
								Cache::put($cache_key, $list['template_list'], 120); | 
			
		
		
	
		
			
				 | 
				 | 
				 | 
				 | 
				 | 
							} | 
			
		
		
	
		
			
				 | 
				 | 
						} | 
				 | 
				 | 
						} | 
			
		
		
	
		
			
				 | 
				 | 
				
 | 
				 | 
				 | 
				
 | 
			
		
		
	
		
			
				 | 
				 | 
						return $model->makePaginator( | 
				 | 
				 | 
						return $model->makePaginator( | 
			
		
		
	
	
		
			
				| 
					
						
							
						
					
					
					
				 | 
				
  |