M240112103353StoreVerification.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240112103353StoreVerification
  6. */
  7. class M240112103353StoreVerification extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "INSERT INTO `qimall_addons_store_addons` (`title`, `name`, `cover`, `brief_introduction`, `status`, `created_at`, `updated_at`) VALUES ('核销券', 'Verification', '', '单门店核销工具', '1', '1702975895', '1702975895');";
  15. $this->execute($sql);
  16. $sql = "INSERT INTO `qimall_addons_store_menu` (`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ('108', '核销券', '0', '0', 'store/verification/index/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'Verification', '1');
  17. INSERT INTO `qimall_addons_store_menu` (`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ('109', '核销券', '0', '108', 'store/verification/index/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'Verification', '1');
  18. INSERT INTO `qimall_addons_store_menu` (`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ('110', '会员核销券', '0', '108', 'store/verification/index/user', '', '2', '0', '999', NULL, '', '1', '0', '0', 'Verification', '1');
  19. INSERT INTO `qimall_addons_store_menu` (`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ('111', '使用记录', '0', '108', 'store/verification/index/log', '', '2', '0', '999', NULL, '', '1', '0', '0', 'Verification', '1');
  20. INSERT INTO `qimall_addons_store_menu` (`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ('112', '基础设置', '0', '108', 'store/verification/index/setting', '', '2', '0', '999', NULL, '', '1', '0', '0', 'Verification', '1');";
  21. $this->execute($sql);
  22. $sql = "CREATE TABLE `qimall_addons_store_verification_coupons` (
  23. `id` int(11) NOT NULL AUTO_INCREMENT,
  24. `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
  25. `store_id` int(10) NOT NULL DEFAULT '0' COMMENT '门店ID',
  26. `name` varchar(100) NOT NULL DEFAULT '' COMMENT '核销券名称',
  27. `num` int(10) NOT NULL DEFAULT '0' COMMENT '发行数量',
  28. `start_at` int(10) NOT NULL DEFAULT '0' COMMENT '使用时间',
  29. `end_at` int(10) NOT NULL DEFAULT '0' COMMENT '使用时间',
  30. `style_pic_url` varchar(255) NOT NULL DEFAULT '' COMMENT '核销券海报',
  31. `sort` int(10) NOT NULL DEFAULT '0' COMMENT '排序',
  32. `issued_num` int(10) NOT NULL DEFAULT '0' COMMENT '已发放数量',
  33. `used_num` int(10) NOT NULL DEFAULT '0' COMMENT '已核销数量',
  34. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  35. `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  36. `updated_at` int(10) NOT NULL DEFAULT '0' COMMENT '修改时间',
  37. PRIMARY KEY (`id`)
  38. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;";
  39. $this->execute($sql);
  40. $sql = "CREATE TABLE `qimall_addons_store_verification_coupons_user` (
  41. `id` int(11) NOT NULL AUTO_INCREMENT,
  42. `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
  43. `store_id` int(10) NOT NULL DEFAULT '0' COMMENT '门店ID',
  44. `user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户ID',
  45. `coupon_id` int(10) NOT NULL DEFAULT '0' COMMENT '核销券ID',
  46. `num` int(10) NOT NULL DEFAULT '0' COMMENT '发行数量',
  47. `used_num` int(10) NOT NULL DEFAULT '0' COMMENT '已核销数量',
  48. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  49. `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  50. `updated_at` int(10) NOT NULL DEFAULT '0' COMMENT '修改时间',
  51. `is_transfer` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否他人转赠',
  52. `from_user_id` int(10) NOT NULL DEFAULT '0' COMMENT '来源用户ID',
  53. `from_coupon_user_id` int(10) NOT NULL DEFAULT '0' COMMENT '来源券ID',
  54. PRIMARY KEY (`id`),
  55. KEY `store_id` (`store_id`) USING BTREE,
  56. KEY `user_id` (`user_id`) USING BTREE,
  57. KEY `coupon_id` (`coupon_id`) USING BTREE,
  58. KEY `from_coupon_user_id` (`from_coupon_user_id`) USING BTREE
  59. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;";
  60. $this->execute($sql);
  61. $sql = "CREATE TABLE `qimall_addons_store_verification_setting` (
  62. `id` int(11) NOT NULL AUTO_INCREMENT,
  63. `mall_id` int(11) NOT NULL,
  64. `store_id` int(11) NOT NULL DEFAULT '0',
  65. `key` varchar(255) NOT NULL,
  66. `value` longtext NOT NULL,
  67. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  68. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  69. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  70. PRIMARY KEY (`id`) USING BTREE,
  71. KEY `mall_id` (`mall_id`) USING BTREE,
  72. KEY `key` (`key`(191)) USING BTREE
  73. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;";
  74. $this->execute($sql);
  75. $sql = "CREATE TABLE `qimall_store_verification_coupons_clerk_log` (
  76. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  77. `mall_id` int(11) NOT NULL DEFAULT '0',
  78. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  79. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
  80. `clerk_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销员id',
  81. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[0禁用 1启用 -1删除]',
  82. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  83. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  84. `coupon_id` int(10) NOT NULL DEFAULT '0' COMMENT '核销券ID',
  85. `from_coupon_user_id` int(10) NOT NULL DEFAULT '0' COMMENT '来源券ID',
  86. PRIMARY KEY (`id`) USING BTREE,
  87. KEY `store_id` (`store_id`) USING BTREE,
  88. KEY `user_id` (`user_id`) USING BTREE,
  89. KEY `coupon_id` (`coupon_id`) USING BTREE,
  90. KEY `from_coupon_user_id` (`from_coupon_user_id`) USING BTREE
  91. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='门店核销券明细';";
  92. $this->execute($sql);
  93. }
  94. /**
  95. * {@inheritdoc}
  96. */
  97. public function safeDown()
  98. {
  99. echo "M240112103353StoreVerification cannot be reverted.\n";
  100. return false;
  101. }
  102. /*
  103. // Use up()/down() to run migration code without a transaction.
  104. public function up()
  105. {
  106. }
  107. public function down()
  108. {
  109. echo "M240112103353StoreVerification cannot be reverted.\n";
  110. return false;
  111. }
  112. */
  113. }