kevin_zhangl hace 2 años
padre
commit
17ba8d600f

+ 4 - 0
common/helpers/Alarm.php

@@ -19,6 +19,10 @@ class Alarm
         $reportAlarmOpen = Cache::getSystemConfig()['reportAlarmOpen']['VALUE'];
         // 业务平台token
         $message['platform-id'] = \Yii::$app->params['alarmAccessToken'];
+        // 级别
+        $message['stance'] = $message['stance'] ?? 2;
+        // 类型
+        $message['brand'] = $message['brand'] ?? 'OTA';
         // 日志入库
         Tool::alarmCall($message);
         // 日志写文件

+ 2 - 0
common/helpers/Tool.php

@@ -578,6 +578,8 @@ class Tool {
     {
         try {
             $model = new AlarmCall();
+            $model->brand = $call['brand'];
+            $model->stance = $call['stance'];
             $model->trace_id = $call['trace-id'];
             $model->content = $call;
             $model->insert();

+ 2 - 1
common/models/AlarmCall.php

@@ -12,7 +12,8 @@ use yii\base\InvalidConfigException;
  * @property \MongoDB\BSON\ObjectID|string $_id
  * @property string $trace_id 堆栈ID
  * @property mixed $content 内容
-
+ * @property string $brand 类型
+ * @property string $stance 级别
  */
 class AlarmCall extends MongoActiveRecord
 {

+ 2 - 0
vendor/yiisoft/yii2/web/ErrorHandler.php

@@ -155,6 +155,8 @@ class ErrorHandler extends \yii\base\ErrorHandler
         foreach ($errorOutline as $item) {
             if (false !== strpos($exception->getMessage(), $item)) {
                 $it = [
+                    'stance' => 4,
+                    'brand' => in_array($item, ['AR_', 'SQLSTATE']) ? 'SQL' : 'API',
                     'name' => ($exception instanceof Exception || $exception instanceof ErrorException) ? $exception->getName() : 'Exception',
                     'message' => '(NG)提醒:' . $exception->getMessage(),
                     'code' => $exception->getCode(),