| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -53,14 +53,14 @@ class OrderTimeout extends Command | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->whereNotNull('timeout') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								->min('id');*/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$min_id = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							$current_id = 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    	while (true) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								Order::with('orderProductItem') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					//				->where('id', '>=', $min_id)
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->whereIn('status', $status_arr) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->whereNotNull('timeout') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->orderBy('id') | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->chunk(100, function ($order) use (&$min_id) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									->chunk(100, function ($order) use (&$current_id) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										foreach ($order as $v) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
											if (!is_null($v->timeout) && strtotime($v->timeout) < time()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												DB::beginTransaction(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -102,7 +102,7 @@ class OrderTimeout extends Command | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													DB::commit(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													$min_id = $v->id; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													$current_id = $v->id; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
												} catch (\Exception $exception) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													DB::rollBack(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
													$this->line("订单ID {$v->id} 错误:" . $exception->getMessage()); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -111,9 +111,7 @@ class OrderTimeout extends Command | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
										} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
									}); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								//TODO 产品规格表加库存
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								$this->line('[' . date('Y-m-d H:i:s') . "] ID游标:$min_id ,等待下一个任务"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								$this->line('[' . date('Y-m-d H:i:s') . "] ID游标:$current_id ,等待下一个任务"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								sleep(5); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							} | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							return 0; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |