* Refactor getLast method.

This commit is contained in:
tianshujie
2023-10-09 14:27:39 +08:00
parent fb90d9b34a
commit 36ebc103fe
2 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -122,7 +122,7 @@ class release extends control
$this->view->productID = $productID;
$this->view->builds = $builds;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->view->lastRelease = $this->release->getLast($productID, $branch);
$this->view->lastRelease = $this->release->getLast($productID, (int)$branch);
$this->display();
}
+6 -6
View File
@@ -110,20 +110,20 @@ class releaseModel extends model
}
/**
* 获取产品下的最新创建的发布。
* Get last release.
*
* @param int $productID
* @param int $branch
* @param int $productID
* @param int $branch
* @access public
* @return bool | object
* @return object|false
*/
public function getLast($productID, $branch = 0)
public function getLast(int $productID, int $branch = 0): object|false
{
return $this->dao->select('id, name')->from(TABLE_RELEASE)
->where('product')->eq((int)$productID)
->where('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->eq($branch)->fi()
->orderBy('id DESC')
->limit(1)
->fetch();
}