Преглед изворни кода

视频问诊即时模式,退款

lizhen_gitee пре 6 месеци
родитељ
комит
be1bff96d3

+ 1 - 0
application/api/controller/Index.php

@@ -153,6 +153,7 @@ class Index extends Api
                 'ordertype' => 2,
                 'status'    => ['IN','10,20,25,30'],//有效订单
                 'book_time'=> ['gt',time()],
+                'video_model' => 1, //预约模式
             ];
             $order_booked = Db::name('wenzhen_order')->where($map)->group('book_time')->column('book_time,count(id) as count_number');
             if(!empty($order_booked)){

+ 2 - 2
application/api/controller/Notify.php

@@ -98,7 +98,7 @@ class Notify extends Api
         return true;
     }
 
-    //充值金币 异步回调对外方法
+    //问诊订单 异步回调对外方法
     public function wenzhen_notify_base(){
 
         //验签
@@ -143,7 +143,7 @@ class Notify extends Api
         exit;
     }
 
-    //充值金币 逻辑
+    //问诊订单 逻辑
     private function wenzhen_notify_do($out_trade_no){
 
         Db::startTrans();

+ 18 - 8
application/api/controller/Wenzhen.php

@@ -100,6 +100,7 @@ class Wenzhen extends Api
                     'book_time' => $book_time,
                     'ordertype' => 2,
                     'status'    => ['IN','10,20,25,30'],//有效订单
+                    'video_model' => 1,//预约模式
                 ];
                 $order_count = Db::name('wenzhen_order')->where($map)->count();
                 if($order_count >= 4){
@@ -538,16 +539,25 @@ class Wenzhen extends Api
             $this->error('图文问诊不能退诊');
         }
 
+        //下面全是视频订单
         //状态限制
-        if(!in_array($wenzhen_order['status'],[10,20])){
-            Db::rollback();
-            $this->error('当前订单不能退诊');
-        }
+        if($wenzhen_order['video_model'] == 1){
+            if(!in_array($wenzhen_order['status'],[10,20])){
+                Db::rollback();
+                $this->error('当前订单不能退诊');
+            }
 
-        //超过支付时间一小时不能退
-        if( time() - $wenzhen_order['pay_time'] > 3600){
-            Db::rollback();
-            $this->error('支付超过一小时,不能退诊');
+            //超过支付时间一小时不能退
+            if( time() - $wenzhen_order['pay_time'] > 3600){
+                Db::rollback();
+                $this->error('支付超过一小时,不能退诊');
+            }
+        }else{
+            //即时模式,已付款没接的能退
+            if(!in_array($wenzhen_order['status'],[10])){
+                Db::rollback();
+                $this->error('当前订单不能退诊');
+            }
         }
 
         //修改订单