M250324110655InsertAddonsStoreMenu.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M250324110655InsertAddonsStoreMenu
  6. */
  7. class M250324110655InsertAddonsStoreMenu extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $time = time();
  15. $sql = <<<SQL
  16. INSERT INTO `qimall_addons_store_menu` (`title`, `app_id`, `pid`, `addons_name`, `is_addon`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('门店管家', '0', 0, 'StoreSteward', 1, 'store/store-steward/default/index', '', 2, 0, 999, NULL, '', 1, {$time}, {$time});
  17. SQL;
  18. $this->execute($sql);
  19. $id = $this->db->getLastInsertID($sql);
  20. $sql2 = <<<SQL
  21. INSERT INTO `qimall_addons_store_menu` (`title`, `app_id`, `pid`, `addons_name`, `is_addon`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('首页装修', '0', {$id}, 'StoreSteward', 1, 'store/store-steward/default/diy-index', '', 2, 0, 999, NULL, '', 1, {$time}, {$time});
  22. SQL;
  23. $this->execute($sql2);
  24. $sql3 = <<<SQL
  25. INSERT INTO `qimall_addons_store_menu` (`title`, `app_id`, `pid`, `addons_name`, `is_addon`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('模板选择', '0', {$id}, 'StoreSteward', 1, 'store/store-steward/default/index', '', 2, 0, 999, NULL, '', 1, {$time}, {$time});
  26. SQL;
  27. $this->execute($sql3);
  28. $sql4 = <<<SQL
  29. INSERT INTO `qimall_addons_store_menu` (`title`, `app_id`, `pid`, `addons_name`, `is_addon`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('基础设置', '0', {$id}, 'StoreSteward', 1, 'store/store-steward/setting/index', '', 2, 0, 999, NULL, '', 1, {$time}, {$time});
  30. SQL;
  31. $this->execute($sql4);
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function safeDown()
  37. {
  38. echo "M250324110655InsertAddonsStoreMenu cannot be reverted.\n";
  39. return false;
  40. }
  41. }