M240102095457StoreBossAgent.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240102095457StoreBossAgent
  6. */
  7. class M240102095457StoreBossAgent 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 ('股东-团队', 'StoreBossAgent', '', '单门店营销工具', '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 ('113', '股东-团队', '0', '0', 'store/store-boss-agent/index/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '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 ('114', '股东列表', '0', '113', 'store/store-boss-agent/index/index', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '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 ('115', '股东等级', '0', '113', 'store/store-boss-agent/index/level', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '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 ('116', '提成明细', '0', '113', 'store/store-boss-agent/index/settlement-list', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '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 ('117', '基础设置', '0', '113', 'store/store-boss-agent/index/setting', '', '2', '0', '999', NULL, '', '1', '0', '0', 'StoreBossAgent', '1');";
  21. $this->execute($sql);
  22. $sql = "ALTER TABLE `qimall_addons_store_commission` ADD COLUMN `store_agent_send_commission` decimal(12,2) NOT NULL DEFAULT 0.00 COMMENT '门店股东-团队直接发放佣金,不包含平台设置的插件佣金';";
  23. $this->execute($sql);
  24. $sql = "INSERT INTO `qimall_global_var_map` (`name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('StoreBossAgent', '门店股东', 'IncomeMap', '1', '1', '1654569888', '1654569888');
  25. INSERT INTO `qimall_global_var_map` (`name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('StoreBossAgent', '门店股东', 'FromTypeMap', '1', '1', '1654569888', '1654569888');";
  26. $this->execute($sql);
  27. $sql = "CREATE TABLE `qimall_addons_store_boss_agent` (
  28. `id` int(11) NOT NULL AUTO_INCREMENT,
  29. `mall_id` int(11) NOT NULL,
  30. `user_id` int(11) NOT NULL,
  31. `store_id` int(11) NOT NULL DEFAULT '0',
  32. `remarks` longtext COMMENT '备注',
  33. `status` tinyint(1) NOT NULL DEFAULT '1',
  34. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  35. `deleted_at` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间',
  36. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  37. `upgrade_level_at` int(11) NOT NULL DEFAULT '0' COMMENT '分销商等级升级时间',
  38. `total_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '累计佣金',
  39. `frozen_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '冻结佣金',
  40. `delete_reason` text COMMENT '删除原因',
  41. `upgrade_status` smallint(6) NOT NULL DEFAULT '0' COMMENT '1条件升级 2 购买指定商品升级 3手动升级',
  42. `level` tinyint(4) NOT NULL DEFAULT '0' COMMENT '经销商等级',
  43. PRIMARY KEY (`id`) USING BTREE,
  44. KEY `mall_id` (`mall_id`) USING BTREE,
  45. KEY `is_delete` (`status`) USING BTREE,
  46. KEY `user_id` (`user_id`) USING BTREE
  47. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;";
  48. $this->execute($sql);
  49. $sql = "CREATE TABLE `qimall_addons_store_boss_agent_commission_log` (
  50. `id` int(10) NOT NULL AUTO_INCREMENT,
  51. `mall_id` int(10) NOT NULL DEFAULT '0' COMMENT '商城ID',
  52. `user_id` int(10) NOT NULL DEFAULT '0' COMMENT '用户ID',
  53. `store_id` int(10) NOT NULL DEFAULT '0',
  54. `commission` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '永久/额外佣金,单位:元',
  55. `source_table` varchar(255) CHARACTER SET utf8mb4 NOT NULL DEFAULT '0' COMMENT '来源表',
  56. `source_table_id` int(11) NOT NULL DEFAULT '0' COMMENT '来源表id',
  57. `is_settle` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已结算 0 否 1 是',
  58. `desc` varchar(255) NOT NULL DEFAULT '' COMMENT '说明',
  59. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  60. `order_no` varchar(100) CHARACTER SET utf8mb4 NOT NULL DEFAULT '' COMMENT '订单编号',
  61. `created_at` int(10) NOT NULL DEFAULT '0',
  62. `updated_at` int(10) NOT NULL DEFAULT '0',
  63. `level` int(11) NOT NULL DEFAULT '-1' COMMENT '结算时等级',
  64. PRIMARY KEY (`id`) USING BTREE,
  65. KEY `mall_id+user_id` (`mall_id`,`user_id`) USING BTREE
  66. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='股东分红记录表';";
  67. $this->execute($sql);
  68. $sql = "CREATE TABLE `qimall_addons_store_boss_agent_commission_setting_log` (
  69. `id` bigint(11) NOT NULL AUTO_INCREMENT,
  70. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
  71. `store_id` int(11) NOT NULL DEFAULT '0',
  72. `source_table` varchar(255) NOT NULL DEFAULT '0' COMMENT '来源表',
  73. `source_table_id` int(11) NOT NULL DEFAULT '0' COMMENT '来源表id',
  74. `basic_config` text COMMENT '基础配置',
  75. `level_config` text COMMENT '等级配置',
  76. `status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '状态[-1:删除;0:禁用;1启用]',
  77. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  78. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  79. PRIMARY KEY (`id`) USING BTREE,
  80. KEY `mall_id` (`mall_id`) USING BTREE
  81. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='团队奖励计算依据';";
  82. $this->execute($sql);
  83. $sql = "CREATE TABLE `qimall_addons_store_boss_agent_level` (
  84. `id` int(11) NOT NULL AUTO_INCREMENT,
  85. `mall_id` int(11) NOT NULL DEFAULT '0',
  86. `store_id` int(11) unsigned NOT NULL DEFAULT '0',
  87. `level` int(11) NOT NULL DEFAULT '-1',
  88. `name` varchar(45) NOT NULL,
  89. `is_auto_upgrade` int(11) NOT NULL DEFAULT '0',
  90. `detail` varchar(255) NOT NULL DEFAULT '',
  91. `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '永久分红',
  92. `created_at` int(11) NOT NULL DEFAULT '0',
  93. `updated_at` int(11) NOT NULL DEFAULT '0',
  94. `checked_condition_values` longtext COMMENT '升级条件',
  95. `is_enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否启用',
  96. `checked_condition_keys` text COMMENT '升级条件选中的key集合',
  97. `condition_type` smallint(6) NOT NULL DEFAULT '0' COMMENT '0 未选择、1满足其一 2、满足所有',
  98. `upgrade_type_goods` smallint(6) NOT NULL DEFAULT '0',
  99. `upgrade_type_condition` smallint(6) NOT NULL DEFAULT '0',
  100. `goods_warehouse_ids` text COMMENT '商品仓库的ID',
  101. `goods_list` longtext COMMENT '商品列表',
  102. `goods_type` smallint(6) NOT NULL DEFAULT '0' COMMENT '商品升级类型',
  103. `buy_goods_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '0订单完成 1下单 完成',
  104. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[0禁用 1启用 -1删除]',
  105. PRIMARY KEY (`id`) USING BTREE
  106. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;";
  107. $this->execute($sql);
  108. $sql = "CREATE TABLE `qimall_addons_store_boss_agent_setting` (
  109. `id` int(11) NOT NULL AUTO_INCREMENT,
  110. `mall_id` int(11) NOT NULL,
  111. `store_id` int(11) NOT NULL DEFAULT '0',
  112. `key` varchar(255) NOT NULL,
  113. `value` longtext NOT NULL,
  114. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  115. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  116. `is_delete` int(11) NOT NULL DEFAULT '0' COMMENT '是否删除 0--未删除 1--已删除',
  117. `deleted_at` int(11) NOT NULL DEFAULT '0' COMMENT '删除时间',
  118. PRIMARY KEY (`id`) USING BTREE,
  119. KEY `mall_id` (`mall_id`) USING BTREE,
  120. KEY `key` (`key`(191)) USING BTREE
  121. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT;";
  122. $this->execute($sql);
  123. }
  124. /**
  125. * {@inheritdoc}
  126. */
  127. public function safeDown()
  128. {
  129. echo "M240102095457StoreBossAgent cannot be reverted.\n";
  130. return false;
  131. }
  132. /*
  133. // Use up()/down() to run migration code without a transaction.
  134. public function up()
  135. {
  136. }
  137. public function down()
  138. {
  139. echo "M240102095457StoreBossAgent cannot be reverted.\n";
  140. return false;
  141. }
  142. */
  143. }