|
@@ -309,34 +309,67 @@ class ApiShopProject extends BaseController
|
|
|
* 员工可预约时间段
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function choice_time()
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public function choice_time()
|
|
|
{
|
|
|
$time = $this->request->param('time');
|
|
|
$uid = $this->request->param('uid');
|
|
|
-
|
|
|
- $rostering = $this->objRostering->details([['time', 'like', '%'.$time.'%'], ['uid', '=', $uid]])->getData();
|
|
|
- var_dump($rostering);
|
|
|
-
|
|
|
- $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']);
|
|
|
+
|
|
|
+ $rostering = $this->objRostering->details([['time', 'like', '%'.$time.'%'], ['uid', '=', $uid]]);
|
|
|
+
|
|
|
+ if ($rostering->isSuccess()) {
|
|
|
+ $rostering = $rostering->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];
|
|
|
+ $rostering['reserved'] = [];
|
|
|
+ $order = $this->objSub->select($where)->getData();
|
|
|
+ if($order->isSuccess()){
|
|
|
+ $order = $order->getData();
|
|
|
+ foreach ($order['data'] as $item)
|
|
|
+ {
|
|
|
+ $rostering['reserved'][] = date('H:i:s', $item['time']);
|
|
|
+ }
|
|
|
}
|
|
|
+ parent::sendOutput($rostering);
|
|
|
+ } else {
|
|
|
+ parent::sendOutput($rostering->getData(), ErrorCode::$dberror);
|
|
|
}
|
|
|
|
|
|
- parent::sendOutput($rostering);
|
|
|
}
|
|
|
|
|
|
|