Kaynağa Gözat

若干优化

兔姬桑 3 yıl önce
ebeveyn
işleme
b329613a8a

+ 12 - 2
app/Channels/iYuuChannel.php

@@ -9,12 +9,22 @@ use Log;
 
 class iYuuChannel
 {
+    private $token;
+
+    public function __construct()
+    {
+        $this->token = sysConfig('iYuu_token');
+
+        if ($this->token) {
+            Log::critical('[爱语飞飞] TOKEN 为空');
+        }
+    }
+
     public function send($notifiable, Notification $notification)
     {
         $message = $notification->toCustom($notifiable);
 
-        $response = Http::timeout(15)
-            ->post('https://iyuu.cn/'.sysConfig('iYuu_token').'.send?title='.urlencode($message['title']).'&desp='.urlencode($message['content']));
+        $response = Http::timeout(15)->post('https://iyuu.cn/'.$this->token.'.send?title='.urlencode($message['title']).'&desp='.urlencode($message['content']));
 
         // 发送成功
         if ($response->ok()) {

+ 1 - 1
app/Notifications/PaymentReceived.php

@@ -46,7 +46,7 @@ class PaymentReceived extends Notification implements ShouldQueue
     public function toTelegram($notifiable)
     {
         $message = sprintf(
-            "💰成功收款%s\n———————————————\n订单号:%s",
+            "💰成功收款¥ %s\n———————————————\n订单号:%s",
             $this->amount,
             $this->sn
         );

+ 3 - 1
app/Observers/NodeObserver.php

@@ -42,7 +42,9 @@ class NodeObserver
             $changes = $node->getChanges();
             if (Arr::hasAny($changes, ['ip', 'ipv6', 'server'])) { // DDNS操作
                 if (Arr::exists($changes, 'server')) { // 域名变动
-                    DDNS::destroy($node->getOriginal('server')); // 删除原域名
+                    if ($node->getOriginal('server')) {
+                        DDNS::destroy($node->getOriginal('server')); // 删除原域名
+                    }
                     if ($node->ip) { // 添加IPV4至新域名
                         foreach ($node->ips() as $ip) {
                             DDNS::store($node->server, $ip);

+ 2 - 2
app/helpers.php

@@ -88,9 +88,9 @@ if (! function_exists('filterEmoji')) {
 
 // 获取系统设置
 if (! function_exists('sysConfig')) {
-    function sysConfig($name)
+    function sysConfig($key = false)
     {
-        return config('settings.'.$name);
+        return $key ? config('settings.'.$key) : config('settings');
     }
 }