improved search module

This commit is contained in:
huangjx
2022-02-26 21:47:18 +08:00
parent ea07560b5e
commit 0d689ca2dd
6 changed files with 66 additions and 25 deletions

View File

@@ -2,9 +2,40 @@
namespace OCA\NCDownloader\Search\Sites;
interface searchBase
abstract class searchBase
{
public function search($keyword);
public function parse();
protected $query = null;
protected $tableTitles = [];
protected $rows = [];
protected $actionLinks = [["name" => 'download', 'path' => '/index.php/apps/ncdownloader/new'], ['name' => 'clipboard']];
public function getTableTitles(): array
{
if (empty($this->tableTitles)) {
return ['title', 'seeders', 'info', 'actions'];
}
return $this->tableTitles;
}
public function setTableTitles(array $titles)
{
$this->tableTitles = $titles;
return $this;
}
protected function addActionLinks(?array $links)
{
$links = $links ?? $this->actionLinks;
foreach ($this->rows as $key => &$value) {
if (!$value) {
continue;
}
$value['actions'] = $links;
}
}
public function getRows(): array
{
return $this->rows;
}
}