M230710022029SmartFormSmsNotice.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace addons\SmartForm\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230710022029SmartFormSmsNotice
  6. */
  7. class M230710022029SmartFormSmsNotice extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $this->execute("ALTER TABLE `qimall_addons_smart_form_template_column`
  15. ADD COLUMN `extra_data` JSON NULL DEFAULT NULL COMMENT '扩展数据' AFTER `content_type`;");
  16. $this->execute("ALTER TABLE `qimall_addons_smart_form_template`
  17. ADD COLUMN `is_repeat` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否支持重复' AFTER `updated_at`;");
  18. $this->execute("CREATE TABLE `qimall_addons_smart_form_sms_notice` (
  19. `id` INT(10) NOT NULL AUTO_INCREMENT,
  20. `status` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '状态[0:禁用;1:启用,2:已过期]',
  21. `created_at` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '添加时间',
  22. `updated_at` INT(10) NOT NULL DEFAULT '0',
  23. `mall_id` INT(10) NOT NULL DEFAULT '0',
  24. `user_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户',
  25. `content` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '发送内容' COLLATE 'utf8mb4_general_ci',
  26. `send_at` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '发送时间',
  27. `send_var` JSON NULL DEFAULT NULL COMMENT '发送变量',
  28. `send_status` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0待发送,1可以发送,10发送中,20已过期,30已取消,50发送失败,100发送成功',
  29. `send_res` JSON NULL DEFAULT NULL COMMENT '发送结果',
  30. `template_id` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '模板ID' COLLATE 'utf8mb4_general_ci',
  31. `column_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '字段ID',
  32. `goods_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '绑定的商品ID',
  33. `user_form_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '用户填写的表单ID',
  34. `order_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '订单ID',
  35. PRIMARY KEY (`id`) USING BTREE,
  36. INDEX `send_at` (`send_at`) USING BTREE,
  37. INDEX `user_id` (`user_id`) USING BTREE,
  38. INDEX `goods_id` (`goods_id`) USING BTREE,
  39. INDEX `order_id` (`order_id`) USING BTREE
  40. )
  41. COMMENT='短信通知'
  42. COLLATE='utf8mb4_general_ci'
  43. ENGINE=InnoDB;");
  44. $this->execute("INSERT INTO `qimall_crontab_task` (`name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('智能表单 - 每分钟执行短信通知', 'smart-form/sms-notice/send', 2, '0 */1 * * * *', 0, 1, 1688955476, 1688955486);");
  45. }
  46. /**
  47. * {@inheritdoc}
  48. */
  49. public function safeDown()
  50. {
  51. echo "M230710022029SmartFormSmsNotice cannot be reverted.\n";
  52. return false;
  53. }
  54. /*
  55. // Use up()/down() to run migration code without a transaction.
  56. public function up()
  57. {
  58. }
  59. public function down()
  60. {
  61. echo "M230710022029SmartFormSmsNotice cannot be reverted.\n";
  62. return false;
  63. }
  64. */
  65. }