lvhao 6 ore fa
parent
commit
a7c08ed4c3
1 ha cambiato i file con 14 aggiunte e 0 eliminazioni
  1. 14 0
      core/CoreApp/models/Model_usps.php

+ 14 - 0
core/CoreApp/models/Model_usps.php

@@ -594,10 +594,24 @@ function __construct(){
 		}
 		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;
 		}
 		else
 		{
+			// 未知错误,发送告警便于排查
+			$this->logic_ding->sendToDing("【USPS地址校验告警】未知返回结构 - 原始响应:" . json_encode($res));
 			return json_encode(array('msg'=>'验证失败,请重试','success'=>false));exit;
 		}
 		/**