Преглед на файлове

Merge branch 'master' of ssh://git.9026.com:2212/swdz-WangHaijun/BaoMa

zilong преди 4 години
родител
ревизия
6ce0c14cf9
променени са 2 файла, в които са добавени 81 реда и са изтрити 0 реда
  1. 79 0
      app/Console/Commands/overTimeOrder.php
  2. 2 0
      app/Console/Kernel.php

+ 79 - 0
app/Console/Commands/overTimeOrder.php

xqd
@@ -0,0 +1,79 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Models\Order;
+use App\Models\SystemConfig;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Log;
+
+class overTimeOrder extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'overOrder';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = '超时';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        Log::info('超时命令'.date('Y-m-d H:is',time()).PHP_EOL);
+        return ;
+        $config_chat =  SystemConfig::get('docter_config','chat_complete_time');
+        $config_phone =  SystemConfig::get('docter_config','phone_complete_time');
+
+        // 换算为秒
+        $config_chat = $config_chat*60;
+        $config_phone = $config_phone*60;
+
+        $inOrder = Order::with('orderPatient')->where(['order_status'=>3,'payment_status'=>2])->get();
+        $catNewIds = [];
+        $menNewIds = [];
+        foreach ($inOrder as $k=>$v){
+            if ($v['product_type']==1){
+                if ((time()-$v['receiving_time'])>=$config_chat){
+                    $catNewIds[$k] = $v['id'];
+                }
+            }else if($v['product_type']==2){
+                if ((time()-$v['receiving_time'])>=$config_phone){
+                    $catNewIds[$k] = $v['id'];
+                }
+            }else if($v['product_type']==3){
+                if ((time()-$v['receiving_time'])>=(1*60*60*24)){
+                    $menNewIds[$k] = $v['id'];
+                }
+            }
+
+        }
+        if ($catNewIds || $menNewIds){
+            // 操作图文和电话订单为已完成
+            Order::whereIn('id',$catNewIds)->update(['order_status'=>4]);
+            // 操作门诊订单为已超时
+            Order::whereIn('id',$menNewIds)->update(['order_status'=>6]);
+        }
+
+    }
+}

+ 2 - 0
app/Console/Kernel.php

xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Console;
 
+use App\Console\Commands\overTimeOrder;
 use Illuminate\Console\Scheduling\Schedule;
 use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
 
@@ -14,6 +15,7 @@ class Kernel extends ConsoleKernel
      */
     protected $commands = [
         //
+        'overOrder'=>overTimeOrder::class,
     ];
 
     /**