* Optimize code.

This commit is contained in:
mayue
2022-03-22 15:43:04 +08:00
parent 4b4b04f19b
commit ceb7030aeb
2 changed files with 12 additions and 18 deletions
+6 -9
View File
@@ -217,19 +217,16 @@ class projectreleaseModel extends model
$this->loadModel('story');
$this->loadModel('action');
$storyIDList = explode(',', $release->stories);
$product = $this->loadModel('product')->getById($release->product);
$storyIDList = array_filter(explode(',', $release->stories));
$product = $this->loadModel('product')->getById($release->product);
foreach($storyIDList as $storyID)
{
if($storyID)
{
$this->dao->update(TABLE_STORY)->set('stagedBy')->eq('')->where('id')->eq($storyID)->exec();
if($product and $product->type != 'normal') $this->dao->update(TABLE_STORYSTAGE)->set('stagedBy')->eq('')->where('story')->eq($storyID)->andWhere('branch')->eq($release->branch)->exec();
$this->dao->update(TABLE_STORY)->set('stagedBy')->eq('')->where('id')->eq($storyID)->exec();
if($product and $product->type != 'normal') $this->dao->update(TABLE_STORYSTAGE)->set('stagedBy')->eq('')->where('story')->eq($storyID)->andWhere('branch')->eq($release->branch)->exec();
$this->story->setStage($storyID);
$this->story->setStage($storyID);
$this->action->create('story', $storyID, 'linked2release', '', $releaseID);
}
$this->action->create('story', $storyID, 'linked2release', '', $releaseID);
}
}
+6 -9
View File
@@ -216,19 +216,16 @@ class releaseModel extends model
$this->loadModel('story');
$this->loadModel('action');
$storyIDList = explode(',', $release->stories);
$product = $this->loadModel('product')->getById($release->product);
$storyIDList = array_filter(explode(',', $release->stories));
$product = $this->loadModel('product')->getById($release->product);
foreach($storyIDList as $storyID)
{
if($storyID)
{
$this->dao->update(TABLE_STORY)->set('stagedBy')->eq('')->where('id')->eq($storyID)->exec();
if($product and $product->type != 'normal') $this->dao->update(TABLE_STORYSTAGE)->set('stagedBy')->eq('')->where('story')->eq($storyID)->andWhere('branch')->eq($release->branch)->exec();
$this->dao->update(TABLE_STORY)->set('stagedBy')->eq('')->where('id')->eq($storyID)->exec();
if($product and $product->type != 'normal') $this->dao->update(TABLE_STORYSTAGE)->set('stagedBy')->eq('')->where('story')->eq($storyID)->andWhere('branch')->eq($release->branch)->exec();
$this->story->setStage($storyID);
$this->story->setStage($storyID);
$this->action->create('story', $storyID, 'linked2release', '', $releaseID);
}
$this->action->create('story', $storyID, 'linked2release', '', $releaseID);
}
}