M241119082148PriceDiffGiftPackage.php 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use addons\CloudStock\common\models\CloudStockDeductionDetail;
  4. use yii\db\Migration;
  5. /**
  6. * Class M241119082148PriceDiffGiftPackage
  7. */
  8. class M241119082148PriceDiffGiftPackage extends Migration
  9. {
  10. /**
  11. * {@inheritdoc}
  12. */
  13. public function safeUp()
  14. {
  15. $sql = "
  16. ALTER TABLE qimall_addons_cloud_stock_fill_order add price_difference_order_id int(11) not null default 0 COMMENT '价差礼包订单id';
  17. ALTER TABLE qimall_addons_cloud_stock_fill_order add price_difference_order_detail_id int(11) not null default 0 COMMENT '价差礼包订单详情id';
  18. ALTER TABLE qimall_addons_cloud_stock_agent_order add order_type tinyint(1) not null default 1 COMMENT '1:云仓自提;2:价差礼包自提';
  19. INSERT INTO `qimall_global_var_map` ( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ('recommend_reward', '推荐奖励', 'CapitalTypeMap', 0, 1, 1654569888, 1654569888);
  20. CREATE TABLE `qimall_addons_cloud_stock_price_difference_gift_package` (
  21. `id` int(11) NOT NULL AUTO_INCREMENT,
  22. `mall_id` int(11) NOT NULL COMMENT '商城id',
  23. `name` varchar(255) NOT NULL COMMENT '礼包名称',
  24. `pic_type` tinyint(255) NOT NULL DEFAULT '0' COMMENT '0:默认;1:自定义',
  25. `pic` varchar(255) NOT NULL COMMENT '礼包主图',
  26. `level` int(11) NOT NULL COMMENT '升级等级权重',
  27. `price` decimal(12,2) NOT NULL COMMENT '礼包金额',
  28. `goods_id` text,
  29. `recommend_reward` text COMMENT '推荐奖励设置',
  30. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  31. `created_at` int(11) NOT NULL DEFAULT '0',
  32. `updated_at` int(11) NOT NULL DEFAULT '0',
  33. PRIMARY KEY (`id`) USING BTREE
  34. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='价差礼包';
  35. CREATE TABLE `qimall_addons_cloud_stock_price_difference_order` (
  36. `id` int(11) NOT NULL AUTO_INCREMENT,
  37. `mall_id` int(11) NOT NULL COMMENT '商城id',
  38. `user_id` int(11) NOT NULL COMMENT '补货代理商用户id',
  39. `trade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '支付流水记录id',
  40. `address_id` int(11) NOT NULL DEFAULT '0' COMMENT '收货地址id',
  41. `receiver_name` varchar(255) NOT NULL DEFAULT '' COMMENT '收货人',
  42. `receiver_mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '收货人手机号',
  43. `address` varchar(1000) NOT NULL DEFAULT '' COMMENT '收货地址',
  44. `price_difference_gift_package_id` int(11) NOT NULL DEFAULT '0' COMMENT '价差礼包id',
  45. `pay_money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额',
  46. `shipping_money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '运费',
  47. `order_no` varchar(255) NOT NULL COMMENT '补货订单编号',
  48. `trade_no` varchar(255) NOT NULL DEFAULT '' COMMENT '支付流水号',
  49. `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '订单备注',
  50. `is_pay` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否支付',
  51. `pay_time` int(11) NOT NULL DEFAULT '0' COMMENT '支付时间',
  52. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  53. `created_at` int(11) NOT NULL DEFAULT '0',
  54. `updated_at` int(11) NOT NULL DEFAULT '0',
  55. `payment_type` tinyint(4) DEFAULT '0' COMMENT '支付类型',
  56. PRIMARY KEY (`id`) USING BTREE
  57. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='价差礼包订单表';
  58. CREATE TABLE `qimall_addons_cloud_stock_price_difference_order_detail` (
  59. `id` int(11) NOT NULL AUTO_INCREMENT,
  60. `mall_id` int(11) NOT NULL COMMENT '商城id',
  61. `user_id` int(11) NOT NULL COMMENT '补货代理商用户id',
  62. `price_difference_order_id` int(11) NOT NULL COMMENT '补货代理商用户id',
  63. `goods_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '支付金额',
  64. `goods_id` int(11) NOT NULL COMMENT '商品id',
  65. `self_pickup_num` int(11) NOT NULL DEFAULT '0' COMMENT '自提数量',
  66. `cloud_warehouse_num` int(11) NOT NULL DEFAULT '0' COMMENT '云仓数量',
  67. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  68. `created_at` int(11) NOT NULL DEFAULT '0',
  69. `updated_at` int(11) NOT NULL DEFAULT '0',
  70. PRIMARY KEY (`id`) USING BTREE
  71. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='价差礼包订单详情表';
  72. CREATE TABLE `qimall_addons_cloud_stock_price_difference_user_team_statistics` (
  73. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  74. `mall_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  75. `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  76. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  77. `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  78. `updated_at` int(10) NOT NULL DEFAULT '0' COMMENT '上次更新数据时间',
  79. `user_direct_pay_selling_price` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '直推已支付的订单售价总额(商品价格)',
  80. `user_indirect_pay_selling_price` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '间推已支付的订单售价总额(商品价格)',
  81. `team_pay_selling_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '团队已支付的订单售价总额(商品价格)',
  82. `self_selling_price` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '本人已支付的订单售价总额(商品价格)',
  83. PRIMARY KEY (`id`) USING BTREE,
  84. KEY `mall_id` (`mall_id`) USING BTREE,
  85. KEY `user_id` (`user_id`) USING BTREE
  86. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='价差礼包用户数据统计表';;
  87. ";
  88. $this->execute($sql);
  89. CloudStockDeductionDetail::fixOrderType();
  90. }
  91. /**
  92. * {@inheritdoc}
  93. */
  94. public function safeDown()
  95. {
  96. echo "M241119082148PriceDiffGiftPackage cannot be reverted.\n";
  97. return false;
  98. }
  99. /*
  100. // Use up()/down() to run migration code without a transaction.
  101. public function up()
  102. {
  103. }
  104. public function down()
  105. {
  106. echo "M241119082148PriceDiffGiftPackage cannot be reverted.\n";
  107. return false;
  108. }
  109. */
  110. }