* Perfect details.

This commit is contained in:
hufangzhou
2021-12-21 15:42:26 +08:00
parent 872a8b2bbd
commit 2809bc0b94
2 changed files with 4 additions and 5 deletions
+3 -3
View File
@@ -307,7 +307,7 @@ class branch extends control
*
* @param int $productID
* @access public
* @return void
* @return object
*/
public function mergeBranch($productID)
{
@@ -324,8 +324,8 @@ class branch extends control
$this->loadModel('action')->create('branch', $targetBranch, 'MergedBranch', '', implode(',', $mergedBranches));
if(dao::isError()) $this->send(array('message' => dao::getError(), 'result' => 'fail'));
if(dao::isError()) return $this->send(array('message' => dao::getError(), 'result' => 'fail'));
$this->send(array('message' => $this->lang->saveSuccess, 'result' => 'success'));
return $this->send(array('message' => $this->lang->saveSuccess, 'result' => 'success'));
}
}
+1 -2
View File
@@ -164,12 +164,11 @@ class branchModel extends model
*/
public function create($productID, $withMerge = false)
{
$removedFields = $withMerge ? 'createBranch,mergedBranchIDList,targetBranch' : '';
$branch = fixer::input('post')
->add('product', $productID)
->add('createdDate', helper::today())
->add('status', 'active')
->remove($removedFields)
->removeIF($withMerge, 'createBranch,mergedBranchIDList,targetBranch')
->get();
$lastOrder = (int)$this->dao->select('`order`')->from(TABLE_BRANCH)->where('product')->eq($productID)->orderBy('order_desc')->limit(1)->fetch('order');