* Optimize code for task #61173.

This commit is contained in:
liumengyi
2022-07-20 15:59:50 +08:00
parent d161817441
commit 9ed05fad25
+3 -3
View File
@@ -748,9 +748,9 @@ class bugModel extends model
$changeBugs = $this->dao->select('id,linkbug')->from(TABLE_BUG)->where('id')->in(array_filter($changeBugs))->fetchPairs();
foreach($changeBugs as $changeBugID => $changeBug)
{
if(array_search($changeBugID, $addBugs) !== false and empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq($bugID)->where('id')->eq((int)$changeBugID)->exec();
if(array_search($changeBugID, $addBugs) !== false and !empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq("$changeBug,$bugID")->where('id')->eq((int)$changeBugID)->exec();
if(array_search($changeBugID, $removeBugs) !== false)
if(in_array($changeBugID, $addBugs) and empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq($bugID)->where('id')->eq((int)$changeBugID)->exec();
if(in_array($changeBugID, $addBugs) and !empty($changeBug)) $this->dao->update(TABLE_BUG)->set('linkBug')->eq("$changeBug,$bugID")->where('id')->eq((int)$changeBugID)->exec();
if(in_array($changeBugID, $removeBugs))
{
$linkBugs = explode(',', $changeBug);
unset($linkBugs[array_search($bugID, $linkBugs)]);