package com.bwie.common.utils; import org.apache.http.HttpResponse; import java.util.HashMap; import java.util.Map; /** * @author * @version 1.0.0 * @ClassName MsgUtil.java * @Description TODO * @createTime 2022年05月26日 15:49:00 */ public class MsgUtil { public static void sendMsg(String phone,String code){ String host = "http://dingxin.market.alicloudapi.com"; String path = "/dx/sendSms"; String method = "POST"; //String appcode = "0d534f614a8647ca94d697eec974aa63"; String appcode = "dcb3dabebd3843a7a138901659ed112a"; Map headers = new HashMap(); headers.put("Authorization", "APPCODE " + appcode); Map querys = new HashMap(); querys.put("mobile", phone); querys.put("param", "code:"+code); querys.put("tpl_id", "TP1711063"); Map bodys = new HashMap(); try { HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys); System.out.println(response.toString()); } catch (Exception e) { e.printStackTrace(); } } }