| | |
| | | import com.doumee.dao.business.model.Member; |
| | | import com.doumee.dao.business.model.ShopInfo; |
| | | import io.jsonwebtoken.JwtException; |
| | | import lombok.extern.log4j.Log4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Bean; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Objects; |
| | | import java.util.logging.Logger; |
| | | |
| | | @Configuration |
| | | public class WebMvcConfig implements WebMvcConfigurer { |
| | |
| | | |
| | | public Boolean checkMemberLogin(HttpServletRequest request, HttpServletResponse response){ |
| | | String token = request.getHeader(JwtTokenUtil.HEADER_KEY); |
| | | System.out.println("会员token:=========>{}"+token); |
| | | try { |
| | | if(!token.startsWith(Constants.ZERO+"")){ |
| | | throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME); |
| | |
| | | |
| | | |
| | | public Boolean checkShopLogin(String token,HttpServletRequest request, HttpServletResponse response){ |
| | | System.out.println("门店token:=========>{}"+token); |
| | | try { |
| | | if(!token.startsWith(Constants.TWO+"")){ |
| | | throw new BusinessException(ResponseStatus.SHOP_TOKEN_EXCEED_TIME); |
| | |
| | | if(isForbidden == Constants.ONE){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"商户已禁用,请联系管理员"); |
| | | } |
| | | String dbOpenid = dao.queryForObject(" select ifnull(openid,'') from shop_info where id = ?", String.class, shopId); |
| | | if(StringUtils.isBlank(dbOpenid)||!openid.equals(dbOpenid)){ |
| | | throw new BusinessException(ResponseStatus.SHOP_TOKEN_EXCEED_TIME); |
| | | } |
| | | Integer count = dao.queryForObject("select count(1) from shop_info where id = ?", Integer.class, shopId); |
| | | if (count != null && count > 0) { |
| | | request.setAttribute(JwtTokenUtil.SHOP_ID, shop.getId()); |
| | |
| | | |
| | | public Boolean checkDriverLogin(HttpServletRequest request, HttpServletResponse response){ |
| | | String token = request.getHeader(JwtTokenUtil.HEADER_KEY); |
| | | System.out.println("司机token:=========>{}"+token); |
| | | try { |
| | | if(!token.startsWith(Constants.ONE+"")){ |
| | | throw new BusinessException(ResponseStatus.TOKEN_EXCEED_TIME); |