完善报错提示

This commit is contained in:
qinzongqing 2023-04-18 15:31:29 +08:00
parent 1aaeb2cffe
commit 512aa9f404
2 changed files with 24 additions and 10 deletions

View File

@ -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;
}
//如果查询成功

View File

@ -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;
}
//如果生成成功