M230906151123InsertQimallAddonsStoreMenu.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace addons\StoreBoss\console\migrations;
  3. use addons\Store\common\models\StoreMenu;
  4. use yii\db\Migration;
  5. /**
  6. * Class M230906151123InsertQimallAddonsStoreMenu
  7. */
  8. class M230906151123InsertQimallAddonsStoreMenu extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. try {
  16. $has = StoreMenu::find()->where(['title' => '股东', 'url' => 'store/client/store-boss/index', 'status' => 1])->asArray()->one();
  17. if (empty($has)) {
  18. $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 (34, '股东', '0', '0', 'store/client/store-boss/index', 'el-icon-circle-plus', '1', '0', '999', null, '', 1, 0, 0);
  19. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (35, '股东列表', '0', '34', 'store/client/store-boss/index', '', '1', '0', '999', null, '',1, 0, 0);
  20. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (36, '股东等级', '0', '34', 'store/client/store-boss-level/index', '', '1', '0', '999', null, '', 1, 0, 0);
  21. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (37, '提成明细', '0', '34', 'store/client/store-boss/settlement-list', '', '1', '0', '999', null, '', 1, 0, 0);
  22. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (38, '基础配置', '0', '34', 'store/client/store-boss/setting', '', '1', '0', '999', null, '', 1, 0, 0);
  23. ";
  24. $this->execute($sql);
  25. }
  26. } catch (\Exception $e) {
  27. }
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function safeDown()
  33. {
  34. echo "M230906151123InsertQimallAddonsStoreMenu cannot be reverted.\n";
  35. return false;
  36. }
  37. /*
  38. // Use up()/down() to run migration code without a transaction.
  39. public function up()
  40. {
  41. }
  42. public function down()
  43. {
  44. echo "M230906151123InsertQimallAddonsStoreMenu cannot be reverted.\n";
  45. return false;
  46. }
  47. */
  48. }