| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
- namespace addons\Rebate\console\migrations;
- use common\models\common\Addons;
- use yii\db\Migration;
- /**
- * Class M230922025229AddonsRebate
- */
- class M230922025229AddonsRebate extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql="ALTER TABLE qimall_addons_rebate add join_type tinyint(1) not null default 0 comment '0:平台会员;1:推三返一用户';";
- $this->execute($sql);
- $sql="CREATE TABLE `qimall_addons_rebate_user` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城id',
- `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
- `upgrade_status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '升级类型;0:后台添加;1条件升级;2购物升级;3:注册添加;4:同步添加',
- `level` tinyint(3) NOT NULL DEFAULT '0' COMMENT '代理商等级权重',
- `before_level` int(11) DEFAULT '0' COMMENT '升级前等级;0为无',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` bigint(20) NOT NULL DEFAULT '0',
- `updated_at` bigint(20) NOT NULL DEFAULT '0',
- `upgrade_at` bigint(20) NOT NULL DEFAULT '0' COMMENT '等级升级时间',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `user_id` (`user_id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='推三返一用户';";
- $this->execute($sql);
- $sql="CREATE TABLE `qimall_addons_rebate_user_level` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL COMMENT '商城ID',
- `level` int(11) NOT NULL DEFAULT '0',
- `name` varchar(45) NOT NULL DEFAULT '' COMMENT '等级名称',
- `is_auto_upgrade` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否开启自动升级',
- `upgrade_type_condition` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否开启条件升级',
- `checked_condition_values` longtext NOT NULL COMMENT '升级条件',
- `checked_condition_keys` varchar(1000) NOT NULL DEFAULT '' COMMENT '升级条件选中的key集合',
- `condition_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '0 未选择、1满足其一 2、满足所有',
- `upgrade_type_goods` tinyint(1) NOT NULL DEFAULT '0' COMMENT '购买升级商品,0关闭,1开启',
- `buy_goods_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '购买升级商品触发升级:0订单完成 1下单完成',
- `goods_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '商品升级类型,1- 任意商品 2- 指定商品',
- `goods_ids` varchar(3000) NOT NULL DEFAULT '' COMMENT '商品id集合',
- `goods_list` text NOT NULL COMMENT '商品列表json',
- `explain` varchar(5000) NOT NULL DEFAULT '' COMMENT '等级说明',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `mall_id` (`mall_id`) USING BTREE,
- KEY `level` (`level`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='推三返一等级';";
- $this->execute($sql);
- Addons::isInstall('Rebate');
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230922025229AddonsRebate cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230922025229AddonsRebate cannot be reverted.\n";
- return false;
- }
- */
- }
|