private function jsonWithGETUrl($url = '') { $where = $this->get('where'); $include = $this->get('include'); $limit = intval($this->get('limit')); $skip = intval($this->get('skip')); $count = intval($this->get('count')); if (!empty($where)) { $where = json_encode($where); $url .= 'where=' . $where . '&'; } if (!empty($skip)) { $url .= 'skip=' . $skip . '&'; } if (!empty($include)) { $url .= 'include=' . $include . '&'; } /// 如果是count,那么limit就和普通的get不同,特殊处理 if ($count == 1) { $url .= 'count=1&limit=0'; $json = $this->kq->get($url); return $json; } if (!empty($limit)) { $url .= 'limit=' . $limit; } else { $url .= 'limit=20'; } // echo $url; $json = $this->kq->get($url); return $json; }
/** * url带? * get/id 也有可能用这个,所以不一定是getall * @param unknown_type $url */ private function getWithOptions($url) { $where = $this->get('where'); $include = $this->get('include'); $limit = intval($this->get('limit')); $skip = intval($this->get('skip')); $keys = $this->get('keys'); if (!empty($where)) { $where = json_encode($where); $url .= 'where=' . $where . '&'; } if (!empty($skip)) { $url .= 'skip=' . $skip . '&'; } if (!empty($include)) { $url .= 'include=' . $include . '&'; } ///limit要在最后 if (!empty($limit)) { $url .= 'limit=' . $limit; } else { $url .= 'limit=30'; } // echo $url; $json = $this->kq->get($url); return json_decode($json, true); }