install.sql 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. CREATE TABLE `qimall_addons_electron_coupon` (
  2. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  3. `mall_id` int(11) DEFAULT '0' COMMENT '商城id',
  4. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '电子券名称',
  5. `amount` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发行数量;单张券为张',
  6. `receive_times` int(11) NOT NULL DEFAULT '0' COMMENT '最多领取次数',
  7. `unlimit_receive_times` tinyint(4) NOT NULL DEFAULT '0' COMMENT '领取次数不限制',
  8. `pieces_type` int(4) NOT NULL DEFAULT '1' COMMENT '1单张2多张;',
  9. `pieces_amount` int(11) NOT NULL DEFAULT '0' COMMENT '多张数量;单位张',
  10. `receive_codition` int(4) NOT NULL DEFAULT '1' COMMENT '领取条件;1全体会员;2指定会员等级;',
  11. `receive_member_level` int(4) DEFAULT '0' COMMENT '指定会员等级;默认为null',
  12. `receive_begin_time` int(11) DEFAULT '0' COMMENT '领取开始时间',
  13. `receive_end_time` int(11) DEFAULT '0' COMMENT '领取结束时间',
  14. `use_begin_time` int(11) DEFAULT '0' COMMENT '使用开始时间',
  15. `use_end_time` int(11) DEFAULT '0' COMMENT '使用结束时间',
  16. `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '激活金额',
  17. `use_way` int(4) NOT NULL DEFAULT '1' COMMENT '适用范围;1扫描核销',
  18. `is_can_receive` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否可以被领取',
  19. `is_show_in_center` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否出现在领取中心',
  20. `rules` text COMMENT '电子券规则',
  21. `pic` varchar(255) DEFAULT NULL COMMENT '缩略图',
  22. `receive_amount` int(11) NOT NULL DEFAULT '0' COMMENT '领取数量;单张券为张;',
  23. `used_amount` int(11) NOT NULL DEFAULT '0' COMMENT '兑换数量;单位张或多张',
  24. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  25. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
  26. `sort` int(11) NOT NULL DEFAULT '0' COMMENT '排序;由大到小',
  27. `is_give` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否赠送电子券',
  28. `is_proper` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否专有券',
  29. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  30. `give_score` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送积分',
  31. `give_price` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送佣金',
  32. PRIMARY KEY (`id`),
  33. KEY `mall_id` (`mall_id`) USING BTREE
  34. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='电子券';
  35. CREATE TABLE `qimall_addons_electron_coupon_approval_income_log` (
  36. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  37. `e_coupon_code_id` int(11) NOT NULL COMMENT '核销码id',
  38. `user_e_coupon_id` int(11) NOT NULL COMMENT '会员电子券id',
  39. `e_coupon_id` int(11) NOT NULL COMMENT '电子券id',
  40. `created_at` int(11) NOT NULL DEFAULT '0',
  41. `updated_at` int(11) NOT NULL DEFAULT '0',
  42. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  43. `user_id` int(11) NOT NULL COMMENT '使用会员user_id',
  44. `e_coupon_name` varchar(255) NOT NULL COMMENT '电子券名称',
  45. `amount` int(11) NOT NULL DEFAULT '1' COMMENT '数量',
  46. `mall_id` int(11) DEFAULT NULL COMMENT '商城id',
  47. `price_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '收益类型1积分2佣金',
  48. `commission` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '积分或佣金金额',
  49. `clerk_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销员user_id',
  50. `clerk_admin_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销员admin_id(后台核销)',
  51. PRIMARY KEY (`id`),
  52. KEY `mall_id` (`mall_id`) USING BTREE
  53. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='电子券核销收益明细表';
  54. CREATE TABLE `qimall_addons_electron_coupon_code` (
  55. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  56. `user_e_coupon_id` int(11) NOT NULL COMMENT '会员电子券id',
  57. `user_id` int(11) NOT NULL COMMENT '会员电子券所有者',
  58. `amount` int(11) NOT NULL COMMENT '数量',
  59. `code` bigint(20) NOT NULL COMMENT '核销码唯一',
  60. `created_at` int(11) NOT NULL DEFAULT '0',
  61. `updated_at` int(11) NOT NULL DEFAULT '0',
  62. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  63. `coupon_status` int(11) NOT NULL DEFAULT '0' COMMENT '状态;1已核销;0未核销',
  64. `clerk_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销员用户id',
  65. `clerk_admin_id` int(11) DEFAULT '0' COMMENT '核销管理员id',
  66. `approval_at` int(11) DEFAULT '0' COMMENT '核销时间',
  67. `mall_id` int(11) NOT NULL COMMENT '商城id',
  68. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  69. PRIMARY KEY (`id`),
  70. UNIQUE KEY `code` (`code`) USING BTREE COMMENT '核销码',
  71. KEY `mall_id` (`mall_id`) USING BTREE
  72. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='电子券核销码表';
  73. CREATE TABLE `qimall_addons_electron_coupon_give_log` (
  74. `id` int(11) NOT NULL AUTO_INCREMENT,
  75. `mall_id` int(11) NOT NULL COMMENT '商城id',
  76. `e_coupon_id` int(11) NOT NULL COMMENT '电子券id',
  77. `user_id` int(11) NOT NULL COMMENT '接收者id',
  78. `give_user_id` int(11) NOT NULL COMMENT '赠送者id',
  79. `e_coupon_name` varchar(255) NOT NULL DEFAULT '' COMMENT '电子券名称',
  80. `amount` int(11) NOT NULL DEFAULT '1' COMMENT '赠送数量',
  81. `is_proper` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否专有者',
  82. `proper_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '专有者id',
  83. `created_at` int(11) NOT NULL DEFAULT '0',
  84. `updated_at` int(11) NOT NULL DEFAULT '0',
  85. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  86. PRIMARY KEY (`id`) USING BTREE,
  87. KEY `mall_id` (`mall_id`) USING BTREE
  88. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='电子券赠送记录';
  89. CREATE TABLE `qimall_addons_electron_coupon_goods` (
  90. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  91. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  92. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
  93. `goods_id` int(11) NOT NULL COMMENT '商品id',
  94. `e_coupon_id` int(11) DEFAULT '0' COMMENT '电子券id',
  95. `is_open` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否开启',
  96. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  97. `mall_id` int(11) NOT NULL COMMENT '商城id',
  98. `num` int(11) DEFAULT '0' COMMENT '赠送数量',
  99. PRIMARY KEY (`id`),
  100. KEY `mall_id` (`mall_id`) USING BTREE
  101. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='商品发放电子券表';
  102. CREATE TABLE `qimall_addons_electron_coupon_order` (
  103. `id` int(11) NOT NULL AUTO_INCREMENT,
  104. `trade_no` varchar(32) DEFAULT '' COMMENT '流水号',
  105. `order_no` varchar(32) NOT NULL DEFAULT '' COMMENT '订单号',
  106. `user_id` int(11) NOT NULL COMMENT '用户id',
  107. `user_e_coupon_id` int(11) NOT NULL COMMENT '会员电子券id',
  108. `price` decimal(10,2) NOT NULL COMMENT '金额',
  109. `created_at` int(11) NOT NULL DEFAULT '0',
  110. `updated_at` int(11) NOT NULL DEFAULT '0',
  111. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  112. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城id',
  113. `is_pay` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否支付',
  114. `pay_type` varchar(32) DEFAULT '' COMMENT '支付方式',
  115. `pay_time` int(11) DEFAULT '0' COMMENT '支付时间',
  116. `number` int(11) NOT NULL DEFAULT '0' COMMENT '数量',
  117. PRIMARY KEY (`id`),
  118. KEY `mall_id` (`mall_id`) USING BTREE
  119. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='电子券订单';
  120. CREATE TABLE `qimall_addons_electron_coupon_usage_log` (
  121. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
  122. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城id',
  123. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '使用者',
  124. `user_e_coupon_id` int(11) DEFAULT NULL COMMENT '会员电子券id',
  125. `e_coupon_id` int(11) NOT NULL DEFAULT '0' COMMENT '电子券ID',
  126. `e_coupon_name` varchar(128) NOT NULL DEFAULT '' COMMENT '电子券名称',
  127. `clerk_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '核销员',
  128. `clerk_admin_id` int(11) DEFAULT '0' COMMENT '核销管理员',
  129. `proper_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '专有者',
  130. `receive_time` int(11) NOT NULL DEFAULT '0' COMMENT '领取时间',
  131. `usage_time` int(11) NOT NULL DEFAULT '0' COMMENT '使用时间',
  132. `amount` int(11) NOT NULL DEFAULT '0' COMMENT '使用数量',
  133. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  134. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  135. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
  136. PRIMARY KEY (`id`),
  137. KEY `mall_id` (`mall_id`) USING BTREE
  138. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='电子券使用记录';
  139. CREATE TABLE `qimall_addons_electron_coupon_user_coupon` (
  140. `id` int(11) NOT NULL AUTO_INCREMENT,
  141. `e_coupon_id` int(11) NOT NULL COMMENT '电子券id',
  142. `receive_begin_time` int(11) DEFAULT '0' COMMENT '领取开始时间',
  143. `receive_end_time` int(11) DEFAULT '0' COMMENT '领取结束时间',
  144. `use_begin_time` int(11) DEFAULT '0' COMMENT '使用开始时间',
  145. `use_end_time` int(11) DEFAULT '0' COMMENT '使用结束时间',
  146. `price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '金额',
  147. `get_type` tinyint(4) NOT NULL DEFAULT '1' COMMENT '获取方式,1是领取,2是购买商品获得,3是系统发放',
  148. `use_way` tinyint(4) NOT NULL DEFAULT '1' COMMENT '适用范围;1扫描核销',
  149. `receive_times` int(11) NOT NULL DEFAULT '0' COMMENT '领取次数',
  150. `receive_amount` int(11) NOT NULL DEFAULT '0' COMMENT '领取数量;未激活',
  151. `active_amount` int(11) NOT NULL DEFAULT '0' COMMENT '激活数量;',
  152. `used_amount` int(11) NOT NULL DEFAULT '0' COMMENT '兑换数量;即使用数量',
  153. `num` int(11) NOT NULL DEFAULT '0' COMMENT '电子卷总数',
  154. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  155. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
  156. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城id',
  157. `user_id` int(11) NOT NULL COMMENT '用户id',
  158. `last_used_time` int(11) DEFAULT '0' COMMENT '最新兑换时间',
  159. `last_receive_time` int(11) DEFAULT '0' COMMENT '最新领取时间',
  160. `last_active_time` int(11) DEFAULT '0' COMMENT '最新激活时间',
  161. `is_proper` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否专有券',
  162. `giver_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '赠送者id',
  163. `proper_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '专有者id',
  164. `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id',
  165. `status` tinyint(4) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  166. PRIMARY KEY (`id`),
  167. KEY `mall_id` (`mall_id`) USING BTREE
  168. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='会员电子券';