Browse Source

vue_admin_action

Panda 3 months ago
parent
commit
3f1d2bd53e
2 changed files with 54 additions and 0 deletions
  1. 25 0
      application/api/controller/Hotel.php
  2. 29 0
      application/api/controller/HotelCanteen.php

+ 25 - 0
application/api/controller/Hotel.php

@@ -198,6 +198,31 @@ class Hotel extends Api
         return $this->success('获取成功',$list);
     }
 
+    // 订单详情
+    public function myApplyInfo()
+    {
+        $params = $this->request->param();
+        $user_id = $this->auth->id;
+
+        $query = HotelOrderModel::with([
+            'room'=>function ($query) {
+                $query->field(['id','name','image']);
+            }
+        ])->where('id',$params['id'])->where('user_id',$user_id);
+
+        $info = $query->find();
+        if ($info['status'] == 1){
+            if ($info['start_date'] < date('Y-m-d')){
+                $info['status_txt'] = '待入住';
+            }else{
+                $info['status_txt'] = '已入住';
+            }
+        }else{
+            $info['status_txt'] = '已取消';
+        }
+        return $this->success('获取成功',$info);
+    }
+
     // 订单取消
     public function applyCancel()
     {

+ 29 - 0
application/api/controller/HotelCanteen.php

@@ -185,6 +185,35 @@ class HotelCanteen extends Api
         return $this->success('获取成功',$list);
     }
 
+    // 订单详情
+    public function myApplyInfo()
+    {
+        $params = $this->request->param();
+        $user_id = $this->auth->id;
+
+        $query = HotelCanteenOrderModel::with([
+            'canteen'=>function ($query) {
+                $query->field(['id','name','image']);
+            },
+            'room'=>function ($query) {
+                $query->field(['id','name','image']);
+            }
+        ])->where('id',$params['id'])->where('user_id',$user_id);
+
+        $info = $query->find();
+        if ($info['status'] == 1){
+            if ($info['get_to_time'] > time()){
+                $info['status_txt'] = '待用餐';
+            }else{
+                $info['status_txt'] = '已完成';
+            }
+        }else{
+            $info['status_txt'] = '已取消';
+        }
+        $info['get_to_time'] = date('Y-m-d H:i');
+        return $this->success('获取成功',$info);
+    }
+
     // 订单取消
     public function applyCancel()
     {