From 75d6a10fd6ab39dc2db63c8cf4879ebba17f4e54 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 01 九月 2023 09:19:20 +0800
Subject: [PATCH] 更新

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java |   60 +++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java
index a381833..c927df5 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java
@@ -1,9 +1,13 @@
 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.*;
@@ -16,6 +20,7 @@
 import java.text.SimpleDateFormat;
 import java.util.*;
 
+@Component
 public class SMSUtil {
 
     //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值
@@ -266,6 +271,32 @@
         }
     }
 
+    @Autowired
+    private HttpClientUtil httpClientUtil;
+
+
+    /**
+     * Cellulant短信
+     * @param toPhone
+     * @param msg
+     * @return
+     */
+    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;
+        }
+    }
 
 
 
@@ -278,18 +309,21 @@
 
         // Find your Account SID and Auth Token at twilio.com/console
         // and set the environment variables. See http://twil.io/secure
-        String ACCOUNT_SID = "AC1fd05e898bd59d17ba72db621afca537";
-        String AUTH_TOKEN = "7cee1a6cb0e2936a9037be577b1ffe57";
-        try {
-            Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
-            Message message = Message.creator(
-                    new PhoneNumber("+233570111999"),
-                    new PhoneNumber("+16672740015"),
-                    "This is the ship that made the Kessel Run in fourteen parsecs?"
-            ).create();
-            System.out.println(message.getSid() + "--->" + message.getStatus().toString());
-        }catch (Exception e){
-            e.printStackTrace();
-        }
+//        String ACCOUNT_SID = "AC1fd05e898bd59d17ba72db621afca537";
+//        String AUTH_TOKEN = "7cee1a6cb0e2936a9037be577b1ffe57";
+//        try {
+//            Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
+//            Message message = Message.creator(
+//                    new PhoneNumber("+233570111999"),
+//                    new PhoneNumber("+16672740015"),
+//                    "This is the ship that made the Kessel Run in fourteen parsecs?"
+//            ).create();
+//            System.out.println(message.getSid() + "--->" + message.getStatus().toString());
+//        }catch (Exception e){
+//            e.printStackTrace();
+//        }
+
+
+
     }
 }

--
Gitblit v1.7.1