M250623092404CreateScoreExpansionRecommendRewardOrderTable.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace addons\ScoreExpansion\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Handles the creation of table `{{%score_expansion_recommend_reward_order}}`.
  6. */
  7. class M250623092404CreateScoreExpansionRecommendRewardOrderTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_addons_score_expansion_recommend_reward_order` (
  16. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(10) unsigned NOT NULL DEFAULT '0',
  18. `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '下单User Id',
  19. `user_ids` json DEFAULT NULL COMMENT '第一轮之后定下来的关系链',
  20. `exclude_user_ids` json DEFAULT NULL COMMENT '第二轮开始谁不满足条件排除的user id,存在这里面的user id之后循环都不会奖励',
  21. `order_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  22. `order_detail_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单详情ID',
  23. `reward_period` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '奖励周期 0每天',
  24. `frozen_score_issued_total` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '已发放的冻结积分',
  25. `reward_frozen_score` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '每轮奖励多少个冻结积分',
  26. `reward_person_count` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '奖励人数',
  27. `loop_num` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '循环轮数',
  28. `current_loop_num` smallint(5) unsigned NOT NULL DEFAULT '1' COMMENT '当前循环到第几轮了',
  29. `current_reward_person_index` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '第二轮开始,记录每轮奖励到第几人',
  30. `is_end` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否结束',
  31. `last_exec_date` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '最后一次执行奖励时间',
  32. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  33. `created_at` int(10) unsigned NOT NULL DEFAULT '0',
  34. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  35. PRIMARY KEY (`id`)
  36. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='已参与推荐奖励的订单记录表';
  37. SQL;
  38. $this->execute($sql);
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function safeDown()
  44. {
  45. return false;
  46. }
  47. }