zxhxx 1 year ago
parent
commit
8a9d50bc8d
1 changed files with 15 additions and 16 deletions
  1. 15 16
      Controller/Shop/ApiShopProject.Class.php

+ 15 - 16
Controller/Shop/ApiShopProject.Class.php

@@ -315,22 +315,21 @@ class ApiShopProject extends BaseController
         $uid = $this->request->param('uid');
 
         $rostering = $this->objRostering->details([['time', 'like', '%'.$time.'%'], ['uid', '=', $uid]])->getData();
-        $rostering['time_slot'] = json_decode($rostering['time_slot']);
-        $rostering['clock'] = json_decode($rostering['clock']);
-
-
-        $Stime = strtotime($time);
-        $Etime = strtotime($time) + 86400;
-        $where[] = ['uid', '=', $uid];
-        $where[] = ['time', '>=', $Stime];
-        $where[] = ['time', '<=', $Etime];
-        $order = $this->objSub->select($where)->getData();
-
-        $rostering['reserved'] = [];
-        if ($order){
-            foreach ($order['data'] as $item)
-            {
-                $rostering['reserved'][] = date('H:i:s', $item['time']);
+        if(isset($rostering['time_slot']) && isset($rostering['clock'])) {
+            $rostering['time_slot'] = json_decode($rostering['time_slot'], true);
+            $rostering['clock'] = json_decode($rostering['clock'], true);
+            $Stime = strtotime($time);
+            $Etime = strtotime($time) + 86400;
+            $where[] = ['uid', '=', $uid];
+            $where[] = ['time', '>=', $Stime];
+            $where[] = ['time', '<=', $Etime];
+            $order = $this->objSub->select($where)->getData();
+
+            $rostering['reserved'] = [];
+            if ($order) {
+                foreach ($order['data'] as $item) {
+                    $rostering['reserved'][] = date('H:i:s', $item['time']);
+                }
             }
         }