| | |
| | | package com.doumee.api.web; |
| | | |
| | | import com.doumee.config.Jwt.JwtTokenUtil; |
| | | import com.doumee.core.constants.ResponseStatus; |
| | | import com.doumee.core.exception.BusinessException; |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.model.Users; |
| | | import com.doumee.service.business.MemberService; |
| | |
| | | Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserId_Name); |
| | | return obj != null ? (Long) obj : null; |
| | | } |
| | | |
| | | |
| | | |
| | | protected Long getUserId() { |
| | | if(isDebug){ |
| | | return 2L; |
| | | } |
| | | // if(isDebug){ |
| | | // return 2L; |
| | | // } |
| | | Object obj = this.getRequest().getAttribute(JwtTokenUtil.UserId_Name); |
| | | return obj != null ? (Long) obj : null; |
| | | } |
| | | protected Users getLoginUserInfo() { |
| | | Long userId = getUserId(); |
| | | if(userId== null){ |
| | | return null; |
| | | throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"未登录"); |
| | | } |
| | | Users user = usersService.findById(userId); |
| | | return user; |