| | |
| | | package com.xiaopeng.account.controller; |
| | | |
| | | import com.xiaopeng.account.constant.I18nKeyConstant; |
| | | import com.xiaopeng.account.service.ISysUserService; |
| | | import com.xiaopeng.account.service.IXpOperationsUserService; |
| | | import com.xiaopeng.account.service.impl.SysLoginService; |
| | |
| | | import com.xiaopeng.api.model.account.XpOperationsUser; |
| | | import com.xiaopeng.api.vo.account.LoginOperationUser; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | | import com.xiaopeng.api.vo.operation.SmsVo; |
| | | import com.xiaopeng.common.core.constant.VerificationCodeConstants; |
| | | import com.xiaopeng.common.core.domain.R; |
| | | import com.xiaopeng.common.core.exception.ServiceException; |
| | | import com.xiaopeng.common.core.utils.JwtUtils; |
| | | import com.xiaopeng.common.core.utils.StringUtils; |
| | | import com.xiaopeng.common.redis.service.RedisService; |
| | |
| | | if (!xpOperationsUser.getStatus()) { |
| | | return R.fail("账号已禁用!"); |
| | | } |
| | | // todo 后续补充验证码 |
| | | // 生成6位数短信验证码 |
| | | String code = String.valueOf((int) (Math.random() * 1000000)); |
| | | String codeType = ""; |
| | |
| | | codeType = VerificationCodeConstants.UPDATE_PASSWORD_CODE; |
| | | break; |
| | | } |
| | | //TODO 短信服务开通后再开启 |
| | | // SmsVo vo = new SmsVo(); |
| | | // vo.setAppId(sms_appid); |
| | | // vo.setPushType(1); |
| | | // vo.setReceivers(appLoginPasswordDTO.getPhoneNumber()); |
| | | // vo.setTemplateCode("RobotaxiVerifyCodeSmsTpl"); |
| | | // vo.setAppPushConfigCode("RobotaxiVerifyCodeSms"); |
| | | // vo.setParams(new HashMap<>()); |
| | | // vo.getParams().put("code", code); |
| | | // SmsDto smsDto = smsClient.pushSms(vo); |
| | | // if(null == smsDto || smsDto.getCode() != 200){ |
| | | // throw new ServiceException("短信发送失败", I18nKeyConstant.SMS_PUSH_FAILED); |
| | | // } |
| | | SmsVo vo = new SmsVo(); |
| | | vo.setAppId(sms_appid); |
| | | vo.setPushType(1); |
| | | vo.setReceivers(appLoginPasswordDTO.getPhoneNumber()); |
| | | vo.setTemplateCode("RobotaxiVerifyCodeSmsTpl"); |
| | | vo.setAppPushConfigCode("RobotaxiVerifyCodeSms"); |
| | | vo.setParams(new HashMap<>()); |
| | | vo.getParams().put("code", code); |
| | | SmsDto smsDto = smsClient.pushSms(vo); |
| | | if(null == smsDto || smsDto.getCode() != 200){ |
| | | throw new ServiceException("短信发送失败", I18nKeyConstant.SMS_PUSH_FAILED); |
| | | } |
| | | redisService.setCacheObject(codeType+appLoginPasswordDTO.getPhoneNumber(), code, 60L, TimeUnit.SECONDS); |
| | | return R.ok(); |
| | | } |