/** * 获取一个数据列表,功能类似于gets,此方法仅用于SiaoCMS,不作为同样类库的方法 * @param $params * @param $get * @return array */ function getList(&$params, $get = 'data') { $selectdb = new SelectDB($this->db); $selectdb->from($this->table); $selectdb->select($this->select); $selectdb->limit(isset($params['row']) ? $params['row'] : 10); unset($params['row']); $selectdb->order(isset($params['order']) ? $params['order'] : $this->primary . ' desc'); unset($params['order']); if (isset($params['typeid'])) { $selectdb->where($this->foreignkey . '=' . $params['typeid']); unset($params['typeid']); } $selectdb->put($params); if (array_key_exists('page', $params)) { $selectdb->paging(); global $php; $php->env['page'] = $params['page']; $php->env['start'] = 10 * intval($params['page'] / 10); if ($selectdb->pages > 10 and $params['page'] < $php->env['start']) { $php->env['more'] = 1; } $php->env['end'] = $selectdb->pages - $php->env['start']; $php->env['pages'] = $selectdb->pages; $php->env['pagesize'] = $selectdb->page_size; $php->env['num'] = $selectdb->num; } if ($get === 'data') { return $selectdb->getall(); } elseif ($get === 'sql') { return $selectdb->getsql(); } }