M230922021030OrderInvoice.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230922021030OrderInvoice
  6. */
  7. class M230922021030OrderInvoice extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "ALTER TABLE `qimall_order` ADD COLUMN `is_bill` tinyint(1) NULL DEFAULT 0 COMMENT '是否已开票 0 否 1 是', ADD COLUMN `bill_time` int(11) NULL DEFAULT 0 COMMENT '开票时间';";
  15. $this->execute($sql);
  16. $sql = "INSERT INTO `qimall_menu` (`title`, `app_id`, `cate_id`, `addons_name`, `is_addon`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES ('开票记录', 'backend', '2', '', '0', '33', 'mall/order/invoice', '', '2', '1', '999', NULL, ' tr_33', '1', '1695117641', '1695117641');";
  17. $this->execute($sql);
  18. $sql = "CREATE TABLE `qimall_order_invoice` (
  19. `id` int(11) NOT NULL AUTO_INCREMENT,
  20. `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
  21. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
  22. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单ID',
  23. `order_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '订单编号',
  24. `pay_money` decimal(10,2) DEFAULT NULL COMMENT '订单实付金额',
  25. `type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '发票类型',
  26. `head_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '抬头类型',
  27. `head_name` varchar(100) NOT NULL DEFAULT '' COMMENT '发票抬头',
  28. `bank_name` varchar(100) NOT NULL DEFAULT '' COMMENT '开户银行',
  29. `account` varchar(100) NOT NULL DEFAULT '' COMMENT '开户账户',
  30. `email` varchar(100) NOT NULL DEFAULT '' COMMENT '邮箱号',
  31. `address` varchar(255) NOT NULL DEFAULT '' COMMENT '地址',
  32. `mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '电话',
  33. `tax_no` varchar(100) NOT NULL DEFAULT '' COMMENT '税号',
  34. `invoice_status` int(6) DEFAULT '0' COMMENT '开票状态 0 申请中 1 已同意 2 已拒绝',
  35. `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
  36. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  37. `created_at` int(10) NOT NULL DEFAULT '0',
  38. `updated_at` int(10) NOT NULL DEFAULT '0',
  39. PRIMARY KEY (`id`),
  40. KEY `order_id` (`order_id`) USING BTREE
  41. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;";
  42. $this->execute($sql);
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function safeDown()
  48. {
  49. echo "M230922021030OrderInvoice cannot be reverted.\n";
  50. return false;
  51. }
  52. /*
  53. // Use up()/down() to run migration code without a transaction.
  54. public function up()
  55. {
  56. }
  57. public function down()
  58. {
  59. echo "M230922021030OrderInvoice cannot be reverted.\n";
  60. return false;
  61. }
  62. */
  63. }