Merge branch 'sprint/272_tianshujie' into 'sprint/272'

* Add update function of task #79622.

See merge request easycorp/zentaopms!6593
This commit is contained in:
孙广明
2022-12-19 03:22:28 +00:00
+52
View File
@@ -584,6 +584,9 @@ class upgradeModel extends model
$this->execSQL($xuanxuanSql);
}
break;
case '18_0_beta2':
$this->updateMyBlocks();
break;
}
$this->deletePatch();
@@ -8010,4 +8013,53 @@ class upgradeModel extends model
}
return true;
}
/**
* Update my module blocks.
*
* @access public
* @return bool
*/
public function updateMyBlocks()
{
/* Delete flowchart block. */
$this->dao->delete()->from(TABLE_BLOCK)->where('module')->eq('my')->andWhere('block')->eq('flowchart')->exec();
/* Update block order and insert guide block. */
$visionList = array('rnd', 'lite');
/* Set guide block data. */
$guideBlock = new stdclass();
$guideBlock->module = 'my';
$guideBlock->title = common::checkNotCN() ? 'Guides' : '使用帮助';
$guideBlock->block = 'guide';
$guideBlock->order = 3;
$guideBlock->grid = 8;
foreach($visionList as $vision)
{
$guideBlock->vision = $vision;
$this->dao->update(TABLE_BLOCK)
->set('`order` = `order` + 1')
->where('vision')->eq($vision)
->andWhere('module')->eq('my')
->andWhere('`order`')->ge(3)
->orderBy('`order` desc')
->exec();
$accountList = $this->dao->select('account')->from(TABLE_BLOCK)
->where('vision')->eq($vision)
->andWhere('module')->eq('my')
->fetchPairs('account');
foreach($accountList as $account)
{
if(empty($account)) continue;
$guideBlock->account = $account;
$this->dao->insert(TABLE_BLOCK)->data($guideBlock)->exec();
}
}
return true;
}
}