官方地址
private HashMap<String, Object> doSendSms(BusiTranInfo info, String mobilePhone) {
//要转换的长的url链接
String url ="https://xxx/";
//key
String shortConnectionTransitionKey = Global.getConfig(ApolloKey.SHORT_CONNECTION_TRANSITION_KEY);
//shortConnectionTransitionUrl = http://suo.nz/api.php?format=json&url=
String shortConnectionTransitionUrl = Global.getConfig(ApolloKey.SHORT_CONNECTION_TRANSITION_URL);
HashMap<String,Object> map = Maps.newHashMap();
try {
// 获取当前时间往后推迟7天
Date now = new Date();
Calendar calendar = new GregorianCalendar();
calendar.setTime(now);
calendar.add(Calendar.DATE, 7);
Date time = calendar.getTime();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(time);
String data = url+"?orderId="+ info.getBusiId()+"&orderTypeCode=2" ;
//对要转换的长url编码 import java.net.URLEncoder;
data = URLEncoder.encode(data) ;
url=shortConnectionTransitionUrl+ //短连接的URLAPI
data +"&key="+ shortConnectionTransitionKey +"&expireDate="+dateString;
logger.info("面签链接{}",url);
// 调用人家的接口,转成短连接
String ret = HttpUtils.httpGet(url);
JSONObject json = JSONObject.parseObject(ret);
String suoUrl = json.getString("url"); // 这就是短连接地址了
String err = json.getString("err");
}
} catch (Exception e) {
}
return map;
}