|
|
@@ -7,6 +7,7 @@ import com.fs.app.annotation.Login;
|
|
|
import com.fs.app.controller.AppBaseController;
|
|
|
import com.fs.common.annotation.RepeatSubmit;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.core.utils.OrderCodeUtils;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
|
@@ -24,6 +25,7 @@ import com.fs.system.service.ISysConfigService;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.hc.openapi.tool.fastjson.JSON;
|
|
|
+import io.jsonwebtoken.Claims;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
@@ -36,7 +38,9 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
@Api("企微看课接口")
|
|
|
@RestController
|
|
|
@@ -413,4 +417,32 @@ public class CourseQwController extends AppBaseController {
|
|
|
return R.ok().put("data",course);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @ApiOperation("检测是否登录")
|
|
|
+ @GetMapping("/checkLogin")
|
|
|
+ public R checkLogin(){
|
|
|
+ try {
|
|
|
+ HttpServletRequest request = ServletUtils.getRequest();
|
|
|
+ //获取用户凭证
|
|
|
+ String token = request.getHeader(jwtUtils.getHeader());
|
|
|
+ if(StringUtils.isBlank(token)){
|
|
|
+ token = request.getParameter(jwtUtils.getHeader());
|
|
|
+ }
|
|
|
+ //检查token是否存在
|
|
|
+ if (StringUtils.isBlank(token)) {
|
|
|
+ return R.error(4001, "登录凭证不能为空,重新授权");
|
|
|
+ }
|
|
|
+ Claims claims=jwtUtils.getClaimByToken(token);
|
|
|
+ if(claims==null || jwtUtils.isTokenExpired(claims.getExpiration())){
|
|
|
+ return R.error(4004,"回传token校验失败,重新授权");
|
|
|
+ }
|
|
|
+ return R.ok();
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.error("检测登录状态异常: {}", e.getMessage(), e);
|
|
|
+ return R.error("系统异常,请稍后重试");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|