兔姬桑 4 years ago
parent
commit
efb39dfbbc
2 changed files with 5 additions and 4 deletions
  1. 3 2
      app/Components/Helpers.php
  2. 2 2
      app/Components/PushNotification.php

+ 3 - 2
app/Components/Helpers.php

@@ -169,18 +169,19 @@ class Helpers
      * @param  string  $content  内容
      * @param  int  $type  发送类型
      * @param  string  $address  收信方
+     * @param  int  $status  投递状态
      * @param  string  $error  投递失败时记录的异常信息
      *
      * @return int
      */
-    public static function addNotificationLog(string $title, string $content, int $type, $address = 'admin', $error = ''): int
+    public static function addNotificationLog(string $title, string $content, int $type, $address = 'admin', $status = 1, $error = ''): int
     {
         $log = new NotificationLog();
         $log->type = $type;
         $log->address = $address;
         $log->title = $title;
         $log->content = $content;
-        $log->status = 0;
+        $log->status = $status;
         $log->error = $error;
         $log->save();
 

+ 2 - 2
app/Components/PushNotification.php

@@ -55,7 +55,7 @@ class PushNotification
                 return $message;
             }
             // 发送失败
-            Helpers::addNotificationLog($title, $content, 2, 'admin', $message ? $message['errmsg'] : '未知');
+            Helpers::addNotificationLog($title, $content, 2, 'admin', -1, $message ? $message['errmsg'] : '未知');
 
             return false;
         }
@@ -86,7 +86,7 @@ class PushNotification
                 return $message;
             }
             // 发送失败
-            Helpers::addNotificationLog($title, $content, 3, 'admin', $message);
+            Helpers::addNotificationLog($title, $content, 3, 'admin', -1, $message);
 
             return false;
         }