|  | @ -26,6 +26,7 @@ package cn.stylefeng.guns.core.util;
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | import cn.hutool.core.util.ObjectUtil;
 | 
	
		
			
				|  |  | import cn.hutool.extra.servlet.ServletUtil;
 | 
	
		
			
				|  |  | import cn.hutool.http.useragent.Browser;
 | 
	
		
			
				|  |  | import cn.hutool.http.useragent.UserAgent;
 | 
	
		
			
				|  |  | import cn.hutool.http.useragent.UserAgentUtil;
 | 
	
		
			
				|  |  | import cn.stylefeng.guns.core.consts.CommonConstant;
 | 
	
	
		
			
				|  | @ -81,6 +82,15 @@ public class UaUtil {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     private static UserAgent getUserAgent(HttpServletRequest request) {
 | 
	
		
			
				|  |  |         String userAgentStr = ServletUtil.getHeaderIgnoreCase(request, CommonConstant.USER_AGENT);
 | 
	
		
			
				|  |  |         return UserAgentUtil.parse(userAgentStr);
 | 
	
		
			
				|  |  |         UserAgent userAgent = UserAgentUtil.parse(userAgentStr);
 | 
	
		
			
				|  |  |         //判空
 | 
	
		
			
				|  |  |         if(ObjectUtil.isNotEmpty(userAgentStr)) {
 | 
	
		
			
				|  |  |             //如果根本没获取到浏览器
 | 
	
		
			
				|  |  |             if(CommonConstant.UNKNOWN.equals(userAgent.getBrowser().getName())) {
 | 
	
		
			
				|  |  |                 //则将ua设置为浏览器
 | 
	
		
			
				|  |  |                 userAgent.setBrowser(new Browser(userAgentStr, null, ""));
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         return userAgent;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | }
 |