Browse Source

计划任务防堆积,防重复

lizhen_gitee 1 year ago
parent
commit
91b2695330

+ 2 - 2
app/Console/Commands/Plantaskaudio.php

@@ -55,13 +55,13 @@ class Plantaskaudio extends Command
             }
 
             //更新
-            $ids = array_column($list,'id');
+            /*$ids = array_column($list,'id');
 
             $update = [
                 'plantask_status' => 1,
             ];
 
-            DB::table('mt_user_match_audio_log')->whereIn('id',$ids)->update($update);
+            DB::table('mt_user_match_audio_log')->whereIn('id',$ids)->update($update);*/
         }
 
 

+ 2 - 2
app/Console/Commands/Plantaskgift.php

@@ -54,13 +54,13 @@ class Plantaskgift extends Command
             }
 
             //更新
-            $ids = array_column($list,'id');
+            /*$ids = array_column($list,'id');
 
             $update = [
                 'plantask_status' => 1,
             ];
 
-            DB::table('mt_gift_user_typing')->whereIn('id',$ids)->update($update);
+            DB::table('mt_gift_user_typing')->whereIn('id',$ids)->update($update);*/
         }
 
 

+ 2 - 2
app/Console/Commands/Plantaskrecharge.php

@@ -56,13 +56,13 @@ class Plantaskrecharge extends Command
             }
 
             //更新
-            $ids = array_column($list,'id');
+            /*$ids = array_column($list,'id');
 
             $update = [
                 'plantask_status' => 1,
             ];
 
-            DB::table('mt_pay_order')->whereIn('id',$ids)->update($update);
+            DB::table('mt_pay_order')->whereIn('id',$ids)->update($update);*/
         }
 
 

+ 2 - 2
app/Console/Commands/Plantasktyping.php

@@ -54,13 +54,13 @@ class Plantasktyping extends Command
             }
 
             //更新
-            $ids = array_column($list,'id');
+            /*$ids = array_column($list,'id');
 
             $update = [
                 'plantask_status' => 1,
             ];
 
-            DB::table('mt_user_match_typing_log')->whereIn('id',$ids)->update($update);
+            DB::table('mt_user_match_typing_log')->whereIn('id',$ids)->update($update);*/
         }
 
 

+ 2 - 2
app/Console/Commands/Plantaskvideo.php

@@ -55,13 +55,13 @@ class Plantaskvideo extends Command
             }
 
             //更新
-            $ids = array_column($list,'id');
+            /*$ids = array_column($list,'id');
 
             $update = [
                 'plantask_status' => 1,
             ];
 
-            DB::table('mt_user_match_video_log')->whereIn('id',$ids)->update($update);
+            DB::table('mt_user_match_video_log')->whereIn('id',$ids)->update($update);*/
         }
 
 

+ 11 - 1
app/Jobs/AudioJob.php

@@ -62,7 +62,7 @@ class AudioJob implements ShouldQueue
     public function goaaa(){
 
         //
-        $data = DB::table('mt_user_match_audio_log')->where('id',$this->msgid)->first();
+        $data = DB::table('mt_user_match_audio_log')->where('id',$this->msgid)->where('plantask_status',0)->first();
         if(empty($data)){return true;}
 
         DB::beginTransaction();
@@ -74,6 +74,16 @@ class AudioJob implements ShouldQueue
             return false;
         }
 
+        //
+        $update = [
+            'plantask_status' => 1,
+        ];
+        $rs_update = DB::table('mt_user_match_audio_log')->where('id',$this->msgid)->update($update);
+        if(!$rs_update){
+            Db::rollBack();
+            return false;
+        }
+
         DB::commit();
         return true;
     }

+ 11 - 1
app/Jobs/GiftJob.php

@@ -62,7 +62,7 @@ class GiftJob implements ShouldQueue
     public function goaaa(){
 
         //
-        $data = DB::table('mt_gift_user_typing')->where('id',$this->msgid)->first();
+        $data = DB::table('mt_gift_user_typing')->where('id',$this->msgid)->where('plantask_status',0)->first();
         if(empty($data)){return true;}
 
         DB::beginTransaction();
@@ -74,6 +74,16 @@ class GiftJob implements ShouldQueue
             return false;
         }
 
+        //
+        $update = [
+            'plantask_status' => 1,
+        ];
+        $rs_update = DB::table('mt_gift_user_typing')->where('id',$this->msgid)->update($update);
+        if(!$rs_update){
+            Db::rollBack();
+            return false;
+        }
+
         DB::commit();
         return true;
     }

+ 11 - 1
app/Jobs/RechargeJob.php

@@ -62,7 +62,7 @@ class RechargeJob implements ShouldQueue
     public function goaaa(){
 
         //
-        $data = DB::table('mt_pay_order')->where('id',$this->msgid)->first();
+        $data = DB::table('mt_pay_order')->where('id',$this->msgid)->where('plantask_status',0)->first();
         if(empty($data)){return true;}
 
         $args = json_decode($data->args,true);
@@ -80,6 +80,16 @@ class RechargeJob implements ShouldQueue
             return false;
         }
 
+        //
+        $update = [
+            'plantask_status' => 1,
+        ];
+        $rs_update = DB::table('mt_pay_order')->where('id',$this->msgid)->update($update);
+        if(!$rs_update){
+            Db::rollBack();
+            return false;
+        }
+
         DB::commit();
         return true;
     }

+ 11 - 1
app/Jobs/TypingJob.php

@@ -62,7 +62,7 @@ class TypingJob implements ShouldQueue
     public function goaaa(){
 
         //
-        $data = DB::table('mt_user_match_typing_log')->where('id',$this->msgid)->first();
+        $data = DB::table('mt_user_match_typing_log')->where('id',$this->msgid)->where('plantask_status',0)->first();
         if(empty($data)){return true;}
 
         DB::beginTransaction();
@@ -74,6 +74,16 @@ class TypingJob implements ShouldQueue
             return false;
         }
 
+        //
+        $update = [
+            'plantask_status' => 1,
+        ];
+        $rs_update = DB::table('mt_user_match_typing_log')->where('id',$this->msgid)->update($update);
+        if(!$rs_update){
+            Db::rollBack();
+            return false;
+        }
+
         DB::commit();
         return true;
     }

+ 11 - 1
app/Jobs/VideoJob.php

@@ -62,7 +62,7 @@ class VideoJob implements ShouldQueue
     public function goaaa(){
 
         //
-        $data = DB::table('mt_user_match_video_log')->where('id',$this->msgid)->first();
+        $data = DB::table('mt_user_match_video_log')->where('id',$this->msgid)->where('plantask_status',0)->first();
         if(empty($data)){return true;}
 
         DB::beginTransaction();
@@ -74,6 +74,16 @@ class VideoJob implements ShouldQueue
             return false;
         }
 
+        //
+        $update = [
+            'plantask_status' => 1,
+        ];
+        $rs_update = DB::table('mt_user_match_video_log')->where('id',$this->msgid)->update($update);
+        if(!$rs_update){
+            Db::rollBack();
+            return false;
+        }
+
         DB::commit();
         return true;
     }