| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.twilio.Twilio; |
| | | import com.twilio.rest.api.v2010.account.Message; |
| | | import com.twilio.type.PhoneNumber; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.net.ssl.*; |
| | | import java.io.*; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @Component |
| | | public class SMSUtil { |
| | | |
| | | //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值 |
| | |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private HttpClientUtil httpClientUtil; |
| | | |
| | | |
| | | public boolean sendCellulantMessage(String toPhone, String msg){ |
| | | String url = "https://sms.nalosolutions.com/smsbackend/Nal_resl/send-message/"; |
| | | Map<String, Object> params = new HashMap<>(); |
| | | params.put("key", "ru#0flkf3993qh!!rg!@y4)nhwi08c#tg_vasek!ja)kvfnfjyoljoz(@nai(jkf"); |
| | | params.put("msisdn", toPhone); |
| | | params.put("message", msg); |
| | | params.put("sender_id", "I-GO"); |
| | | String s = httpClientUtil.pushHttpRequset("POST", url, params, null, "json"); |
| | | JSONObject jsonObject = JSON.parseObject(s); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(1701 == status){ |
| | | return true; |
| | | }else{ |
| | | return false; |
| | | } |
| | | } |
| | | } |