* Finish task #101102.

This commit is contained in:
sunguangming
2023-08-22 15:09:24 +08:00
parent f331d507bd
commit bffe71f07c
2 changed files with 16 additions and 8 deletions
+3 -3
View File
@@ -618,7 +618,7 @@ class projectModel extends model
* @access public
* @return void
*/
public function getBrotherProjects($project)
public function getBrotherProjects(object $project): array
{
if($project->parent == 0) return array($project->id => $project->id);
@@ -644,7 +644,7 @@ class projectModel extends model
* @access public
* @return object
*/
public function getByIdList($projectIdList = array(), $mode = '')
public function getByIdList(array $projectIdList = array(), string $mode = ''): array
{
return $this->dao->select('*')->from(TABLE_PROJECT)
->where('type')->eq('project')
@@ -662,7 +662,7 @@ class projectModel extends model
* @access public
* @return array
*/
public function getPairsByIdList($projectIdList = array(), $model = '', $param = '')
public function getPairsByIdList(array $projectIdList = array(), string $model = '', string $param = ''): array
{
return $this->dao->select('id, name')->from(TABLE_PROJECT)
->where('type')->eq('project')
+13 -5
View File
@@ -2,15 +2,21 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
su('admin');
$project = zdTable('project')->gen(100);
/**
title=测试 projectModel->getPairsByIdList();
timeout=0
cid=1
pid=1
查找ID为0、11、12、13的项目数量 >> 3
查找所有项目数量 >> 110
- 查找ID为0、11、12、13的项目数量 @3
- 查找所有敏捷项目数量 @18
- 查找所有瀑布项目数量 @18
- 查找所有项目数量 @90
*/
@@ -18,5 +24,7 @@ global $tester;
$tester->loadModel('project');
$projectIdList = array(0, 11, 12, 13);
r(count($tester->project->getPairsByIdList($projectIdList))) && p() && e('3'); //查找ID为0、11、12、13的项目数量
r(count($tester->project->getPairsByIdList(array()))) && p() && e('110'); //查找所有项目数量
r(count($tester->project->getPairsByIdList($projectIdList))) && p() && e('3'); // 查找ID为0、11、12、13的项目数量
r(count($tester->project->getPairsByIdList(array(), 'scrum'))) && p() && e('18'); // 查找所有敏捷项目数量
r(count($tester->project->getPairsByIdList(array(), 'waterfall'))) && p() && e('18'); // 查找所有瀑布项目数量
r(count($tester->project->getPairsByIdList(array()))) && p() && e('90'); // 查找所有项目数量