中扬CRM客户关系管理系统
LSH
2023-11-22 92b286e238439c61b230a07f42b92c2328588d49
src/main/java/com/zy/crm/manager/utils/SmsUtils.java
@@ -8,6 +8,7 @@
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponse;
import com.aliyun.sdk.service.dysmsapi20170525.models.SendSmsResponseBody;
import com.zy.crm.common.entity.PhoneCodeTypeParam;
import darabonba.core.client.ClientOverrideConfiguration;
import java.util.*;
@@ -35,6 +36,37 @@
            param.put("templateId", "MEA92C3A45");
            param.put("receive", phone);
            param.put("tag", code);
            String response = new HttpHandler.Builder()
                    .setUri("https://smkjdxtzjk.market.alicloudapi.com")
                    .setPath("/standard/sms/send")
                    .setHeaders(headers)
                    .setParams(param)
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            if (Integer.parseInt(jsonObject.get("code").toString()) == 200) {
                return true;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
    /**
     * 阿里云市场API  分配了新的规划申请单任务!请注意查收!
     */
    private static boolean aliyun_2(String phone, PhoneCodeTypeParam phoneCodeTypeParam) {
        try {
            HashMap<String, Object> headers = new HashMap<>();
            HashMap<String, Object> param = new HashMap<>();
            String APPCODE = "15ce5d8be5e348c7b680dfd7cfb8307e";
            headers.put("Authorization", "APPCODE " + APPCODE);
            param.put("templateId", phoneCodeTypeParam.templateId);
            param.put("receive", phone);
            param.put("tag", "");
            String response = new HttpHandler.Builder()
                    .setUri("https://smkjdxtzjk.market.alicloudapi.com")
@@ -122,6 +154,13 @@
    }
    /**
     * 发送短信-阿里云原生
     */
    public static boolean sendSmsCodeText(String phone, PhoneCodeTypeParam param) {
        return aliyun_2(phone, param);
    }
    /**
     * 获取随机数
     * @param length 随机数长度
     */