package com.ruoyi.common.utils.sms;
|
|
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
import com.ruoyi.common.utils.HttpUtil;
|
import com.ruoyi.common.utils.sign.Md5Utils;
|
import org.springframework.beans.factory.annotation.Value;
|
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.Map;
|
|
public class smsUtils {
|
|
|
/**
|
* 杭州市一医院吴山院区我短信接口
|
*
|
* @param url 短信URL
|
* @param userName 短信帐号
|
* @param content 短信密码
|
* @param phone 手机号组合如 13500000001,13500000002
|
* @param content 短信内容
|
* @return 两个参数的和
|
*/
|
public static String sendSms(String url, String userName, String passWord, String phone, String content) {
|
long timestamp = new Date().getTime();
|
String sign = Md5Utils.hash(userName + timestamp + Md5Utils.hash(passWord));
|
content = "【杭州市一医院吴山院区】" + content;
|
String jsonMsg = "{" +
|
"\"userName\": \"" + userName + "\"," +
|
"\"content\": \"" + content + "\"," +
|
"\"phoneList\": [" + phone + "]," +
|
"\"timestamp\": " + timestamp + "," +
|
"\"sign\": \"" + sign + "\"" +
|
"}";
|
return HttpUtil.postJsonRequest(url, jsonMsg);
|
|
}
|
}
|