Explorar el Código

电视盒子要有自己的变量

lizhen_gitee hace 9 meses
padre
commit
ad82864934

+ 7 - 3
application/api/controller/Wenzhen.php

@@ -265,7 +265,7 @@ class Wenzhen extends Api
         }
 
         $field = [
-            'order.id','order.order_no','order.createtime','order.status','order.ordertype','order.accept_time','order.video_time','order.doctor_id','order.cancel_reason',
+            'order.id','order.order_no','order.createtime','order.status','order.ordertype','order.accept_time','order.video_time','order.doctor_id','order.cancel_reason','order.comefrom',
             'doctor.avatar as doctor_avatar','doctor.nickname as doctor_nickname',
         ];
         $list = Db::name('wenzhen_order')->alias('order')
@@ -334,7 +334,7 @@ class Wenzhen extends Api
 
 
         //图文订单接诊后N分钟自动结束
-        if($val['status'] == 20){
+        if($val['status'] == 20 && $val['ordertype'] == 1){
             $remain_time = $val['accept_time'] + (config('site.accept_textorder_autofinish_minute')*60) - time();
             if($remain_time > 0){
                 $status_data_val['minute'] = Sec2Time($remain_time);
@@ -345,7 +345,11 @@ class Wenzhen extends Api
 
         //视频订单接通后N分钟自动结束
         if($val['status'] == 25 && $val['ordertype'] == 2){
-            $remain_time = $val['video_time'] + (config('site.accept_videoorder_autofinish_minute')*60) - time();
+            $minute = config('site.firstvideo_videoorder_autofinish_minute');
+            if($val['comefrom'] == 2){
+                $minute = config('site.tv_firstvideo_videoorder_autofinish_minute');
+            }
+            $remain_time = $val['video_time'] + ($minute*60) - time();
             if($remain_time > 0){
                 $status_data_val['minute'] = Sec2Time($remain_time);
                 $status_data_val['minute_en'] = Sec2Time_en($remain_time);

+ 8 - 7
application/api/controller/tvuser/Wenzhen.php

@@ -33,19 +33,19 @@ class Wenzhen extends Api
         return $data;
     }
 
-    //判断是否 健康E家自己的vip
+    //判断是否 移动融合包的vip
     private function checkvip(){
-        $is_my_vip = 0;
+        $is_vip = 0;
 
         $tv_userid = $this->auth->tv_userid;
 
         //跨数据库查询
         $tv_user = Db::connect('database_tv')->name('hu_user')->where('id',$tv_userid)->find();
         if(!empty($tv_user)){
-            $is_my_vip = $tv_user['is_my_vip'];
+            $is_vip = $tv_user['is_vip'];
         }
 
-        return $is_my_vip;
+        return $is_vip;
     }
 
     //创建订单
@@ -59,17 +59,18 @@ class Wenzhen extends Api
         //判断是否 健康E家自己的vip
         $checkvip = $this->checkvip();
         if(!$checkvip){
-            $this->error('您不是健康E家的VIP用户');
+            $this->error('您不是VIP用户','',402);
         }
 
         //检查本月是否已经下过一个有效单了
+        $mouth_times = config('site.tv_wenzhen_month_times');
         $checkmap = [
             'user_id' => $this->auth->id,
             'comefrom'=> 2,
             'status'  => ['IN','10,20,25,30'],//有效订单
         ];
-        $check_order = Db::name('wenzhen_order')->where($checkmap)->whereTime('createtime','month')->find();
-        if(!empty($check_order)){
+        $check_order = Db::name('wenzhen_order')->where($checkmap)->whereTime('createtime','month')->count();
+        if($check_order >= $mouth_times){
             $this->error('您本月的免费问诊次数已用完');
         }
 

+ 2 - 0
application/extra/site.php

@@ -111,4 +111,6 @@ return array (
   'tv_family_qrcode' => '/uploads/20240606/7538020e10cc8d35c3757b789d38e4e0.png',
   'tv_family_bottom' => '微信扫码下载
 小屏上传图片',
+  'tv_wenzhen_month_times' => '1',
+  'tv_firstvideo_videoorder_autofinish_minute' => '3',
 );

+ 16 - 2
application/index/controller/Plantask.php

@@ -93,13 +93,27 @@ class Plantask extends Controller
 
     }
 
-    //视频订单,已拨打,通话N分钟后,自动结束
+    //app视频订单,已拨打,通话N分钟后,自动结束
     public function auto_finish_firstvideo_videoorder(){
         $nowtime  = time();
         $second   = config('site.firstvideo_videoorder_autofinish_minute') * 60;
         $lasttime = $nowtime - $second;
 
-        $rs = Db::name('wenzhen_order')->where('status',25)->where('ordertype',2)->where('video_time','lt',$lasttime)->update([
+        $rs = Db::name('wenzhen_order')->where('status',25)->where('ordertype',2)->where('comefrom',1)->where('video_time','lt',$lasttime)->update([
+            'status'        => 30,
+            'finish_time'   => $nowtime,
+        ]);
+
+        echo $rs;
+    }
+
+    //TV视频订单,已拨打,通话N分钟后,自动结束
+    public function auto_finish_firstvideo_videoorder_tv(){
+        $nowtime  = time();
+        $second   = config('site.tv_firstvideo_videoorder_autofinish_minute') * 60;
+        $lasttime = $nowtime - $second;
+
+        $rs = Db::name('wenzhen_order')->where('status',25)->where('ordertype',2)->where('comefrom',2)->where('video_time','lt',$lasttime)->update([
             'status'        => 30,
             'finish_time'   => $nowtime,
         ]);