mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-22 18:36:52 +08:00
adding sms
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package net.lab1024.smartadmin.util;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.hash.Hashing;
|
||||
|
||||
public class MD5Utils {
|
||||
|
||||
public static String getMD5Code(String content) {
|
||||
return Hashing.md5().newHasher().putString(content, Charsets.UTF_8).hash().toString();
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,6 @@ import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
public class SmartSendMailUtil {
|
||||
|
||||
/**
|
||||
@@ -84,7 +83,6 @@ public class SmartSendMailUtil {
|
||||
// 7. 关闭连接
|
||||
transport.close();
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -136,7 +134,6 @@ public class SmartSendMailUtil {
|
||||
transport.sendMessage(message, message.getAllRecipients());
|
||||
// 7. 关闭连接
|
||||
} catch (Exception e) {
|
||||
log.error("", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package net.lab1024.smartadmin.util;
|
||||
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.SMS.SMSServiceLocator;
|
||||
import net.lab1024.smartadmin.module.system.royalcanin.SMS.SMSServiceSoap_BindingStub;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
public class SmsUtil {
|
||||
|
||||
public static void sendMsg(String number ,String verifyNumber){
|
||||
try {
|
||||
URL protAddres = new URL("http://www.wemediacn.net/webservice/smsservice.asmx");
|
||||
SMSServiceLocator service = new SMSServiceLocator();
|
||||
SMSServiceSoap_BindingStub stub = (SMSServiceSoap_BindingStub) service.getSMSServiceSoap(protAddres);
|
||||
java.util.Calendar cal= java.util.Calendar.getInstance();
|
||||
cal.set(2021,12,31,0,0,0);
|
||||
String sMSGID = stub.sendSMS(number,8,"您好,您的验证码:" + verifyNumber + ", 5分钟有效期 !【皇家宠物食品】",cal,"7101567100151709");
|
||||
if (sMSGID.startsWith("OK:"))
|
||||
System.out.println("Send successful!");
|
||||
System.out.println("msgId = " + sMSGID);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user