gq 7 лет назад
Родитель
Сommit
f0383481f2

+ 42 - 0
server/app/Console/Commands/DreamDJS.php

xqd
@@ -0,0 +1,42 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+
+class DreamDJS extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'DreamDJS';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        //执行逻辑
+    }
+}

+ 3 - 1
server/app/Console/Kernel.php

xqd xqd
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
      * @var array
      */
     protected $commands = [
-        //
+        \App\Console\Commands\DreamDJS::class,
     ];
 
     /**
@@ -26,6 +26,8 @@ class Kernel extends ConsoleKernel
     {
         // $schedule->command('inspire')
         //          ->hourly();
+        $schedule->command('DreamDJS')
+            ->everyMinute();
     }
 
     /**

+ 1 - 1
server/app/Http/Controllers/Api/V1/MyController.php

xqd
@@ -288,7 +288,7 @@ class MyController extends Controller
     public function letter()
     {
         $user = $this->getUser();
-        $data  =  SystemInfoModel::where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
+        $data  =  SystemInfoModel::with('user')->where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
         foreach ($data as $item){   //访问接口  标记已读
             $item->update(['is_read'=>1]);
         }