* Code review.

This commit is contained in:
liumengyi
2022-06-24 14:18:31 +08:00
parent 5b84f06092
commit 3cbc219ad5
10 changed files with 31 additions and 33 deletions
+4 -4
View File
@@ -907,11 +907,10 @@ class apiModel extends model
*/
public function buildSearchForm($lib, $queryID, $actionURL)
{
$lib = array($lib->id => $lib->name);
$this->config->api->search['module'] = 'api';
$this->config->api->search['queryID'] = $queryID;
$this->config->api->search['actionURL'] = $actionURL;
$this->config->api->search['params']['lib']['values'] = $lib + array('all' => $this->lang->api->allLibs);
$this->config->api->search['params']['lib']['values'] = array($lib->id => $lib->name) + array('all' => $this->lang->api->allLibs);
$this->loadModel('search')->setSearchParams($this->config->api->search);
}
@@ -945,11 +944,12 @@ class apiModel extends model
}
$apiQuery = $this->session->apiQuery;
$apiQuery = strpos($apiQuery, "`lib` = 'all'") === false ? "$apiQuery and lib = $libID" : str_replace("`lib` = 'all'", '1', $apiQuery);
$list = $this->dao->select('*')
->from(TABLE_API)
->where('deleted')->eq(0)
->andWhere(str_replace("`lib` = 'all'", '1', $apiQuery))
->beginIF(strpos($apiQuery, "`lib` = 'all'") === false)->andWhere('lib')->eq($libID)->fi()
->andWhere($apiQuery)
->fetchAll();
return $list;