Forráskód Böngészése

获取新期号增加日志

seven 1 hete
szülő
commit
877af7354d
2 módosított fájl, 11 hozzáadás és 4 törlés
  1. 5 4
      app/Services/IssueService.php
  2. 6 0
      config/logging.php

+ 5 - 4
app/Services/IssueService.php

@@ -855,13 +855,14 @@ class IssueService extends BaseService
     }
 
 // 获取最新的开奖数据
-    public
-    static function getLatestIssue()
+    public static function getLatestIssue()
     {
+        Log::channel('issue')->info('开始获取最新期号');
         $url = "https://ydpc28.co/api/pc28/list";
         $result = file_get_contents($url);
         $result = json_decode($result, true);
         if ($result['errorCode'] != 0) {
+            Log::channel('issue')->info('获取最新期号失败');
             return ['code' => self::NOT, 'msg' => '获取最新期号失败'];
 
         }
@@ -915,7 +916,7 @@ class IssueService extends BaseService
 
             // 不存在
             if (!$newInfo) {
-
+                Log::channel('issue')->info('新增期号: ' . $new_issue_no);
                 $res = self::submit([
                     'issue_no' => $new_issue_no,
                     'status' => self::model()::STATUS_DRAFT,
@@ -934,7 +935,7 @@ class IssueService extends BaseService
                 Cache::set('new_issue_no', $new_issue_no, 10); // 缓存
             }
         }
-        var_dump($new);
+        
         return $result;
     }
 

+ 6 - 0
config/logging.php

@@ -135,6 +135,12 @@ return [
             'path' => storage_path('logs/wallet.log'),
             'level' => 'info',
         ],
+        'issue' => [
+            'driver' => 'daily',  // 改为 daily
+            'path' => storage_path('logs/issue.log'),
+            'level' => 'info',
+            'days' => 14,  // 可选,保留最近14天的日志
+        ],
         'dblog' => [
             'driver' => 'single',
             'path' => storage_path('logs/dblog.log'),