| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | |
| | | import cn.hutool.http.ContentType; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.twilio.Twilio; |
| | |
| | | |
| | | |
| | | |
| | | @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<>(); |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | post.contentType(ContentType.JSON.toString()); |
| | | JSONObject params = new JSONObject(); |
| | | 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); |
| | | post.body(params.toJSONString()); |
| | | HttpResponse execute = post.execute(); |
| | | String body = execute.body(); |
| | | execute.close(); |
| | | JSONObject jsonObject = JSON.parseObject(body); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(1701 == status){ |
| | | return true; |