diff --git a/module/system/control.php b/module/system/control.php index 4bbc0dce4d..2141fc0361 100644 --- a/module/system/control.php +++ b/module/system/control.php @@ -542,7 +542,7 @@ class system extends control $this->app->loadClass('pager', true); $pager = pager::init($recTotal, $recPerPage, $pageID); - $systems = $this->system->getList($orderBy, $pager); + $systems = $this->system->getList($productID, $orderBy, $pager); foreach($systems as &$system) { $system->latestRelease = $system->latestRelease ? $system->latestRelease : ''; diff --git a/module/system/model.php b/module/system/model.php index 2270186625..e13b935901 100644 --- a/module/system/model.php +++ b/module/system/model.php @@ -22,10 +22,11 @@ class systemModel extends model * @access public * @return array */ - public function getList(string $orderBy = 'id_desc', object $pager = null): array + public function getList(int $product, string $orderBy = 'id_desc', object $pager = null): array { return $this->dao->select('*')->from(TABLE_SYSTEM) ->where('deleted')->eq('0') + ->andWhere('product')->eq($product) ->orderBy($orderBy) ->page($pager) ->fetchAll(); diff --git a/module/system/test/model/getlist.php b/module/system/test/model/getlist.php index f98b571511..2085a0b95e 100755 --- a/module/system/test/model/getlist.php +++ b/module/system/test/model/getlist.php @@ -3,6 +3,7 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; su('admin'); zenData('system')->gen(10); +zenData('product')->gen(10); /** @@ -10,8 +11,8 @@ title=测试 systemModel::getList(); timeout=0 cid=1 -- 查询默认排序应用第0条的name属性 @应用10 -- 获取所有应用数量 @10 +- 查询默认排序应用第0条的name属性 @应用1 +- 获取所有应用数量 @1 - 查询默认排序应用下的状态第0条的status属性 @active - 查询ID正序排序应用第0条的name属性 @应用1 - 查询状态倒序排序应用第0条的name属性 @应用1 @@ -22,8 +23,8 @@ $system = $tester->loadModel('system'); $orderList = array('id_desc', 'id_asc', 'status_desc', 'status_asc'); -r($system->getList()) && p('0:name') && e('应用10'); // 查询默认排序应用 -r(count($system->getList())) && p() && e('10'); // 获取所有应用数量 -r($system->getList()) && p('0:status') && e('active'); // 查询默认排序应用下的状态 -r($system->getList($orderList[1])) && p('0:name') && e('应用1'); // 查询ID正序排序应用 -r($system->getList($orderList[2])) && p('0:name') && e('应用1'); // 查询状态倒序排序应用 +r($system->getList(1)) && p('0:name') && e('应用1'); // 查询默认排序应用 +r(count($system->getList(1))) && p() && e('1'); // 获取所有应用数量 +r($system->getList(1)) && p('0:status') && e('active'); // 查询默认排序应用下的状态 +r($system->getList(1, $orderList[1])) && p('0:name') && e('应用1'); // 查询ID正序排序应用 +r($system->getList(1, $orderList[2])) && p('0:name') && e('应用1'); // 查询状态倒序排序应用