dao = $dao; } /** * 根据类型获取链接 * * @param string $type 链接类型 * * @return array|null * @throws \Exception */ public function getLinksByType(string $type): ?array { $map = [ ['category', 'eq', $type], ['enabled', 'eq', 1], ]; return $this->dao->selectList($map, ['*'], 0, 0, 'sort asc')->toArray(); } /** * 获取所有链接 * * @return array * @throws \Exception */ public function getAllLinks(): array { $map = [ ['enabled', '=', 1], ['deleted_at', '=', null], ]; return $this->dao->selectList($map, ['*'], 0, 0, 'category asc, sort asc')->toArray(); } }