上午安裝了相關的軟件,注冊了Git等工具,感覺沒做什么事情;
下午跑了一下公司的項目,項目太大了電腦有點都帶不動;
安裝的項目所需的redis,項目跑不通,原因是沒有設置redis的用戶名
config set requierpass pay-boy;
后端項目的代碼也有點不懂:
@RequestMapping(value = "/smsLogin",method = RequestMethod.POST)
@ApiOperation(value = "短信登錄接口")
public Result<Object> smsLogin(@RequestParam String mobile,
@RequestParam String code,
@RequestParam(required = false) Boolean saveLogin){
// 驗證短信驗證碼
String v = redisTemplate.opsForValue().get(CommonConstant.PRE_SMS + mobile);
if(StrUtil.isBlank(v)){
return new ResultUtil<Object>().setErrorMsg("驗證碼失效或KEY不正確");
}
if(!code.equals(v)){
return new ResultUtil<Object>().setErrorMsg("驗證碼不正確");
}
User u = userService.findByMobile(mobile);
if(u==null){
return new ResultUtil<Object>().setErrorMsg("手機號不存在");
}
String accessToken = securityUtil.getToken(u.getUsername(), saveLogin);
// 已驗證 清除key
deleteKey(mobile);
return new ResultUtil<Object>().setData(accessToken);
}
@SystemLog(description = "短信登錄", type = LogType.LOGIN)
public void deleteKey(String mobile){
// 分離出以便記錄登錄成功日志
redisTemplate.delete(CommonConstant.PRE_SMS + mobile);
}
@RequestMapping(value = "/resetByMobile",method = RequestMethod.POST)
@ApiOperation(value = "通過短信重置密碼")
public Result<Object> resetByMobile(@RequestParam String mobile,
@RequestParam String code,
@RequestParam String password,
@RequestParam String passStrength){
// 驗證短信驗證碼
String v = redisTemplate.opsForValue().get(CommonConstant.PRE_SMS + mobile);
if(StrUtil.isBlank(v)){
return new ResultUtil<Object>().setErrorMsg("驗證碼失效或KEY不正確");
}
if(!code.equals(v)){
return new ResultUtil<Object>().setErrorMsg("驗證碼不正確");
}
User u = userService.findByMobile(mobile);
String encryptPass= new BCryptPasswordEncoder().encode(password);
u.setPassword(encryptPass);
u.setPassStrength(passStrength);
userService.update(u);
// 刪除緩存
redisTemplate.delete("user::"+u.getUsername());
// 已驗證清除key
redisTemplate.delete(CommonConstant.PRE_SMS + mobile);
return new ResultUtil<Object>().setSuccessMsg("重置密碼成功");
}
為什么每個hander的return都是一個result對象,頁面之間是怎么跳轉的?
前端代碼大多都是js,好多都是找不到自己想要的東西,前端的跳轉也不知道怎么回事,還需努力!