M241101071836Huolihuoban1.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M241101071836Huolihuoban1
  6. */
  7. class M241101071836Huolihuoban1 extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "alter table qimall_addons_cloud_stock_goods add sort decimal(12,2) not null default 0 comment '排序值,小排前';
  15. alter table qimall_addons_cloud_stock_goods add min_replenish int(11) not null default 0 comment '最低进货数量';
  16. alter table qimall_addons_cloud_stock_goods add restrict_permissions varchar(255) not null default '' comment '限制权限';
  17. alter table qimall_addons_cloud_stock_agent add cloud_warehouse_frozen_price decimal(12,2) not null default 0 comment '云仓待结货款';
  18. alter table qimall_addons_cloud_stock_agent add cloud_warehouse_price decimal(12,2) not null default 0 comment '云仓已结货款';
  19. alter table qimall_addons_cloud_stock_agent add cloud_warehouse_withdraw_price decimal(12,2) not null default 0 comment '云仓已提现货款';
  20. INSERT INTO `qimall_global_var_map` ( `name`, `title`, `type`, `is_addons`, `status`, `created_at`, `updated_at`) VALUES ( 'cloud_stock_payment_transfer', '货款转余额', 'CapitalTypeMap', 0, 1, 1654569888, 1654569888);
  21. ALTER table qimall_addons_cloud_stock_delay_log add type tinyint(3) not null default 0 comment '0:云库存默认的(货款佣金,奖励之类);1:云仓货款';
  22. ";
  23. $this->execute($sql);
  24. $table = 'qimall_addons_cloud_stock_gift_plan';
  25. $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  26. $res = $this->db->createCommand($sql)->execute();
  27. if (empty($res)) {
  28. $sql = "CREATE TABLE `qimall_addons_cloud_stock_gift_plan` (
  29. `id` int(11) NOT NULL AUTO_INCREMENT,
  30. `mall_id` int(11) NOT NULL COMMENT '商城id',
  31. `goods_id` text,
  32. `give_goods_num` text,
  33. `give_goods_id` text,
  34. `gift_condition_level` varchar(255) NOT NULL DEFAULT '',
  35. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  36. `created_at` int(11) NOT NULL DEFAULT '0',
  37. `updated_at` int(11) NOT NULL DEFAULT '0',
  38. PRIMARY KEY (`id`) USING BTREE
  39. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='赠送方案';";
  40. $this->execute($sql);
  41. }
  42. $table = 'qimall_addons_cloud_stock_payment_log';
  43. $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  44. $res = $this->db->createCommand($sql)->execute();
  45. if (empty($res)) {
  46. $sql = "CREATE TABLE `qimall_addons_cloud_stock_payment_log` (
  47. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  48. `mall_id` int(11) unsigned NOT NULL,
  49. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT 'store_id',
  50. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '会员id',
  51. `buy_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '来源会员id',
  52. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
  53. `goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称',
  54. `pic_url` varchar(255) NOT NULL DEFAULT '' COMMENT '商品主图',
  55. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
  56. `order_detail_id` int(11) unsigned NOT NULL COMMENT '订单详情id',
  57. `num` int(11) unsigned NOT NULL COMMENT '商品件数',
  58. `order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '订单编号',
  59. `money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '金额',
  60. `type` varchar(50) NOT NULL DEFAULT '' COMMENT '货款类型:fill:补货货款;buying:会员买货',
  61. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:待结算;1已结算]',
  62. `created_at` int(10) unsigned NOT NULL DEFAULT '0',
  63. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  64. PRIMARY KEY (`id`),
  65. KEY `idx_user_id` (`user_id`)
  66. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='云仓货款记录表';";
  67. $this->execute($sql);
  68. }
  69. }
  70. /**
  71. * {@inheritdoc}
  72. */
  73. public function safeDown()
  74. {
  75. echo "M241101071836Huolihuoban1 cannot be reverted.\n";
  76. return false;
  77. }
  78. /*
  79. // Use up()/down() to run migration code without a transaction.
  80. public function up()
  81. {
  82. }
  83. public function down()
  84. {
  85. echo "M241101071836Huolihuoban1 cannot be reverted.\n";
  86. return false;
  87. }
  88. */
  89. }