* Fix the code review problem.

This commit is contained in:
tianshujie
2023-03-27 14:16:50 +08:00
parent 4712c71163
commit a0fef19d18
3 changed files with 30 additions and 30 deletions
+28 -28
View File
@@ -938,7 +938,7 @@ class apiModel extends model
*
* @param string $libID
* @param int $queryID
* @param int $objectType product|project
* @param string $objectType product|project
* @param array $libs
* @access public
* @return array
@@ -947,35 +947,35 @@ class apiModel extends model
{
$queryName = $objectType ? $objectType . 'apiDocQuery' : 'apiQuery';
$queryForm = $objectType ? $objectType . 'apiDocForm' : 'apiForm';
if($queryID)
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
{
$this->session->set($queryName, $query->sql);
$this->session->set($queryForm, $query->form);
}
else
{
$this->session->set($queryName, ' 1 = 1');
}
}
else
{
if($this->session->$queryName == false) $this->session->set($queryName, ' 1 = 1');
}
if($queryID)
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
{
$this->session->set($queryName, $query->sql);
$this->session->set($queryForm, $query->form);
}
else
{
$this->session->set($queryName, ' 1 = 1');
}
}
else
{
if($this->session->$queryName == false) $this->session->set($queryName, ' 1 = 1');
}
$apiQuery = $this->session->$queryName;
if(strpos($apiQuery, "`lib` = 'all'") === false and !$objectType) $apiQuery = "$apiQuery and lib = $libID";
if(strpos($apiQuery, "`lib` = 'all'") !== false) $apiQuery = str_replace("`lib` = 'all'", '1', $apiQuery);
$apiQuery = $this->session->$queryName;
if(strpos($apiQuery, "`lib` = 'all'") === false and !$objectType) $apiQuery = "$apiQuery and lib = $libID";
if(strpos($apiQuery, "`lib` = 'all'") !== false) $apiQuery = str_replace("`lib` = 'all'", '1', $apiQuery);
$list = $this->dao->select('*')
->from(TABLE_API)
->where('deleted')->eq(0)
->andWhere($apiQuery)
->beginIF(!empty($libs))->andWhere('`lib`')->in($libs)->fi()
->fetchAll();
$list = $this->dao->select('*')
->from(TABLE_API)
->where('deleted')->eq(0)
->andWhere($apiQuery)
->beginIF(!empty($libs))->andWhere('`lib`')->in($libs)->fi()
->fetchAll();
return $list;
return $list;
}
}
+2 -1
View File
@@ -355,7 +355,6 @@ class doc extends control
}
elseif($this->app->tab == 'project')
{
$linkType = 'project';
$this->project->setMenu($this->session->project);
}
elseif($this->app->tab == 'execution')
@@ -1243,7 +1242,9 @@ class doc extends control
* @param string $type
* @param int $objectID
* @param int $libID
* @param int $moduleID
* @param string $browseType
* @param string $orderBy
* @param int $param
* @param int $recTotal
* @param int $recPerPage
-1
View File
@@ -2715,7 +2715,6 @@ class docModel extends model
*/
public function getDocsBySearch($type, $objectID, $libID, $queryID, $orderBy = 'id_desc', $pager = null)
{
$lib = $this->getLibById($libID);
$queryName = $type . 'libDocQuery';
$queryForm = $type . 'libDocForm';
if($queryID)