package com.xjrsoft.xjrsoftboot;

import cn.dev33.satoken.secure.SaSecureUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import org.junit.jupiter.api.Test;
import cn.hutool.core.convert.Convert;

import java.util.HashMap;
import java.util.Map;

public class SmsTest {

    @Test
    public void sendTest() {

        Map<String, Object> params = new HashMap<>();
        params.put("appKey", "105649");
        params.put("timestamp", System.currentTimeMillis());
        params.put("mobile", "17362027614");
        params.put("content", String.format("【重庆市铜梁职业教育中心】验证码为%d，有效时间为%d分钟，请勿将验证码泄露给其他人。", 123123, 2));

        String str = params.get("appKey").toString()
                + params.get("timestamp").toString()
                + params.get("mobile").toString()
                + params.get("content").toString()
                + "c3868470891526d9";
        params.put("sign", SaSecureUtil.md5(str));

//        JSONUtil.toJsonStr(params);

        String result = HttpUtil.post("http://182.92.7.106:7892/api/sms/air/send", params);

        System.out.println(result);


    }
}
