|
@@ -594,10 +594,24 @@ function __construct(){
|
|
|
}
|
|
}
|
|
|
else if(isset($res['error']))
|
|
else if(isset($res['error']))
|
|
|
{
|
|
{
|
|
|
|
|
+ // 如果是 license / 权限相关错误,发送钉钉告警
|
|
|
|
|
+ $errorMsg = $res['error']['message'] ?? '';
|
|
|
|
|
+ $errorCode = $res['error']['code'] ?? '';
|
|
|
|
|
+ if(
|
|
|
|
|
+ stripos($errorMsg, 'license') !== false ||
|
|
|
|
|
+ stripos($errorMsg, 'agreement') !== false ||
|
|
|
|
|
+ stripos($errorMsg, 'subscription') !== false ||
|
|
|
|
|
+ stripos($errorMsg, 'unauthorized') !== false ||
|
|
|
|
|
+ in_array($errorCode, ['401', '403', '40101', '40301'])
|
|
|
|
|
+ ){
|
|
|
|
|
+ $this->logic_ding->sendToDing("【USPS地址校验告警】License/权限异常 - code:{$errorCode} - msg:{$errorMsg}");
|
|
|
|
|
+ }
|
|
|
return json_encode(array('msg'=>$res['error']['message'],'success'=>false));exit;
|
|
return json_encode(array('msg'=>$res['error']['message'],'success'=>false));exit;
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
|
|
+ // 未知错误,发送告警便于排查
|
|
|
|
|
+ $this->logic_ding->sendToDing("【USPS地址校验告警】未知返回结构 - 原始响应:" . json_encode($res));
|
|
|
return json_encode(array('msg'=>'验证失败,请重试','success'=>false));exit;
|
|
return json_encode(array('msg'=>'验证失败,请重试','success'=>false));exit;
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|