Browse Source

倒计时的时间

lizhen_gitee 1 month ago
parent
commit
59731d6d5a

+ 24 - 0
app/Http/Controllers/Api/ChatController.php

@@ -302,6 +302,30 @@ class ChatController extends BaseController
 
         $model = WxContRepositories::add($uid, $oid, $chat_content, $chat_image, $chat_audio_url, $chat_audio_length, $refer_id, 0, 0, $shop_good_id, null, 0, $voter_id,$ask_order_id); //通用聊天
 
+        //付费咨询的逻辑
+        if($model){
+            if($ask_order_id){
+                //如果是答主的第一句话,倒计时开始
+                $ask_order = DB::table('ask_order')->where('status',10)->where('id',$ask_order_id)->first();
+                if($ask_order){
+                    $blogger_chat = DB::table('wx_chat')->where([
+                        ['user_id','=',$ask_order->blogger_user_id],
+                        ['object_id','=',$ask_order->user_id],
+                        ['expand_type','=',9],
+                        ['expand_id','=',$ask_order_id],
+                    ])->count();
+                    if($blogger_chat == 1){
+                        $countdown_time = $ask_order->ask_minute * 60 + time(); //倒计时时间
+                        DB::table('ask_order')->where('status',10)->where('id',$ask_order_id)->update([
+                            'status' => 15,  //已回复
+                            'countdown_time' => $countdown_time, //倒计时
+                        ])
+                    }
+                }
+
+            }
+        }
+
         if($model){
             $websocket_id = GatewayUtils::uid2client_id($oid);
             if($websocket_id){

+ 1 - 1
app/Jobs/AskFinishJob.php

@@ -35,7 +35,7 @@ class AskFinishJob implements ShouldQueue
     {
         //已支付状态,且倒计时时间已经到了。给修改为结束
         $where = [
-            ['status','=',10],
+            ['status','=',15],
             ['countdown_time','<',time() - 120],  //延迟2分钟
         ];
 

+ 7 - 3
app/Wen/Utils/OrderUtils.php

@@ -315,11 +315,15 @@ class OrderUtils{
             }
         }else if($type == 101){
             //咨询订单  ask_order
-            $ask_minute = DB::table($WxOrder->table_name)->where('id',$WxOrder->table_id)->value('ask_minute');
-            $countdown_time = $ask_minute * 60 + time(); //倒计时时间
+//            $ask_minute = DB::table($WxOrder->table_name)->where('id',$WxOrder->table_id)->value('ask_minute');
+//            $countdown_time = $ask_minute * 60 + time(); //倒计时时间
 
             //修改订单
-            DB::table($WxOrder->table_name)->where('id',$WxOrder->table_id)->update(['status'=>10,'paytime'=>time(),'countdown_time'=>$countdown_time]);
+            DB::table($WxOrder->table_name)->where('id',$WxOrder->table_id)->update([
+                'status'=>10,
+                'paytime'=>time(),
+//                'countdown_time'=>$countdown_time
+            ]);
         }else if($type == 102){
 
             $ask_sit_order = DB::table($WxOrder->table_name)->where('id',$WxOrder->table_id)->find();