From 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 28 三月 2025 19:57:56 +0800 Subject: [PATCH] 修改bug --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java index d827a69..dd2dd32 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/SMSUtil.java @@ -1,6 +1,10 @@ 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; @@ -274,21 +278,29 @@ - @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"); + String url = "https://sms.nalosolutions.com/smsbackend/Resl_Nalo/send-message/"; + HttpRequest post = HttpUtil.createPost(url); + post.contentType(ContentType.JSON.toString()); + JSONObject params = new JSONObject(); + params.put("username", "I-GO"); + params.put("password", "9wBolBiXskCuzSf"); 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); + params.put("callback_url", "https://igo.i-go.group/user/base/sendCellulantMessageCallback"); + params.put("validity", 1); + post.body(params.toJSONString()); + System.err.println("短信请求:\n请求地址:" + url + "\n请求参数:" + params.toJSONString()); + HttpResponse execute = post.execute(); + String body = execute.body(); + execute.close(); + JSONObject jsonObject = JSON.parseObject(body); + System.err.println("短信响应:" + body); Integer status = jsonObject.getInteger("status"); - if(1701 == status){ + if(null != status && 1701 == status){ return true; }else{ return false; -- Gitblit v1.7.1