|
|
|
@ -2,8 +2,10 @@ package mashibing.online.text.controller;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.mashibing.constant.ErrorCodeConstant;
|
|
|
|
|
import com.mashibing.dto.PassengerRequestDto;
|
|
|
|
|
import com.mashibing.dto.ResponseResult;
|
|
|
|
|
import com.mashibing.dto.TokenResult;
|
|
|
|
|
import com.mashibing.exception.BizExecption;
|
|
|
|
|
import com.mashibing.util.JwtUtils;
|
|
|
|
|
import com.mashibing.util.RediesPreKeyUtil;
|
|
|
|
@ -12,12 +14,15 @@ import mashibing.online.text.consonant.PassengerConsonant;
|
|
|
|
|
import mashibing.online.text.dto.UserInfo;
|
|
|
|
|
import mashibing.online.text.feign.PassengerUserService;
|
|
|
|
|
import mashibing.online.text.feign.SendSMSCodeService;
|
|
|
|
|
import mashibing.online.text.utils.BussizParaTokenUtil;
|
|
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
import org.springframework.http.HttpRequest;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -98,7 +103,7 @@ public class PassengerController {
|
|
|
|
|
String accessTokenKey= RediesPreKeyUtil.generateKeyPre(PassengerConsonant.ACCESS_TOKEN_TYPE,phone,PassengerConsonant.PassengerIdendity);
|
|
|
|
|
String reshTokenKey= RediesPreKeyUtil.generateKeyPre(PassengerConsonant.REFLSH_TOKEN_TYPE,phone,PassengerConsonant.PassengerIdendity);
|
|
|
|
|
stringRedisTemplate.opsForValue().set(accessTokenKey,
|
|
|
|
|
accessToken,15,TimeUnit.SECONDS);
|
|
|
|
|
accessToken,15,TimeUnit.DAYS);
|
|
|
|
|
stringRedisTemplate.opsForValue().set(reshTokenKey,
|
|
|
|
|
refshToken,55,TimeUnit.SECONDS);
|
|
|
|
|
log.info("reshTokenKey ={},refshToken={}",reshTokenKey,refshToken);
|
|
|
|
@ -106,6 +111,16 @@ public class PassengerController {
|
|
|
|
|
return ResponseResult.success(userInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getUserInfoByPhone")
|
|
|
|
|
public ResponseResult getUserInfoByPhone(HttpServletRequest httpRequest){
|
|
|
|
|
String authorization = httpRequest.getHeader("Authorization");
|
|
|
|
|
TokenResult tokenResult= BussizParaTokenUtil.pareToken(authorization);
|
|
|
|
|
if(ObjectUtil.isNull(tokenResult)){
|
|
|
|
|
ResponseResult.fail(ErrorCodeConstant.TOKEN_ERROR,"token 错误");
|
|
|
|
|
}
|
|
|
|
|
return passengerUserService.getUserInfoByPhone(tokenResult.getPhoneNum());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|