短信主机ip校验

This commit is contained in:
zhouyahui 2018-12-12 18:43:11 +08:00
parent 3e3aeba902
commit 464b20af26

View File

@ -47,10 +47,12 @@ public class SendMessageUtil{
//添加从服务器ip
String slaveSendIp="{172.28.1.63}";
//判断本机电脑所有配置好的IP是否与短信配置中的符合
if("N".equals(messageConfig.getAttribute("IS_SEND").getString()) || !getServerIsAllowSendMsg(allowSendIps) || !getServerIsAllowSendMsg(slaveSendIp)){
if("N".equals(messageConfig.getAttribute("IS_SEND").getString()) || !(getServerIsAllowSendMsg(allowSendIps) || getServerIsAllowSendMsg(slaveSendIp))){
System.out.println("短信设置为不发送短信或本机IP未在[允许发送短信的主机IP]之中!");
return "当前系统IP不在允许发送的IP地址之中";
}
String sendMsg = "【安鹏租赁】"+msg;
//从短信配置中根据对应字段获取要发送的地址和用户名,密码等信息
String sendPassword = messageConfig.getAttribute("SENDER_PASSWORD_").getString();
@ -106,6 +108,8 @@ public class SendMessageUtil{
List<String> hostAddrList = getServerIpList();
if(hostAddrList.size() > 0){
for(String ipStr : hostAddrList){
System.out.println("主机ip地址================"+ipStr);
if(allowIps.indexOf(ipStr) != -1){
flag = true;
break;