jiangping
2024-02-01 f6b0e262db2af5ca2e5ed76f95e746c1dd3c58e3
server/service/src/main/java/com/doumee/service/business/third/EmayService.java
@@ -61,30 +61,32 @@
      return 0;
   }
   public   boolean sendSingleSms(String mobile,String content) throws SDKParamsException {
   public   boolean sendSingleSms(String mobile,String content)  {
      try {
         client = new SmsSDKClient(ip,port,appKey,appSecret);
      } catch (SDKParamsException e) {
         throw new RuntimeException(e);
      }
      if(client == null){
         return false;
      }
      String customSmsId = "1";
      String extendedCode = "01";
      SmsSingleRequest request = new SmsSingleRequest(mobile, content, customSmsId, extendedCode, "");
      ResultModel<SmsResponse> result = client.sendSingleSms(request);
      saveInterfaceLog(ip+"/"+port,"【短信】发送", JSONObject.toJSONString(result),JSONObject.toJSONString(result));
      if (result.getCode().equals("SUCCESS")) {
         System.out.println("请求成功");
         SmsResponse response = result.getResult();
         System.out.println("sendSingleSms:" + response.toString());
         return  true;
      } else {
         System.out.println("请求失败");
         return false;
         if(client == null){
            return false;
         }
         String customSmsId = "1";
         String extendedCode = "01";
         SmsSingleRequest request = new SmsSingleRequest(mobile, content, customSmsId, extendedCode, "");
         ResultModel<SmsResponse> result = client.sendSingleSms(request);
         saveInterfaceLog(ip+"/"+port,"【短信】发送", JSONObject.toJSONString(result),JSONObject.toJSONString(result));
         if (result.getCode().equals("SUCCESS")) {
            System.out.println("请求成功");
            SmsResponse response = result.getResult();
            System.out.println("sendSingleSms:" + response.toString());
            return  true;
         } else {
            System.out.println("请求失败");
            return false;
         }
      } catch (Exception e) {
      }
      return false;
   }