M240103081935MixedPay.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240103081935MixedPay
  6. */
  7. class M240103081935MixedPay extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_payment_trade_group_order` (
  15. `id` int(11) NOT NULL AUTO_INCREMENT,
  16. `trade_id` int(11) NOT NULL DEFAULT '0' COMMENT '流水表ID',
  17. `order_no` varchar(32) NOT NULL DEFAULT '' COMMENT '订单号',
  18. `order_type` varchar(32) NOT NULL DEFAULT '' COMMENT '订单类型',
  19. `pay_fee` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单支付金额',
  20. `total_fee` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单总金额,pay_fee+rand_fee',
  21. `rand_fee` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单随机减金额',
  22. `is_pay` int(1) NOT NULL DEFAULT '0' COMMENT '支付状态:0=未支付,1=已支付',
  23. `pay_type` int(1) NOT NULL DEFAULT '0' COMMENT '支付方式:1=微信支付,2=货到付款,3=余额支付,4=支付宝支付,5=银联支付,6=汇聚聚合支付,7=汇聚快捷支付',
  24. `title` varchar(128) NOT NULL DEFAULT '' COMMENT '标题',
  25. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  26. `updated_at` int(11) NOT NULL DEFAULT '0',
  27. `notify_class` varchar(512) NOT NULL DEFAULT '',
  28. `refund_fee` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '退款金额',
  29. PRIMARY KEY (`id`) USING BTREE,
  30. KEY `union_id` (`trade_id`) USING BTREE,
  31. KEY `order_no` (`order_no`) USING BTREE
  32. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='订单组合支付记录表';";
  33. $this->execute($sql);
  34. $sql = "ALTER TABLE `qimall_payment_trade`
  35. ADD COLUMN `is_pay_group` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否组合支付订单 0 否 1 是',
  36. ADD COLUMN `parent_trade_id` int(11) NOT NULL DEFAULT 0 COMMENT '关联上级支付流水id(组合支付子订单不为空)';";
  37. $this->execute($sql);
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function safeDown()
  43. {
  44. echo "M240103081935MixedPay cannot be reverted.\n";
  45. return false;
  46. }
  47. /*
  48. // Use up()/down() to run migration code without a transaction.
  49. public function up()
  50. {
  51. }
  52. public function down()
  53. {
  54. echo "M240103081935MixedPay cannot be reverted.\n";
  55. return false;
  56. }
  57. */
  58. }