M220908060913InsertQimallAddonsStoreMenu.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220908060913InsertQimallAddonsStoreMenu
  6. */
  7. class M220908060913InsertQimallAddonsStoreMenu extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql="INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (26, '优惠券', '0', 8, 'store/client/coupon/index', '', 2, 0, 999, NULL, '', 1, 0, 0)";
  16. $this->execute($sql);
  17. $sql="INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (27, '优惠券管理', '0', 26, 'store/client/coupon/index', '', 2, 0, 999, NULL, '', 1, 0, 0)";
  18. $this->execute($sql);
  19. $sql = "INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (28, '会员优惠券', '0', 26, 'store/client/coupon/user-coupon', '', 2, 0, 999, NULL, '', 1, 0, 0)";
  20. $this->execute($sql);
  21. $sql="INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (30, '优惠设置', '0', 8, 'store/client/discount/index', '', 2, 0, 999, NULL, '', 1, 0, 0)";
  22. $this->execute($sql);
  23. }catch (\Exception $e){
  24. var_dump($e->getMessage());
  25. }
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function safeDown()
  31. {
  32. echo "M220908060913InsertQimallAddonsStoreMenu cannot be reverted.\n";
  33. return false;
  34. }
  35. /*
  36. // Use up()/down() to run migration code without a transaction.
  37. public function up()
  38. {
  39. }
  40. public function down()
  41. {
  42. echo "M220908060913InsertQimallAddonsStoreMenu cannot be reverted.\n";
  43. return false;
  44. }
  45. */
  46. }