| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace app\migrations;
- use common\models\backend\Menu;
- use yii\db\Migration;
- /**
- * Class M241105024757CreateRefundStatisticsMenu
- */
- class M241105024757CreateRefundStatisticsMenu extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $data = [
- [
- 'cate_id' => '2',// 类型[1=平台,2=商城]
- 'pid' => '36',
- 'title' => '售后数据',
- 'route' => 'mall/statistics/all-pay-type-refund',
- 'icon' => '',
- // 子菜单权限,此参数若为空则表示无需增加子菜单权限)
- 'authItemChild' => []
- ]
- ];
- $res = Menu::migrateCreateMenu($data);
- if ($res === false) throw new \Exception(Menu::getStaticError());
- } catch (\Exception $e) {
- \Yii::error('迁移错误:' . $e->getMessage());
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M241105024757CreateRefundStatisticsMenu cannot be reverted.\n";
- return false;
- }
- */
- }
|