M230717100157QimallAddonsCloudStockBonusPoolLog.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230717100157QimallAddonsCloudStockBonusPoolLog
  6. */
  7. class M230717100157QimallAddonsCloudStockBonusPoolLog extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $table = 'qimall_addons_cloud_stock_bonus_pool_log';
  16. $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  17. $res = $this->db->createCommand($sql)->execute();
  18. if(!empty($res)) return '';
  19. $sql="CREATE TABLE `qimall_addons_cloud_stock_bonus_pool_log` (
  20. `id` int(10) NOT NULL AUTO_INCREMENT,
  21. `mall_id` int(11) NOT NULL COMMENT '商城ID',
  22. `level` int(11) NOT NULL DEFAULT '0' COMMENT '分红池等级',
  23. `start` bigint(20) NOT NULL DEFAULT '0' COMMENT '开始时间',
  24. `end` bigint(20) NOT NULL DEFAULT '0' COMMENT '结束时间',
  25. `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '当前分红池金额',
  26. `dispatch_money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '分出去金额',
  27. `people` int(11) NOT NULL DEFAULT '0' COMMENT '人数',
  28. `is_upgrade_bag_give_goods_pool` tinyint(1) NOT NULL DEFAULT '0' COMMENT '开启云仓代理升级礼包赠送的商品计算补货盒数,关闭则不计算',
  29. `is_superposition` tinyint(1) NOT NULL DEFAULT '0' COMMENT '分红池开关:每个分红池可以开启是否可以叠加分红,开启则进行叠加,关闭则不叠加',
  30. `pool_settlement_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '结算类型:0:月;1:季度',
  31. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  32. `created_at` bigint(20) DEFAULT NULL,
  33. `updated_at` bigint(20) DEFAULT NULL,
  34. PRIMARY KEY (`id`) USING BTREE
  35. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='云库存分红池记录';";
  36. $this->execute($sql);
  37. }catch (\Exception $e){
  38. }
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function safeDown()
  44. {
  45. echo "M230717100157QimallAddonsCloudStockBonusPoolLog cannot be reverted.\n";
  46. return false;
  47. }
  48. /*
  49. // Use up()/down() to run migration code without a transaction.
  50. public function up()
  51. {
  52. }
  53. public function down()
  54. {
  55. echo "M230717100157QimallAddonsCloudStockBonusPoolLog cannot be reverted.\n";
  56. return false;
  57. }
  58. */
  59. }