| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <?php
- namespace addons\Store\console\migrations;
- use yii\db\Migration;
- /**
- * Class M240102095457StoreBossAgent
- */
- class M240102095457StoreBossAgent extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = "INSERT INTO `qimall_addons_store_addons` (`title`, `name`, `cover`, `brief_introduction`, `status`, `created_at`, `updated_at`) VALUES ('股东-团队', 'StoreBossAgent', '', '单门店营销工具', '1', '1702975895', '1702975895');";
- $this->execute($sql);
- $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 ('113', '股东-团队', '0', '0', 'store/store-boss-agent/index/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '1');
- 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 ('114', '股东列表', '0', '113', 'store/store-boss-agent/index/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '1');
- 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 ('115', '股东等级', '0', '113', 'store/store-boss-agent/index/level', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '1');
- 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 ('116', '提成明细', '0', '113', 'store/store-boss-agent/index/settlement-list', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '1');
- 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 ('117', '基础设置', '0', '113', 'store/store-boss-agent/index/setting', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '1');";
- $this->execute($sql);
- $sql = "ALTER TABLE `qimall_addons_store_commission` ADD COLUMN `store_agent_send_commission` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '门店股东-团队直接发放佣金,不包含平台设置的插件佣金';";
- $this->execute($sql);
- $sql = "INSERT INTO `qimall_global_var_map` (`name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('StoreBossAgent', '门店股东', 'IncomeMap', '1', '1', '1654569888', '1654569888');
- INSERT INTO `qimall_global_var_map` (`name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('StoreBossAgent', '门店股东', 'FromTypeMap', '1', '1', '1654569888', '1654569888');";
- $this->execute($sql);
- $sql = "CREATE TABLE `qimall_addons_store_boss_agent` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL,
- `store_id` int(11) NOT NULL DEFAULT '0',
- `remarks` longtext COMMENT '备注',
- `status` tinyint(1) NOT NULL DEFAULT '1',
- `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
- `deleted_at` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间',
- `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
- `upgrade_level_at` int(11) NOT NULL DEFAULT '0' COMMENT '分销商等级升级时间',
- `total_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '累计佣金',
- `frozen_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '冻结佣金',
- `delete_reason` text COMMENT '删除原因',
- `upgrade_status` smallint(6) NOT NULL DEFAULT '0' COMMENT '1条件升级 2 购买指定商品升级 3手动升级',
- `level` tinyint(4) NOT NULL DEFAULT '0' COMMENT '经销商等级',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `mall_id` (`mall_id`) USING BTREE,
- KEY `is_delete` (`status`) USING BTREE,
- KEY `user_id` (`user_id`) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;";
- $this->execute($sql);
- $sql = "CREATE TABLE `qimall_addons_store_boss_agent_commission_log` (
- `id` int(10) NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
- `user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户ID',
- `store_id` int(10) NOT NULL DEFAULT '0',
- `commission` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '永久/额外佣金,单位:元',
- `source_table` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '0' COMMENT '来源表',
- `source_table_id` int(11) NOT NULL DEFAULT '0' COMMENT '来源表id',
- `is_settle` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已结算 0 否 1 是',
- `desc` varchar(255) NOT NULL DEFAULT '' COMMENT '说明',
- `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `order_no` varchar(100) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '订单编号',
- `created_at` int(10) NOT NULL DEFAULT '0',
- `updated_at` int(10) NOT NULL DEFAULT '0',
- `level` int(11) NOT NULL DEFAULT '-1' COMMENT '结算时等级',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `mall_id+user_id` (`mall_id`,`user_id`) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='股东分红记录表';";
- $this->execute($sql);
- $sql = "CREATE TABLE `qimall_addons_store_boss_agent_commission_setting_log` (
- `id` bigint(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
- `store_id` int(11) NOT NULL DEFAULT '0',
- `source_table` varchar(255) NOT NULL DEFAULT '0' COMMENT '来源表',
- `source_table_id` int(11) NOT NULL DEFAULT '0' COMMENT '来源表id',
- `basic_config` text COMMENT '基础配置',
- `level_config` text COMMENT '等级配置',
- `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `mall_id` (`mall_id`) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='团队奖励计算依据';";
- $this->execute($sql);
- $sql = "CREATE TABLE `qimall_addons_store_boss_agent_level` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT '0',
- `store_id` int(11) unsigned NOT NULL DEFAULT '0',
- `level` int(11) NOT NULL DEFAULT '-1',
- `name` varchar(45) NOT NULL,
- `is_auto_upgrade` int(11) NOT NULL DEFAULT '0',
- `detail` varchar(255) NOT NULL DEFAULT '',
- `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '永久分红',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- `checked_condition_values` longtext COMMENT '升级条件',
- `is_enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用',
- `checked_condition_keys` text COMMENT '升级条件选中的key集合',
- `condition_type` smallint(6) NOT NULL DEFAULT '0' COMMENT '0 未选择、1满足其一 2、满足所有',
- `upgrade_type_goods` smallint(6) NOT NULL DEFAULT '0',
- `upgrade_type_condition` smallint(6) NOT NULL DEFAULT '0',
- `goods_warehouse_ids` text COMMENT '商品仓库的ID',
- `goods_list` longtext COMMENT '商品列表',
- `goods_type` smallint(6) NOT NULL DEFAULT '0' COMMENT '商品升级类型',
- `buy_goods_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0订单完成 1下单 完成',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[0禁用 1启用 -1删除]',
- PRIMARY KEY (`id`) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;";
- $this->execute($sql);
- $sql = "CREATE TABLE `qimall_addons_store_boss_agent_setting` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL,
- `store_id` int(11) NOT NULL DEFAULT '0',
- `key` varchar(255) NOT NULL,
- `value` longtext NOT NULL,
- `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
- `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '是否删除 0--未删除 1--已删除',
- `deleted_at` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `mall_id` (`mall_id`) USING BTREE,
- KEY `key` (`key`(191)) USING BTREE
- ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;";
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240102095457StoreBossAgent cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240102095457StoreBossAgent cannot be reverted.\n";
- return false;
- }
- */
- }
|