puzhibing
2026-03-06 c725490d8f03303c9610cc422b70e16714cbd2b6
xp-robotaxi-account-boot/src/main/java/com/xiaopeng/account/controller/TokenController.java
@@ -1,5 +1,6 @@
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;
@@ -11,8 +12,10 @@
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;
@@ -151,7 +154,6 @@
        if (!xpOperationsUser.getStatus()) {
            return R.fail("账号已禁用!");
        }
        // todo 后续补充验证码
        // 生成6位数短信验证码
        String code = String.valueOf((int) (Math.random() * 1000000));
        String codeType = "";
@@ -167,19 +169,18 @@
            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();
    }