perryhsu
2020-09-30 3ab47f8fdd1da2c97917c38b2510855d7c3963c4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.fgkj.controller;
 
import javax.servlet.http.HttpSession;
 
import com.fgkj.dto.ServiceModel;
import com.fgkj.mapper.CheckMobile;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
@RequestMapping("checkClient")
@RestController
@Api
public class CheckClientController{
    /** 
     * 检查访问方式是否为移动端 
     *  
     * @Title: check 
     * @Date : 2014-7-7 下午03:55:19 
     */
    @GetMapping("check")
    public boolean check(){
        boolean isFromMobile=false;  
          
        HttpSession session= ActionUtil.getSession();
       //检查是否已经记录访问方式(移动端或pc端)  
        try{
            //获取ua,用来判断是否为移动端访问
            String userAgent = ActionUtil.getRequest().getHeader( "USER-AGENT" ).toLowerCase();
            if(null == userAgent){
                userAgent = "";
            }
            isFromMobile=CheckMobile.check(userAgent);
            //判断是否为移动端访问
 
        }catch(Exception e){}
        return isFromMobile;
    } 
}