文件
yjyf/server/application/common/library/WxPayException.php

70 行
1.7 KiB
PHP

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?php
namespace app\common\library;
/**
* 微信支付 APIv3 结构化业务与网关异常
*
* 用于向业务层准确传递微信错误码、HTTP 状态码、cURL 错误码、
* 是否属于“超时/状态不确定需先查单”类故障以及供管理员阅读的中文诊断原因。
*/
class WxPayException extends \RuntimeException
{
/** @var string 结构化错误码(如 NOT_ENOUGH / NO_AUTH / CURL_28 / HTTP_502) */
protected $wxCode = '';
/** @var int HTTP 响应状态码 */
protected $httpCode = 0;
/** @var int cURL 错误码 */
protected $curlErrno = 0;
/** @var bool 是否属于网络超时或网关 5xx 等“微信可能已受理”的不确定状态 */
protected $isUncertain = false;
/** @var string 脱敏后的原始网关细节 */
protected $rawDetail = '';
public function __construct(
$message,
$wxCode = '',
$httpCode = 0,
$curlErrno = 0,
$isUncertain = false,
$rawDetail = '',
?\Throwable $previous = null
) {
parent::__construct((string)$message, (int)($httpCode ?: $curlErrno), $previous);
$this->wxCode = (string)$wxCode;
$this->httpCode = (int)$httpCode;
$this->curlErrno = (int)$curlErrno;
$this->isUncertain = (bool)$isUncertain;
$this->rawDetail = (string)$rawDetail;
}
public function getWxCode()
{
return $this->wxCode;
}
public function getHttpCode()
{
return $this->httpCode;
}
public function getCurlErrno()
{
return $this->curlErrno;
}
public function isUncertain()
{
return $this->isUncertain;
}
public function getRawDetail()
{
return $this->rawDetail;
}
}