M230717100111QimallAddonsCloudStockFillStatistics.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230717100111QimallAddonsCloudStockFillStatistics
  6. */
  7. class M230717100111QimallAddonsCloudStockFillStatistics extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $table = 'qimall_addons_cloud_stock_fill_statistics';
  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_fill_statistics` (
  20. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  21. `mall_id` int(11) NOT NULL COMMENT '商城id',
  22. `user_id` int(11) NOT NULL COMMENT '增加库存代理商用户id',
  23. `level` int(11) NOT NULL DEFAULT '0' COMMENT '代理等级',
  24. `self_num` int(11) NOT NULL COMMENT '自身补货数量',
  25. `direct_num` int(11) NOT NULL COMMENT '直推们的数量,等级一致',
  26. `indirect_num` int(11) NOT NULL COMMENT '间推们数量,等级一致',
  27. `start` bigint(20) NOT NULL DEFAULT '0',
  28. `end` bigint(20) NOT NULL DEFAULT '0',
  29. `money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '奖励金额',
  30. `award_proportion_settlement_type` tinyint(1) NOT NULL DEFAULT '0',
  31. `is_upgrade_bag_give_goods` tinyint(1) NOT NULL DEFAULT '0',
  32. `is_equal_2_step` tinyint(1) NOT NULL DEFAULT '0',
  33. `award_proportion` text NOT NULL COMMENT 'award_proportion',
  34. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  35. `created_at` bigint(20) NOT NULL DEFAULT '0',
  36. `updated_at` bigint(20) NOT NULL DEFAULT '0',
  37. PRIMARY KEY (`id`) USING BTREE
  38. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='云库存补货统计表';";
  39. $this->execute($sql);
  40. }catch (\Exception $e){
  41. }
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function safeDown()
  47. {
  48. echo "M230717100111QimallAddonsCloudStockFillStatistics cannot be reverted.\n";
  49. return false;
  50. }
  51. /*
  52. // Use up()/down() to run migration code without a transaction.
  53. public function up()
  54. {
  55. }
  56. public function down()
  57. {
  58. echo "M230717100111QimallAddonsCloudStockFillStatistics cannot be reverted.\n";
  59. return false;
  60. }
  61. */
  62. }