yyp9364

短信接口:

 1 public class SendMessageUtil {
 2     private static final String url = "http://222.73.117.158/msg/";// 应用地址
 3     private static final String account = "******";// 账号
 4     private static final String pswd = "******";// 密码
 5     //String mobile = "18395125555,18095176666";// 手机号码,多个号码使用","分割
 6     //String msg = "";// 短信内容
 7     private static final boolean needstatus = true;// 是否需要状态报告,需要true,不需要false
 8     private static final String product = null;
 9     private static final String extno = null;// 扩展码
10     public static String sendNote(String mobile,String msg){
11         try {
12             String returnString = HttpSender.batchSend( url, account, pswd, mobile, msg, needstatus, product, extno );
13             return returnString;
14             // TODO 处理返回值,参见HTTP协议文档
15         } catch (Exception e) {
16             // TODO 处理异常
17             e.printStackTrace();
18             return "发送失败";
19         }         
21     }
22 }

 获取短信内容msg和手机号:

1 statusCode = SendMessageUtil.sendNote( noticeNumber.getNumber(), content );       

 根据主键,关联键和用户名等查询短信表获取当前用户的手机号码。

content 可在后台拼接好,也可以在界面自己填写内容(一般都是在后台拼接好的内容)。

分类:

技术点:

相关文章: