فهرست منبع

month pau check f

zz 5 سال پیش
والد
کامیت
71778791f0
2فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 11 2
      app/Console/Commands/CheckOrderStatus.php
  2. 1 1
      app/Console/Kernel.php

+ 11 - 2
app/Console/Commands/CheckOrderStatus.php

@@ -52,12 +52,21 @@ class CheckOrderStatus extends Command
         if($uid) {
             $this->checkOne($uid);
         }else{
-            $result = UserMonthSign::where('created_at','>=',date('Y-m-d H:i:s',time()-1800))->select('uid')->get();
-            if($result->isNotEmpty()){
+            $sql_format = 'SELECT uid FROM user_month_sign WHERE created_at >= DATE_ADD(NOW(),INTERVAL -1 hour) and 
+NOT EXISTS (SELECT id FROM user_month_order WHERE user_month_order.uid =user_month_sign.uid and created_at BETWEEN "%s" and "%s" )';
+            $sql = sprintf($sql_format,date('Y-m-01'),date('Y-m-01',strtotime('+1 month')));
+            $result = DB::select($sql);
+            if($result){
                 foreach ($result as $item){
                     $this->checkOne($item->uid);
                 }
             }
+            /*$result = UserMonthSign::where('created_at','>=',date('Y-m-d H:i:s',time()-1800))->select('uid')->get();
+            if($result->isNotEmpty()){
+                foreach ($result as $item){
+                    $this->checkOne($item->uid);
+                }
+            }*/
         }
     }
     public function checkOne($uid){

+ 1 - 1
app/Console/Kernel.php

@@ -40,6 +40,6 @@ class Kernel extends ConsoleKernel
 
         $schedule->command('book:update')->dailyAt('18:00');
 
-        $schedule->command('checkOrderStatus')->everyFiveMinutes();
+        $schedule->command('checkOrderStatus')->everyMinute();
     }
 }