Browse Source

下单0元问诊订单

lizhen_gitee 6 months ago
parent
commit
80bdffba2a
1 changed files with 13 additions and 6 deletions
  1. 13 6
      application/api/controller/Wenzhen.php

+ 13 - 6
application/api/controller/Wenzhen.php

@@ -71,9 +71,9 @@ class Wenzhen extends Api
             }
             $price = $doctor_info['video_price'];
         }
-        if($price <= 0){
+        /*if($price <= 0){
             $this->error('问诊价格为零');
-        }
+        }*/
 
         //排班判断
         if($ordertype == 1){
@@ -175,16 +175,23 @@ class Wenzhen extends Api
             $this->error('该订单不能支付');
         }
 
+        //如果订单是0元,医生设置免费0元,自动改成pay_type=wallet
+        if($wenzhen_order['total_fee'] == 0){
+            $pay_type = 'wallet';
+        }
+
 
         if($pay_type == 'wallet'){
             Db::startTrans();
 
             //用户扣钱
             $logtype = $wenzhen_order['ordertype'] == 1 ? 11 : 12;
-            $rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,'money',-$wenzhen_order['total_fee'],$logtype,'图文问诊'.$wenzhen_order['order_no'],'wenzhen_order',$order_id);
-            if($rs_wallet['status'] == false){
-                Db::rollback();
-                $this->error($rs_wallet['msg']);
+            if($wenzhen_order['total_fee'] > 0){
+                $rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,'money',-$wenzhen_order['total_fee'],$logtype,'图文问诊'.$wenzhen_order['order_no'],'wenzhen_order',$order_id);
+                if($rs_wallet['status'] == false){
+                    Db::rollback();
+                    $this->error($rs_wallet['msg']);
+                }
             }
 
             //订单改为已支付