|  |  |  | @ -31,7 +31,9 @@ class Wechat::Weapp | 
			
		
	
		
			
				
					|  |  |  |  |       cipher.padding = 0 | 
			
		
	
		
			
				
					|  |  |  |  |       cipher.key = session_key | 
			
		
	
		
			
				
					|  |  |  |  |       cipher.iv  = iv | 
			
		
	
		
			
				
					|  |  |  |  |       Rails.logger.info("[Weapp] encrypted_data: #{encrypted_data}") | 
			
		
	
		
			
				
					|  |  |  |  |       data = cipher.update(encrypted_data) << cipher.final | 
			
		
	
		
			
				
					|  |  |  |  |       Rails.logger.info("[Weapp] data: #{data}") | 
			
		
	
		
			
				
					|  |  |  |  |       result = JSON.parse(data[0...-data.last.ord]) | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |       raise Wechat::Error.new(-1, '解密错误') if result.dig('watermark', 'appid') != appid | 
			
		
	
	
		
			
				
					|  |  |  | 
 |