xuhy
2024-11-04 0d4a9b859eff7452eefdfb160f5778f68d9c0fad
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/CodeController.java
@@ -1,5 +1,6 @@
package com.ruoyi.chargingPile.controller;
import com.ruoyi.account.api.dto.SendMessageDTO;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUser;
import com.ruoyi.chargingPile.api.model.TChargingPile;
@@ -48,8 +49,13 @@
        }
        String code = MsgUtil.createCode();
        redisService.setCacheObject(phone+ Constants.UPDATE_PHONE,code,5L, TimeUnit.MINUTES);
        String reqStr = MsgUtil.codeMsg(phone, code);
        String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr);
        SendMessageDTO sendMessageDTO = new SendMessageDTO();
        sendMessageDTO.setPhone(phone);
        sendMessageDTO.setCode(code);
        sendMessageDTO.setType(1);
        String result = appUserClient.sendMessage(sendMessageDTO).getData();
//        String reqStr = MsgUtil.codeMsg(phone, code);
//        String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr);
        // 记录短信发送
        chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于更换手机号。请勿转发。");
        return AjaxResult.success(result);
@@ -67,8 +73,13 @@
    {
        String code = MsgUtil.createCode();
        redisService.setCacheObject(phone+ Constants.APPLY_CHARGING,code,5L, TimeUnit.MINUTES);
        String reqStr = MsgUtil.applyCodeMsg(phone, code);
        String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr);
        SendMessageDTO sendMessageDTO = new SendMessageDTO();
        sendMessageDTO.setPhone(phone);
        sendMessageDTO.setCode(code);
        sendMessageDTO.setType(2);
        String result = appUserClient.sendMessage(sendMessageDTO).getData();
//        String reqStr = MsgUtil.applyCodeMsg(phone, code);
//        String result = HttpUtils.post(MsgConstants.SEND_URL, reqStr);
        // 记录短信发送
        chargingPileNotificationService.saveData(1,-1,-1,phone,"验证码:"+code+",用于申请建桩。请勿转发。");
        return AjaxResult.success(result);