官方位址
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;
}