示例#1
0
 public function getNumber($date, $hubId = '')
 {
     $date = date('YmdHis', strtotime($date . ' 10:00:00'));
     $hub = new Hub();
     $hublist = $hub->getHUb();
     if ($hubId) {
         $result = Reservations::model()->count('status !=0 and type=1 and startTime=' . $date . ' and hubId=' . $hubId);
     } else {
         $result = array();
         foreach ($hublist as $key) {
             $result[] = Reservations::model()->count('status !=0 and type=1 and startTime=' . $date . ' and hubId=' . $key['id']);
         }
     }
     if ($result) {
         $data = array('code' => 200, 'message' => 'SUCCESS', 'count' => $result);
     } else {
         $data = array('code' => 200, 'message' => 'SUCCESS', 'count' => 0);
     }
     return $data;
 }