1
luodangjia
2025-01-22 759e0540a7ca20f33ab265d00e7944e4f18a562b
ruoyi-auth/src/main/java/com/ruoyi/auth/utils/SmsUtils.java
@@ -1,12 +1,15 @@
package com.ruoyi.auth.utils;
import com.alibaba.fastjson2.JSONObject;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class SmsUtils {
    public static String sendSms(String phoneNumber, String code) {
        // 设置AccessKeyId、AccessKeySecret等信息
@@ -27,6 +30,7 @@
        try {
            // 发送短信并打印结果
            SendSmsResponse response = client.getAcsResponse(request);
            log.info("发送短信结果:{}", JSONObject.toJSONString(response));
            return response.getCode();
        } catch (ClientException e) {
            e.printStackTrace();