| 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]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|