From 512aa9f4043d17996c22e10e82cd073a9e98a327 Mon Sep 17 00:00:00 2001 From: qinzongqing Date: Tue, 18 Apr 2023 15:31:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8A=A5=E9=94=99=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/SmsController.php | 28 +++++++++++++++++++++------- app/controllers/UrlsController.php | 6 +++--- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/app/controllers/SmsController.php b/app/controllers/SmsController.php index 5329158..d3ecbb3 100644 --- a/app/controllers/SmsController.php +++ b/app/controllers/SmsController.php @@ -127,8 +127,8 @@ class SmsController extends ControllerBase{ $array = $this->__change_xml_to_array($xml); //获取发送结果提示 $string = !empty($array[0])?$array[0]:""; - //如果发送失败 - if(!(strpos(strtolower($xml), "ok")!==false)){ + //如果发送失败,但有明确错误说明 + if(strpos(strtolower($xml), "error")!==false){ //告知用户"发送失败,err detail:短信发送失败:".$string //ERROR:200:[非手机号码] //ERROR:108:[FormatID 非法数值] @@ -136,6 +136,13 @@ class SmsController extends ControllerBase{ $rs['errcode'] = 70000; $rs['data'] = null; } + //如果发送失败,且无明确错误说明 + elseif(!(strpos(strtolower($xml), "ok")!==false)){ + //告知用户"服务器异常,err detail:发送短信失败,具体请查看sms日志" + $rs['errmsg'] = "服务器异常,err detail:发送短信失败,具体请查看sms日志"; + $rs['errcode'] = 50000; + $rs['data'] = null; + } //如果发送成功 else{ //获取messageid @@ -317,8 +324,8 @@ class SmsController extends ControllerBase{ $array = $this->__change_xml_to_array($xml); //获取发送结果提示 $string = !empty($array[0])?$array[0]:""; - //如果发送失败 - if(!(strpos(strtolower($xml), "ok")!==false)){ + //如果发送失败,但有明确错误说明 + if(strpos(strtolower($xml), "error")!==false){ //告知用户"发送失败,err detail:短信发送失败:".$string //ERROR:200:[非手机号码] //ERROR:108:[FormatID 非法数值] @@ -326,6 +333,13 @@ class SmsController extends ControllerBase{ $rs['errcode'] = 70000; $rs['data'] = null; } + //如果发送失败,且无明确错误说明 + elseif(!(strpos(strtolower($xml), "ok")!==false)){ + //告知用户"服务器异常,err detail:发送短信失败,具体请查看sms日志" + $rs['errmsg'] = "服务器异常,err detail:发送短信失败,具体请查看sms日志"; + $rs['errcode'] = 50000; + $rs['data'] = null; + } //如果发送成功 else{ //如果不是重发上一个验证码 @@ -425,9 +439,9 @@ class SmsController extends ControllerBase{ $string = !empty($array[0])?$array[0]:""; //如果查询失败 if(!isset($array['@attributes'])){ - //告知用户"系统繁忙,请稍候再试" - $rs['errcode'] = -1; - $rs['errmsg'] = "系统繁忙,请稍候再试"; + //告知用户"服务器异常,err detail:获取报告失败" + $rs['errmsg'] = "服务器异常,err detail:获取报告失败"; + $rs['errcode'] = 50000; $rs['data'] = null; } //如果查询成功 diff --git a/app/controllers/UrlsController.php b/app/controllers/UrlsController.php index 39027cb..6386f8c 100644 --- a/app/controllers/UrlsController.php +++ b/app/controllers/UrlsController.php @@ -82,9 +82,9 @@ class UrlsController extends ControllerBase{ $array = json_decode($json, true); //如果生成失败 if(!(strpos(strtolower($json), "ok")!==false)){ - //告知用户"系统繁忙,请稍候再试" - $rs['errmsg'] = "系统繁忙,请稍候再试"; - $rs['errcode'] = -1; + //告知用户"服务器异常,err detail:短链转换失败" + $rs['errmsg'] = "服务器异常,err detail:短链转换失败"; + $rs['errcode'] = 50000; $rs['data'] = null; } //如果生成成功