Ver código fonte

定时器修改

wanghaijun 4 anos atrás
pai
commit
b48ebb60c5
1 arquivos alterados com 31 adições e 3 exclusões
  1. 31 3
      app/Console/Commands/overTimeOrder.php

+ 31 - 3
app/Console/Commands/overTimeOrder.php

xqd xqd xqd
@@ -43,7 +43,7 @@ class overTimeOrder extends Command
     public function handle()
     {
         $type = $this->argument('type');
-        if(!in_array($type,['orderOut','appiontOut','thenOut','thenLose','orderCancel'])){
+        if(!in_array($type,['orderOut','appiontOut','thenOut','thenLose','orderCancel','orderComplete','todayReminder'])){
             dd('请输入正确的参数');
         }
         if($type == 'orderOut'){
@@ -177,12 +177,13 @@ class overTimeOrder extends Command
             if ($v['product_type']==1){
                 if ((time()-$v['receiving_time'])>=$config_chat){
                     $catNewIds[$k] = $v['id'];
-                    $patient->ReceivingReminderOK($v['id']);
+                    $this->ReceivingReminderOK($v['id']);
                 }
             }else if($v['product_type']==2){
                 if ((time()-$v['receiving_time'])>=$config_phone){
                     $catNewIds[$k] = $v['id'];
-                    $patient->ReceivingReminderOK($v['id']);
+                    $this->ReceivingReminderOK($v['id']);
+
                 }
             }
 
@@ -296,4 +297,31 @@ class overTimeOrder extends Command
         ];
         $res = send_wechatSubscription_message('cancel_reminder',$msgArr);
     }
+
+    /**
+     * 完成订单
+     * @param $order_id
+     */
+    public function ReceivingReminderOK($order_id){
+        $Order = Order::with(['orderPatient','user'])->where(['id'=>$order_id])->first();
+        $type = '';
+        if ($Order['product_type']==1){
+            $type = '电话咨询已结束';
+        }elseif ($Order['product_type']==2){
+            $type = '图文咨询已结束 ';
+        }elseif ($Order['product_type']==3){
+            $type = '门诊预约';
+        }
+        if ($Order){
+            if ($Order['user']['openid']){
+                $send = send_wechatSubscription_message('receiving_reminderok',[
+                    $Order['user']['openid'],
+                    "pages/index",
+                    $Order['order_sn'],
+                    $type,
+                    $Order['payment_amount'],
+                ],'wechat_small_program');
+            }
+        }
+    }
 }