LD %!s(int64=5) %!d(string=hai) anos
pai
achega
c1359860d8

+ 11 - 14
LogExpireDelete.php → app/Console/Commands/FluxOrderFix.php

@@ -2,26 +2,26 @@
 
 namespace App\Console\Commands;
 
+use App\Http\Controllers\Controller;
+use App\OracleDOCOrderHeader;
 use Carbon\Carbon;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Date;
-use Illuminate\Support\Facades\DB;
 
-class LogExpireDelete extends Command
+class FluxOrderFix extends Command
 {
     /**
      * The name and signature of the console command.
      *
      * @var string
      */
-    protected $signature = 'LogExpireDelete';
+    protected $signature = 'FluxOrderFix';
 
     /**
      * The console command description.
      *
      * @var string
      */
-    protected $description = 'LogExpireDelete';
+    protected $description = 'FluxOrderFix';
 
     /**
      * Create a new command instance.
@@ -40,16 +40,13 @@ class LogExpireDelete extends Command
      */
     public function handle()
     {
-        $this->deleteLog();
+        $this->fixEdisendflagAtWrong();
     }
 
-    public function deleteLog(){
-        //前一天
-//        $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()],
-        ]);
-
+    public function fixEdisendflagAtWrong(){
+        OracleDOCOrderHeader::where('edisendflag','W')->whereNotNull('edisendtime')->where('edisendtime','>',Carbon::now()->subDays(2))
+            ->update(['edisendflag'=>'N','manualflag'=>'N',
+//                'edisendtime'=>null
+            ]);
     }
 }

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

@@ -2,9 +2,9 @@
 
 namespace App\Console\Commands;
 
+use App\Http\Controllers\Controller;
 use Carbon\Carbon;
 use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Date;
 use Illuminate\Support\Facades\DB;
 
 class LogExpireDelete extends Command
@@ -44,8 +44,7 @@ class LogExpireDelete extends Command
     }
 
     public function deleteLog(){
-        //前150天
-        $expire_duration=config('logging.expire_duration');
+        $expire_duration=config('logging.expire_duration');//前150天
         $date=Carbon::now()->subDays($expire_duration)->format('Y-m-d');
         DB::table('logs')->where('created_at','like',$date.'%')->delete();
     }

+ 2 - 0
app/Console/Kernel.php

@@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
      */
     protected $commands = [
         \App\Console\Commands\LogExpireDelete::class,
+        \App\Console\Commands\FluxOrderFix::class,
     ];
 
     /**
@@ -27,6 +28,7 @@ class Kernel extends ConsoleKernel
     protected function schedule(Schedule $schedule)
     {
         $schedule->command('LogExpireDelete')->dailyAt('00:01');
+        $schedule->command('FluxOrderFix')->hourlyAt(6);
     }
 
     /**

+ 6 - 1
app/Http/Controllers/TestController.php

@@ -108,7 +108,12 @@ class TestController extends Controller
 
     function t1(Request $request)
     {
-
+        dd(OracleDOCOrderHeader::select('addtime')->where('edisendflag','W')->where('edisendtime','>',Carbon::now()->subWeek())
+            ->orderBy('edisendtime','desc')
+            ->get()->
+        map(function($order){
+            return $order['addtime'];
+        }));
 
     }