| xqd
@@ -2,7 +2,10 @@
|
|
|
|
|
|
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
|
|
|
{
|
| xqd
@@ -37,6 +40,40 @@ class overTimeOrder extends Command
|
|
|
*/
|
|
|
public function handle()
|
|
|
{
|
|
|
- echo '超时命令';
|
|
|
+ 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]);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|