浏览代码

WAS日志服务测试

haozi 5 年之前
父节点
当前提交
e37ee6a708
共有 1 个文件被更改,包括 7 次插入2 次删除
  1. 7 2
      app/Console/Commands/LogExpireDelete.php

+ 7 - 2
app/Console/Commands/LogExpireDelete.php

@@ -4,6 +4,7 @@ namespace App\Console\Commands;
 
 use Carbon\Carbon;
 use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Date;
 use Illuminate\Support\Facades\DB;
 
 class LogExpireDelete extends Command
@@ -44,7 +45,11 @@ class LogExpireDelete extends Command
 
     public function deleteLog(){
         //前一天
-        $date=Carbon::now()->subDays(150)->format('Y-m-d');
-        DB::table('logs')->where('created_at','like',$date.'%')->delete();
+//        $date=Carbon::now()->subDays(150)->format('Y-m-d');
+//        DB::table('logs')->where('created_at','like',$date.'%')->delete();
+        DB::table('logs')->insert([
+            ['operation' => 'App', 'type' => 'test','created_at'=>new Date()],
+        ]);
+
     }
 }