package com.fgkj.controller;
|
|
import com.fgkj.util.*;
|
|
import com.fgkj.mapper.CheckMobile;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.servlet.http.HttpSession;
|
|
import javax.annotation.Resource;
|
|
@RequestMapping("checkClient")
|
@RestController
|
@Api(tags = "checkClient接口")
|
public class CheckClientController{
|
/**
|
* 检查访问方式是否为移动端
|
*
|
* @Title: check
|
* @Date : 2014-7-7 下午03:55:19
|
*/
|
@GetMapping("check")
|
@ApiOperation(notes = "",value="检查访问方式是否为移动端")
|
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;
|
}
|
}
|