M240508015929CreateTableQimallAddonsStoreClerkIncome.php 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240508015929CreateTableQimallAddonsStoreClerkIncome
  6. */
  7. class M240508015929CreateTableQimallAddonsStoreClerkIncome extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_addons_store_clerk_income`(
  15. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  16. `mall_id` int(11) NOT NULL DEFAULT 0,
  17. `store_id` int(11) NOT NULL DEFAULT 0 COMMENT '门店id',
  18. `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '会员id',
  19. `clerk_id` int(11) NOT NULL DEFAULT 0 COMMENT '核销员id',
  20. `mobile` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '电话',
  21. `order_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '订单编号',
  22. `amount` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '核销金额',
  23. `income` decimal(12, 2) NOT NULL COMMENT '核销收益',
  24. `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态[0禁用 1启用 -1删除]',
  25. `e_coupon_name` varchar(128) NOT NULL DEFAULT '' COMMENT '电子券名称',
  26. `e_coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '电子券id',
  27. `user_e_coupon_id` int(11) NOT NULL DEFAULT 0 COMMENT '会员电子券id',
  28. `num` int(11) NOT NULL DEFAULT 0 COMMENT '数量',
  29. `clerk_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '核销员id',
  30. `clerk_admin_id` int(11) NOT NULL DEFAULT 0 COMMENT '核销管理员',
  31. `proper_user_id` int(11) NOT NULL DEFAULT 0 COMMENT '专有者id',
  32. `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
  33. `updated_at` int(11) NOT NULL DEFAULT 0 COMMENT '修改时间',
  34. PRIMARY KEY (`id`) USING BTREE
  35. ) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '门店核销收益'";
  36. $this->execute($sql);
  37. $sql = "CREATE TABLE `qimall_addons_store_clerk_income_data` (
  38. `id` int(11) NOT NULL AUTO_INCREMENT,
  39. `store_id` int(11) NOT NULL,
  40. `mall_id` int(11) NOT NULL,
  41. `total_amount` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '总金额',
  42. `total_count` int(11) NOT NULL DEFAULT 0 COMMENT '总次数',
  43. `total_income` decimal(12, 2) NOT NULL DEFAULT 0.00 COMMENT '总收益',
  44. `created_at` int(11) NOT NULL DEFAULT 0,
  45. `updated_at` int(11) NOT NULL DEFAULT 0,
  46. `status` int(4) NOT NULL DEFAULT 1,
  47. PRIMARY KEY (`id`) USING BTREE
  48. ) ENGINE = InnoDB AUTO_INCREMENT = 1 COMMENT = '门店核销统计'";
  49. $this->execute($sql);
  50. $sql="INSERT INTO `qimall_addons_store_menu`(`title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`, `addons_name`, `is_addon`) VALUES ( '核销收益', '0', 105, 'store/clerk/index/clerk-income', '', 2, 0, 999, NULL, '', 1, 0, 0, 'Clerk', 1);";
  51. $this->execute($sql);
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function safeDown()
  57. {
  58. echo "M240508015929CreateTableQimallAddonsStoreClerkIncome cannot be reverted.\n";
  59. return false;
  60. }
  61. /*
  62. // Use up()/down() to run migration code without a transaction.
  63. public function up()
  64. {
  65. }
  66. public function down()
  67. {
  68. echo "M240424015929AlterQimallAddonsStoreSettings cannot be reverted.\n";
  69. return false;
  70. }
  71. */
  72. }