diff --git a/module/testtask/model.php b/module/testtask/model.php index cff476d1bb..98fbf9defa 100755 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1102,16 +1102,16 @@ class testtaskModel extends model * 获取用例以及场景数据。 * Get cases with scenes data. * - * @param int $productID - * @param array $runs + * @param int|array $productID + * @param array $runs * @access public * @return array */ - public function getSceneCases($productID, $runs) + public function getSceneCases(int|array $productID, array $runs) { $scenes = $this->dao->select('*')->from(TABLE_SCENE) ->where('deleted')->eq('0') - ->andWhere('product')->eq($productID) + ->andWhere('product')->in($productID) ->orderBy('grade_desc, sort_asc') ->fetchAll('id', false); @@ -1150,17 +1150,17 @@ class testtaskModel extends model * 获取一个测试单关联的用例。 * Get cases associated with a testtask. * - * @param int $productID - * @param string $browseType - * @param int $queryID - * @param int $moduleID - * @param string $sort - * @param object $pager - * @param object $task + * @param int|array $productID + * @param string $browseType + * @param int $queryID + * @param int $moduleID + * @param string $sort + * @param object $pager + * @param object $task * @access public * @return array */ - public function getTaskCases(int $productID, string $browseType, int $queryID, int $moduleID, string $sort, ?object $pager = null, ?object $task = null): array + public function getTaskCases(int|array $productID, string $browseType, int $queryID, int $moduleID, string $sort, ?object $pager = null, ?object $task = null): array { if(common::isTutorialMode()) return $this->loadModel('tutorial')->getCases(); @@ -1204,7 +1204,7 @@ class testtaskModel extends model ->where($caseQuery) ->andWhere('t1.task')->eq($task->id) ->andWhere('t2.deleted')->eq('0') - ->beginIF($isQueryProduct === false)->andWhere('t2.product')->eq($productID)->fi() + ->beginIF($isQueryProduct === false)->andWhere('t2.product')->in($productID)->fi() ->beginIF($task->branch)->andWhere('t2.branch')->in("0,{$task->branch}")->fi() ->orderBy($orderBy) ->page($pager) diff --git a/module/tree/model.php b/module/tree/model.php index 3d7588e491..8ba9246446 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -256,13 +256,13 @@ class treeModel extends model * 获取模块对列表。 * Get module pairs. * - * @param int $rootID - * @param string $viewType - * @param string $showModule + * @param int|array $rootID + * @param string $viewType + * @param string $showModule * @access public * @return array */ - public function getModulePairs(int $rootID, string $viewType = 'story', string $showModule = 'end', string $extra = '') + public function getModulePairs(int|array $rootID, string $viewType = 'story', string $showModule = 'end', string $extra = '') { if(common::isTutorialMode()) $modulePairs = $this->loadModel('tutorial')->getModulePairs(); @@ -271,7 +271,7 @@ class treeModel extends model $products = array_keys($this->loadModel('product')->getProductPairsByProject($rootID)); if(!$this->isMergeModule($rootID, $viewType) || !$products) { - $modules = $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->eq($rootID)->andWhere('type')->in($viewType)->andWhere('deleted')->eq(0)->fetchAll('id'); + $modules = $this->dao->select('id,name,path,short')->from(TABLE_MODULE)->where('root')->in($rootID)->andWhere('type')->in($viewType)->andWhere('deleted')->eq(0)->fetchAll('id'); } else { @@ -290,7 +290,7 @@ class treeModel extends model if($this->isMergeModule($rootID, $viewType) || !$rootID) $viewType .= ',story'; $modules += $this->dao->select('id,name,path,short')->from(TABLE_MODULE) ->where('type')->in($viewType) - ->beginIF($rootID)->andWhere('root')->eq($rootID)->fi() + ->beginIF($rootID)->andWhere('root')->in($rootID)->fi() ->andWhere('deleted')->eq(0) ->fetchAll('id'); } @@ -2353,19 +2353,19 @@ class treeModel extends model * 检查是否是已合并模块。4.1后task,case,bug也会使用story的模块。 * Check merge module version. * - * @param int $rootID - * @param string $viewType + * @param int|array $rootID + * @param string $viewType * @access public * @return bool */ - public function isMergeModule(int $rootID, string $viewType): bool + public function isMergeModule(int|array $rootID, string $viewType): bool { if(!in_array($viewType, array('bug', 'case', 'task'))) return false; /* Get createdVersion. */ $table = $viewType == 'task' ? TABLE_PROJECT : TABLE_PRODUCT; $versionField = $viewType == 'task' ? 'openedVersion' : 'createdVersion'; - $createdVersion = $this->dao->select($versionField)->from($table)->where('id')->eq($rootID)->fetch($versionField); + $createdVersion = $this->dao->select($versionField)->from($table)->where('id')->in($rootID)->fetch($versionField); if(!$createdVersion) return true; if(is_numeric($createdVersion[0]) && version_compare($createdVersion, '4.1', '<=')) return false;