wugg 2 years ago
parent
commit
559702647e
1 changed files with 5 additions and 5 deletions
  1. 5 5
      app/command/SplitSale.php

+ 5 - 5
app/command/SplitSale.php

@@ -26,7 +26,7 @@ class SplitSale extends Command
 
     protected function execute(Input $input, Output $output)
     {
-
+		$date=date("Y-m-d H:i:s");
         try {
 
             $key = 'split_sale_';
@@ -38,7 +38,6 @@ class SplitSale extends Command
             Cache::store('redis')->set($key, 1, 60 * 5);
 
             Db::startTrans();
-
             try {
 
                 $data = Db::name('sale')
@@ -190,6 +189,7 @@ class SplitSale extends Command
                     if ($this->cgd_insert) Db::name('cgd_caixiao')->insertAll($this->cgd_insert);
                     $this->cgd_insert=[];
                     $this->cgd_key=0;
+                    $output->writeln( "[$date] 订单{$sale['orderCode']}处理结束");
                 }
 
 //                if ($cgd_insert_tmp_data) Db::name('cgd_caixiao')->insertAll($cgd_insert_tmp_data);
@@ -197,17 +197,17 @@ class SplitSale extends Command
 
                 Db::commit();
 
-                $output->writeln(date('Y-m-d H:i:s') . '处理完成');
+                $output->writeln( "[$date] 订单处理结束");
 
             } catch (Exception $e) {
                 Db::rollback();
-                $output->writeln(date('Y-m-d H:i:s') . '事务回滚:' . $e->getMessage() . '||' . $e->getFile() . '||' . $e->getLine());
+                $output->writeln( "[$date] 事务回滚:" . $e->getMessage() . '||' . $e->getFile() . '||' . $e->getLine());
             }
 
             Cache::store('redis')->set($key, 0);
 
         } catch (Exception $exception) {
-            $output->writeln(date('Y-m-d H:i:s') . '脚本执行出错,' . $exception->getMessage() . '||' . $exception->getFile() . '||' . $exception->getLine());
+            $output->writeln( "[$date] 脚本执行出错:" . $exception->getMessage() . '||' . $exception->getFile() . '||' . $exception->getLine());
         }
 
     }