M230322022448AddonsMchTaodonglai.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace addons\Mch\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230322022448AddonsMchTaodonglai
  6. */
  7. class M230322022448AddonsMchTaodonglai extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_addons_mch_settlement_log` (
  15. `id` int(11) NOT NULL AUTO_INCREMENT,
  16. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id',
  17. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  18. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  19. `created_at` int(11) NOT NULL DEFAULT '0',
  20. `updated_at` int(11) NOT NULL DEFAULT '0',
  21. `order_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '订单编号',
  22. `is_settlement` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已结算',
  23. `settlement_at` int(11) NOT NULL DEFAULT '0' COMMENT '结算时间',
  24. PRIMARY KEY (`id`) USING BTREE
  25. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='多商户结算记录表';";
  26. $sql .= "INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('多商户订单结算', 'mch/index/settlement-log', '1', '0 */30 * * * *', '0', '1', '1679104279', '1679104279');";
  27. $this->execute($sql);
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function safeDown()
  33. {
  34. echo "M230322022448AddonsMchTaodonglai cannot be reverted.\n";
  35. return false;
  36. }
  37. /*
  38. // Use up()/down() to run migration code without a transaction.
  39. public function up()
  40. {
  41. }
  42. public function down()
  43. {
  44. echo "M230322022448AddonsMchTaodonglai cannot be reverted.\n";
  45. return false;
  46. }
  47. */
  48. }