فهرست منبع

切换医生接口

lizhen_gitee 6 ماه پیش
والد
کامیت
44e333efbe
2فایلهای تغییر یافته به همراه57 افزوده شده و 2 حذف شده
  1. 56 1
      application/api/controller/tvuser/Wenzhen.php
  2. 1 1
      application/extra/site.php

+ 56 - 1
application/api/controller/tvuser/Wenzhen.php

@@ -82,7 +82,7 @@ class Wenzhen extends Api
         ];
         $check_order = Db::name('wenzhen_order')->where($checkmap)->whereTime('createtime','month')->count();
         if($check_order >= $mouth_times){
-            //$this->error('您本月的免费问诊次数已用完');
+            $this->error('您本月的问诊次数已用完');
         }
 
         //问诊患者
@@ -99,6 +99,9 @@ class Wenzhen extends Api
         if($doctor_info['video_switch'] != 1){
             $this->error('该医生未开通视频问诊');
         }
+        if($doctor_info['video_model'] != 2){
+            $this->error('该医生未开通即时问诊');
+        }
         if($doctor_info['video_model'] == 2 && $doctor['job_status'] != 1){ //即时方式,需要在上班中
             $this->error('该医生现在不在上班中');
         }
@@ -296,9 +299,61 @@ class Wenzhen extends Api
         $this->success(1,$wenzhen_order);
     }
 
+    //换医生
+    public function change_doctor(){
+        //判断用户来源
+        if($this->auth->comefrom != 2){
+            $this->error('用户错误');
+        }
+
+        //医生信息
+        $doctor_id = input('doctor_id',0);
+        $doctor = Db::name('doctor')->where('id',$doctor_id)->find();
+        $doctor_info = Db::name('doctor_info')->where('doctor_id',$doctor_id)->find();
+        if(empty($doctor_info)){
+            $this->error('不存在的医生');
+        }
+
+        if($doctor_info['video_switch'] != 1){
+            $this->error('该医生未开通视频问诊');
+        }
+        if($doctor_info['video_model'] != 2){
+            $this->error('该医生未开通即时问诊');
+        }
+        if($doctor_info['video_model'] == 2 && $doctor['job_status'] != 1){ //即时方式,需要在上班中
+            $this->error('该医生现在不在上班中');
+        }
+
+        //订单信息
+        $order_id = input('order_id',0);
+        $wenzhen_order = Db::name('wenzhen_order')->where('user_id',$this->auth->id)->where('comefrom',2)->where('id',$order_id)->find();
+        if(empty($wenzhen_order)){
+            $this->error('不存在的订单');
+        }
+
+        if(!in_array($wenzhen_order['status'],[10])){
+            Db::rollback();
+            $this->error('当前订单不能换医生');
+        }
+
+        //修改订单
+        $update = [
+            'doctor_id' => $doctor_id,
+        ];
+
+        $update_rs = Db::name('wenzhen_order')->where('id',$order_id)->update($update);
+        if($update_rs === false){
+            $this->error('换医生失败');
+        }
+
+        $this->success('操作成功');
+    }
+
     //用户发起退珍
     //因为存在第三方,悲观锁
     public function tuizhen(){
+        $this->error('不允许取消');
+
         $apilimit = $this->apiLimit();
         if(!$apilimit){
             $this->error('操作频繁');

+ 1 - 1
application/extra/site.php

@@ -109,7 +109,7 @@ return array (
   'tv_family_qrcode' => '/uploads/20240709/b2fa02721dfab1e640abfee0575acd1a.png',
   'tv_family_bottom' => '微信扫码下载
 手机APP上传',
-  'tv_wenzhen_month_times' => '1',
+  'tv_wenzhen_month_times' => '3',
   'tv_family_top' => '微信扫码下载APP
 手机电视视频呼叫',
   'tv_firstvideo_videoorder_autofinish_minute' => '3',