src/Biz/Search/Service/Impl/SearchServiceImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\Search\Service\Impl;
use Biz\BaseService;
use Biz\CloudPlatform\Client\FailoverCloudAPI;
use Biz\CloudPlatform\CloudAPIFactory;
use Biz\Search\Adapter\SearchAdapterFactory;
use Biz\Search\SearchException;
use Biz\Search\Service\SearchService;
use Codeages\Biz\Framework\Context\Biz;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
class SearchServiceImpl extends BaseService implements SearchService
{
protected $cloudLeafApi;
protected $cloudRootApi;
public function __construct(Biz $biz)
{
parent::__construct($biz);
$this->cloudLeafApi = CloudAPIFactory::create('leaf');
$this->cloudRootApi = CloudAPIFactory::create('root');
}
public function cloudSearch($type, $conditions = array())
{
$api = $this->getCloudApi('leaf');
if ('course' === $type) {
$conditions['type'] = 'course,openCourse';
}
$conditions = $this->searchBase64Encode($conditions);
try {
$result = $api->get('/search', $conditions);
if (empty($result['success'])) {
$this->createNewException(SearchException::SEARCH_FAILED());
}
} catch (\RuntimeException $e) {
$this->getSettingService()->set('_cloud_search_restore_time', time() + 60 * 10);
throw $e;
}
if (empty($result['body']['datas'])) {
return array(array(), 0);
}
$resultSet = $result['body']['datas'];
$counts = $result['body']['count'];
$resultSet = SearchAdapterFactory::create($type)->adapt($resultSet);
return array($resultSet, $counts);
}
public function refactorAllDocuments()
{
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。