新增发送短信log记录

This commit is contained in:
2023-03-23 15:14:53 +08:00
parent 7c9e3e8094
commit 01e2152ec2
5 changed files with 58 additions and 2 deletions
+11 -2
View File
@@ -4,6 +4,7 @@ namespace Extend\Alibaba;
use App\Constants\HttpEnumCode;
use App\Exception\BusinessException;
use App\Model\LogSms;
use App\Utils\Log;
use Darabonba\OpenApi\OpenApiClient;
use AlibabaCloud\OpenApiUtil\OpenApiUtilClient;
@@ -100,13 +101,21 @@ class Dysms
throw new BusinessException(HttpEnumCode::getMessage(HttpEnumCode::CODE_FAIL));
}
Log::getInstance()->info("发送短信日志:" . json_encode($result['body'],JSON_UNESCAPED_UNICODE));
if ($result['body']['Code'] != "OK"){
throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL);
if (isset($result['body']['MessageIm'])){
throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL);
}
throw new BusinessException("短信发送失败",HttpEnumCode::CODE_FAIL);
}
if (empty($result['body']['RequestId'])){
// 无唯一值
throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL);
if (isset($result['body']['MessageIm'])){
throw new BusinessException($result['body']['MessageIm'],HttpEnumCode::CODE_FAIL);
}
throw new BusinessException("短信发送失败",HttpEnumCode::CODE_FAIL);
}
// 记录log