sinake
20 小时以前 371603a0eb9f3a279cf77073734e991b5851b792
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);
 
    }
}