migrate.sql 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. INSERT INTO `qimall_link_category`(`name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ('store', 'O2O门店', 19, 1, '', 1, 1652410559, 1653104876);
  2. INSERT INTO `qimall_link_category`(`name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ('store_cate', 'O2O门店分类', 19, 1, '', 1, 1653104617, 1653105081);
  3. INSERT INTO `qimall_link_category`(`name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ('store_goods', 'O2O门店商品', 19, 1, '', 1, 1655275847, 1655275867);
  4. ALTER TABLE qimall_addons_store_commission add `settle_type` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1,2,3平台承担,4门店承担';
  5. CREATE TABLE `qimall_addons_store_video` (
  6. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  7. `mall_id` int(10) unsigned NOT NULL COMMENT '商城id',
  8. `store_id` int(10) unsigned NOT NULL COMMENT '门店id',
  9. `user_id` int(10) unsigned NOT NULL COMMENT '用户id',
  10. `title` varchar(255) NOT NULL DEFAULT '' COMMENT '标题',
  11. `content` varchar(255) NOT NULL DEFAULT '' COMMENT '内容',
  12. `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店商品id',
  13. `reward_amount` DECIMAL(10,2) NOT NULL DEFAULT '0.00' COMMENT '用户观看后奖励金额',
  14. `viewing_times` int(10) NOT NULL DEFAULT '0' COMMENT '观看次数',
  15. `video_url` varchar(255) NOT NULL DEFAULT '' COMMENT '视频路径',
  16. `first_frame` varchar(255) NOT NULL DEFAULT '' COMMENT '首帧',
  17. `video_wide` int(11) NOT NULL DEFAULT '0' COMMENT '视频宽度',
  18. `video_long` int(11) NOT NULL DEFAULT '0' COMMENT '视频长度',
  19. `duration_str` varchar(20) NOT NULL DEFAULT '' COMMENT '视频时长(时分秒字符串形式),upload_type = video 时才有意义',
  20. `duration_seconds` float(6,2) NOT NULL DEFAULT '0.00' COMMENT '视频时长(秒为单位浮点数形式),upload_type = video 时才有意义',
  21. `is_on_sale` smallint(1) NOT NULL DEFAULT '0' COMMENT '上架状态【1是 0否】',
  22. `check_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '审核备注',
  23. `check_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '审核状态:0:未审核 1:审核通过 2:审核不通过',
  24. `check_time` int(11) NOT NULL DEFAULT '0' COMMENT '审核时间',
  25. `look_people_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '观看人数',
  26. `look_complete_num` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '完整观看人数',
  27. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  28. `created_at` int(11) NOT NULL DEFAULT '0',
  29. `updated_at` int(11) NOT NULL DEFAULT '0',
  30. PRIMARY KEY (`id`) USING BTREE
  31. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='视频列表';
  32. CREATE TABLE `qimall_addons_store_video_order` (
  33. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  34. `mall_id` int(11) NOT NULL DEFAULT '0',
  35. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  36. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
  37. `video_id` int(11) NOT NULL DEFAULT '0' COMMENT '视频id',
  38. `order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '订单编号',
  39. `pay_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '支付状态:0:否;1:是',
  40. `pay_time` int(11) NOT NULL DEFAULT '0' COMMENT '付款时间',
  41. `pay_money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '实付金额',
  42. `payment_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '支付类型',
  43. `remark` varchar(255) NOT NULL DEFAULT '' COMMENT '备注',
  44. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[0禁用 1启用 -1删除]',
  45. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  46. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  47. PRIMARY KEY (`id`) USING BTREE,
  48. KEY `idx_order_no` (`order_no`) USING BTREE
  49. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='门店视频订单';
  50. CREATE TABLE `qimall_addons_store_order_credit` (
  51. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  52. `mall_id` int(11) NOT NULL DEFAULT '0',
  53. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  54. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
  55. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店订单id',
  56. `type`tinyint(1) NOT NULL DEFAULT '1' COMMENT '类型[1:门店商品订单;2:收银台订单]',
  57. `is_repayment` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否还款:0:否;1:是',
  58. `pay_time` int(11) NOT NULL DEFAULT '0' COMMENT '付款时间',
  59. `down_payments` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '首付金额',
  60. `credit_money` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '赊账金额',
  61. `order_no` varchar(255) NOT NULL DEFAULT '' COMMENT '还款生成的支付订单编号',
  62. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[0禁用 1启用 -1删除]',
  63. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  64. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  65. `extra` text COMMENT '',
  66. PRIMARY KEY (`id`) USING BTREE
  67. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='门店赊账订单';
  68. CREATE TABLE `qimall_addons_store_coupon` (
  69. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  70. `mall_id` int(10) unsigned NOT NULL,
  71. `store_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  72. `name` varchar(150) NOT NULL DEFAULT '' COMMENT '优惠券名称',
  73. `type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '优惠券类型,1:折扣,2:满减',
  74. `discount` decimal(3,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '折扣率',
  75. `discount_limit` decimal(10,2) unsigned DEFAULT NULL COMMENT '折扣优惠金额上限',
  76. `min_price` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最低消费金额',
  77. `sub_price` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠金额',
  78. `total_count` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '优惠券总数量',
  79. `sort` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序按升序排列',
  80. `expire_type` tinyint(1) NOT NULL DEFAULT '2' COMMENT '到期类型:1=领取后n天过期,2=指定有效期,3=领取后n天生效,生效后m天过期',
  81. `expire_day` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '有效天数,expire_type=1和3时',
  82. `effect_days` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '领取到生效之间间隔的天数(领取后n天生效)',
  83. `begin_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '有效期开始时间',
  84. `end_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '有效期结束时间',
  85. `appoint_type` tinyint(4) NOT NULL DEFAULT '3' COMMENT '1 指定分类 2 指定商品 3全部',
  86. `rule` text COMMENT '使用说明',
  87. `is_remind` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否开启提醒',
  88. `remind_days` tinyint(4) NOT NULL DEFAULT '3' COMMENT '提前提醒天数(到期前多少天提醒),is_remind=1 时有效',
  89. `is_receive_limit` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否限制领取',
  90. `receive_count` int(10) unsigned NOT NULL DEFAULT '1' COMMENT '每人可以领取的数量,is_receive_limit=1时有意义',
  91. `is_member` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否指定会员等级',
  92. `is_original_use` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否原价购买使用(如果是,则只有原价购买商品时可以使用该优惠券)',
  93. `is_public_receive` tinyint(4) NOT NULL DEFAULT '1' COMMENT '是否公开领取,公开领取的优惠券会展示在商品详情页',
  94. `is_giving` tinyint(1) NOT NULL DEFAULT '0' COMMENT '启用优惠券转送功能:0-否;1-是;',
  95. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  96. `coupon_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '优惠券状态,1:未开始,2:领取中,3:已过期,4:已失效(后台操作失效)',
  97. `is_giving_reward` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否开启转赠奖励,开启后转赠优惠券自己可以获得额外奖励;is_giving=1 时有效',
  98. `is_consume_reward` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否开启使用奖励,开启后使用该优惠券可以获得额外奖励;is_giving=1 时有效',
  99. `is_open_screen` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否开屏显示',
  100. `open_screen_frequency` varchar(255) NOT NULL DEFAULT '' COMMENT '开屏频率',
  101. `qrcode_url` varchar(255) NOT NULL DEFAULT '' COMMENT '优惠券分享二维码保存路径,二维码包含内容:页面路径+优惠券id',
  102. `poster_url` varchar(255) NOT NULL DEFAULT '' COMMENT '优惠券分享海报图片保存路径',
  103. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  104. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  105. `video_url` varchar(255) NOT NULL DEFAULT '' COMMENT '视频路径',
  106. `first_frame` varchar(255) NOT NULL DEFAULT '' COMMENT '首帧',
  107. `watch_times` int(11) NOT NULL DEFAULT '0' COMMENT '观看多少秒领取成功',
  108. PRIMARY KEY (`id`) USING BTREE,
  109. KEY `idx_mall_id` (`mall_id`) USING BTREE,
  110. KEY `idx_expire_time` (`begin_at`,`end_at`) USING BTREE
  111. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券';
  112. CREATE TABLE `qimall_addons_store_coupon_cat_relate` (
  113. `id` int(11) NOT NULL AUTO_INCREMENT,
  114. `coupon_id` int(11) NOT NULL COMMENT '优惠券id',
  115. `cate_id` int(11) NOT NULL COMMENT '分类id',
  116. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  117. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  118. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  119. PRIMARY KEY (`id`) USING BTREE
  120. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分类下相关优惠券';
  121. CREATE TABLE `qimall_addons_store_coupon_give_item_setting` (
  122. `id` int(11) NOT NULL AUTO_INCREMENT,
  123. `mall_id` int(11) NOT NULL COMMENT '商城ID',
  124. `store_id` int(11) NOT NULL COMMENT '门店',
  125. `is_enable` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否独立设置:0:否;1是',
  126. `item_id` int(11) NOT NULL DEFAULT '0' COMMENT '项目id',
  127. `item_type` varchar(255) NOT NULL DEFAULT '0' COMMENT '项目类型:商品goods',
  128. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  129. `created_at` int(11) NOT NULL DEFAULT '0',
  130. `updated_at` int(11) NOT NULL DEFAULT '0',
  131. PRIMARY KEY (`id`) USING BTREE,
  132. KEY `mall_id` (`mall_id`) USING BTREE
  133. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券项目赠送设置';
  134. CREATE TABLE `qimall_addons_store_coupon_give_item_setting_detail` (
  135. `id` int(11) NOT NULL AUTO_INCREMENT,
  136. `mall_id` int(11) NOT NULL COMMENT '商城ID',
  137. `store_id` int(11) NOT NULL COMMENT '商城ID',
  138. `coupon_give_item_setting_id` int(11) NOT NULL DEFAULT '0' COMMENT '设置id',
  139. `coupon_id` int(11) NOT NULL DEFAULT '0' COMMENT '优惠券id',
  140. `from_type` tinyint(1) NOT NULL COMMENT '类型:1:平台优惠券;2:门店优惠券',
  141. `num` int(11) NOT NULL DEFAULT '0' COMMENT '赠送数量',
  142. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  143. `created_at` int(11) NOT NULL DEFAULT '0',
  144. `updated_at` int(11) NOT NULL DEFAULT '0',
  145. PRIMARY KEY (`id`) USING BTREE,
  146. KEY `mall_id` (`mall_id`) USING BTREE
  147. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券项目赠送设置详情';
  148. CREATE TABLE `qimall_addons_store_coupon_good_statistics` (
  149. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  150. `mall_id` int(10) unsigned NOT NULL,
  151. `coupon_id` int(10) unsigned NOT NULL,
  152. `good_id` int(10) unsigned NOT NULL,
  153. `booking_number` int(11) NOT NULL DEFAULT '0' COMMENT '该商品使用该优惠券下单的总数量',
  154. `payed_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用该优惠券已支付的该商品数量',
  155. `booking_user_number` int(11) NOT NULL DEFAULT '0' COMMENT '该商品使用该优惠券下单的总人数',
  156. `buyed_user_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用该优惠券已购买该商品人数',
  157. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  158. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  159. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  160. PRIMARY KEY (`id`) USING BTREE,
  161. KEY `idx_mall_coupon_id` (`mall_id`,`coupon_id`) USING BTREE
  162. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='使用优惠券购买的商品的相关数据统计';
  163. CREATE TABLE `qimall_addons_store_coupon_goods_relate` (
  164. `id` int(11) NOT NULL AUTO_INCREMENT,
  165. `coupon_id` int(11) NOT NULL COMMENT '优惠券id',
  166. `goods_id` int(11) NOT NULL COMMENT '商品id',
  167. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  168. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  169. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  170. PRIMARY KEY (`id`) USING BTREE
  171. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品优惠券表';
  172. CREATE TABLE `qimall_addons_store_coupon_member_relate` (
  173. `id` int(11) NOT NULL AUTO_INCREMENT,
  174. `mall_id` int(11) NOT NULL,
  175. `coupon_id` int(11) NOT NULL COMMENT '优惠券id',
  176. `store_id` int(11) NOT NULL COMMENT '门店',
  177. `member_level` int(11) NOT NULL COMMENT '会员等级',
  178. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  179. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  180. `updated_at` int(11) NOT NULL DEFAULT '0',
  181. PRIMARY KEY (`id`) USING BTREE
  182. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员等级下优惠券表';
  183. CREATE TABLE `qimall_addons_store_coupon_remind` (
  184. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  185. `mall_id` int(10) unsigned NOT NULL DEFAULT '0',
  186. `coupon_id` int(10) unsigned NOT NULL DEFAULT '0',
  187. `store_id` int(10) unsigned NOT NULL DEFAULT '0',
  188. `user_id` int(10) unsigned NOT NULL DEFAULT '0',
  189. `expire_time` int(10) unsigned NOT NULL,
  190. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  191. `send_status` tinyint(4) NOT NULL DEFAULT '2' COMMENT '提醒状态,1:未发送提醒,2:已发送提醒,3:不需要发送提醒,已使用或者已转赠或者优惠券已过期或者优惠券已经失效',
  192. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  193. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  194. PRIMARY KEY (`id`) USING BTREE,
  195. KEY `idx_mall_coupon_user_id` (`mall_id`,`coupon_id`,`user_id`) USING BTREE
  196. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='优惠券过期提醒记录表';
  197. CREATE TABLE `qimall_addons_store_coupon_reward` (
  198. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  199. `mall_id` int(10) unsigned NOT NULL,
  200. `store_id` int(10) unsigned NOT NULL COMMENT '门店id',
  201. `coupon_id` int(10) unsigned NOT NULL COMMENT '优惠券id',
  202. `reward_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '奖励类型,1:转赠奖励,2:使用奖励',
  203. `balance` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '奖励余额',
  204. `score` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '奖励积分',
  205. `red_packet` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '奖励红包',
  206. `reward_currency_type` varchar(50) NOT NULL DEFAULT '' COMMENT '奖励货币种类,记录货币 code',
  207. `number` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '奖励货币数量',
  208. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  209. `created_at` int(10) unsigned NOT NULL DEFAULT '0',
  210. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  211. PRIMARY KEY (`id`) USING BTREE,
  212. KEY `idx_mallcoupon_id` (`mall_id`,`coupon_id`) USING BTREE
  213. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='优惠券奖励记录表';
  214. CREATE TABLE `qimall_addons_store_coupon_reward_log` (
  215. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  216. `mall_id` int(10) unsigned NOT NULL,
  217. `user_id` int(10) unsigned NOT NULL,
  218. `store_id` int(10) unsigned NOT NULL COMMENT '门店id',
  219. `coupon_id` int(10) unsigned NOT NULL COMMENT '优惠券id',
  220. `reward_number` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '奖励数额',
  221. `reward_scenarios` tinyint(4) NOT NULL DEFAULT '0' COMMENT '奖励场景,1:转赠奖励,2:使用奖励',
  222. `reward_type` tinyint(4) NOT NULL DEFAULT '0' COMMENT '奖励类型,1:余额,2:红包,3:积分,4:系统虚拟货币',
  223. `reward_type_code` varchar(20) NOT NULL DEFAULT '' COMMENT '奖励类型代码,balance:余额,red_packet:红包,score:积分,如果是虚拟货币,则记录其 code',
  224. `source_table` varchar(255) NOT NULL DEFAULT '' COMMENT '数据来源表',
  225. `source_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '数据来源id',
  226. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  227. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  228. PRIMARY KEY (`id`) USING BTREE,
  229. KEY `idx_mall_user_coupon_id` (`mall_id`,`user_id`,`coupon_id`) USING BTREE
  230. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='优惠券奖励发放记录';
  231. CREATE TABLE `qimall_addons_store_coupon_share_log` (
  232. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  233. `mall_id` int(10) unsigned NOT NULL DEFAULT '0',
  234. `store_id` int(10) unsigned NOT NULL DEFAULT '0',
  235. `coupon_id` int(10) unsigned NOT NULL DEFAULT '0',
  236. `user_coupon_id` int(11) NOT NULL DEFAULT '0' COMMENT '赠送者coupon_user_relate表的id',
  237. `get_user_coupon_id` int(11) NOT NULL DEFAULT '0' COMMENT '领取者coupon_user_relate表的id',
  238. `giving_user_id` int(10) unsigned NOT NULL COMMENT '转出会员id,值为 0 说明是平台赠送的优惠券',
  239. `receive_user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '受赠会员id,尚未被领取此字段值为0',
  240. `giving_status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '转赠状态,1:转赠中(已分享出去,未被领取),2:已被领取',
  241. `created_at` int(10) unsigned NOT NULL DEFAULT '0',
  242. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  243. PRIMARY KEY (`id`) USING BTREE,
  244. KEY `idx_mall_coupon_id` (`mall_id`,`coupon_id`) USING BTREE,
  245. KEY `idx_gr_user_id` (`giving_user_id`,`receive_user_id`) USING BTREE
  246. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='优惠券分享记录表';
  247. CREATE TABLE `qimall_addons_store_coupon_statistics` (
  248. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  249. `mall_id` int(10) unsigned NOT NULL,
  250. `store_id` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
  251. `coupon_id` int(10) unsigned NOT NULL,
  252. `received_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '已领取数量',
  253. `used_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '已使用数量',
  254. `giveing_times` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '优惠券被转赠的次数',
  255. `use_probability` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '优惠券使用率,等于领取数量比使用数量',
  256. `total_discount_amount` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '累计优惠金额',
  257. `receive_user_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '领券会员总数量',
  258. `use_user_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用券会员总数量',
  259. `giving_user_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '转赠优惠券的会员总数量',
  260. `use_order_number` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '使用优惠券支付的订单总数量',
  261. `total_use_coupon_payed_amount` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '使用优惠券后实际支付的总金额',
  262. `total_payed_amount` decimal(12,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '使用优惠券支付的订单原价总金额',
  263. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  264. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  265. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  266. PRIMARY KEY (`id`) USING BTREE,
  267. KEY `idx_mall_coupon_id` (`mall_id`,`coupon_id`) USING BTREE
  268. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='优惠券相关数据统计记录表';
  269. CREATE TABLE `qimall_addons_store_coupon_use_log` (
  270. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
  271. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT 'mall_id',
  272. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT 'user_id',
  273. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT 'order_id',
  274. `coupon_id` int(11) NOT NULL DEFAULT '0' COMMENT 'coupon_id',
  275. `user_coupon_id` int(11) NOT NULL DEFAULT '0' COMMENT 'user_coupon_id',
  276. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  277. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  278. `updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '修改时间',
  279. PRIMARY KEY (`id`) USING BTREE,
  280. KEY `idx_user_coupon_id` (`user_coupon_id`) USING BTREE
  281. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='优惠券使用记录表';
  282. CREATE TABLE `qimall_addons_store_coupon_user_relate` (
  283. `id` int(11) NOT NULL AUTO_INCREMENT,
  284. `mall_id` int(11) NOT NULL,
  285. `store_id` int(10) NOT NULL DEFAULT '0' COMMENT '门店id',
  286. `from_type` tinyint(1) NOT NULL COMMENT '类型:1:平台优惠券;2:门店优惠券',
  287. `user_id` int(11) NOT NULL COMMENT '用户',
  288. `coupon_id` int(11) NOT NULL COMMENT '优惠卷',
  289. `coupon_status` tinyint(4) NOT NULL DEFAULT '2' COMMENT '优惠券状态,2:领取中,3:已过期,4:已失效(后台操作失效、转赠被领取后、使用之后)',
  290. `start_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '优惠券开始生效时间',
  291. `end_time` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '优惠券过期时间',
  292. `is_use` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已使用:0=未使用,1=已使用',
  293. `is_giving` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已赠送:0-否;1-是;',
  294. `giving_status` tinyint(4) NOT NULL DEFAULT '0' COMMENT '转赠状态,0:未转赠,1:转赠中,2:已被领取(转赠完成)',
  295. `receive_type` varchar(255) NOT NULL DEFAULT '' COMMENT '获取方式,如"商品详情页领取"',
  296. `receive_platform` varchar(25) NOT NULL DEFAULT 'h5' COMMENT '领取来源,从哪个平台领取的,wechat:微信,mp-wx:微信小程序,h5,app,work-wx:企业微信',
  297. `is_force_failure` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否强制失效,后台操作用户已领取的优惠券失效',
  298. `is_send_reward` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否已经发放优惠券奖励,1:是,0:否',
  299. `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  300. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  301. `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
  302. PRIMARY KEY (`id`) USING BTREE,
  303. KEY `idx_cpid` (`coupon_id`) USING BTREE,
  304. KEY `idx_user_id` (`user_id`) USING BTREE
  305. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户优惠券表';
  306. ALTER TABLE qimall_addons_store add `is_open_credit` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否开启赊账功能 0:否;1:是';
  307. ALTER TABLE qimall_addons_store_goods add `credit_rate` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '赊账比例';
  308. ALTER TABLE qimall_addons_store_cashier_extra add `credit_rate` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '赊账比例';
  309. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (31, '赊账', '0', 0, 'store/client/credit/index', 'el-icon-box', 3, 0, 999, NULL, '', 1, 0, 0);
  310. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (32, '赊账记录', '0', 31, 'store/client/credit/index', '', 3, 0, 999, NULL, '', 1, 0, 0);
  311. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (33, '赊账设置', '0', 31, 'store/client/credit/setting-credit', '', 3, 0, 999, NULL, '', 1, 0, 0);
  312. INSERT INTO `qimall_crontab_task`( `name`, `command`, `type`, `rule`, `is_warning`, `status`, `created_at`, `updated_at`) VALUES ('自动更新门店优惠券状态', 'store/coupon/update-coupon-status', 2, '0 */1 * * * *', 0, 1, 1660125107, 1660125107);
  313. CREATE TABLE `qimall_addons_store_extra` (
  314. `id` int(11) NOT NULL AUTO_INCREMENT,
  315. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城id',
  316. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  317. `give_setting` longtext COMMENT '赠送设置',
  318. `deduct_setting` longtext COMMENT '抵扣设置',
  319. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[1正常 -1删除]',
  320. `created_at` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
  321. `updated_at` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
  322. PRIMARY KEY (`id`) USING BTREE
  323. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='门店额外信息表';
  324. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (26, '优惠券', '0', 8, 'store/client/coupon/index', '', 2, 0, 999, NULL, '', 1, 0, 0);
  325. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (27, '优惠券管理', '0', 26, 'store/client/coupon/index', '', 2, 0, 999, NULL, '', 1, 0, 0);
  326. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (28, '会员优惠券', '0', 26, 'store/client/coupon/user-coupon', '', 2, 0, 999, NULL, '', 1, 0, 0);
  327. INSERT INTO `qimall_addons_store_menu`(`id`, `title`, `app_id`, `pid`, `url`, `icon`, `level`, `dev`, `sort`, `params`, `tree`, `status`, `created_at`, `updated_at`) VALUES (30, '优惠设置', '0', 8, 'store/client/discount/index', '', 2, 0, 999, NULL, '', 1, 0, 0);
  328. alter table qimall_addons_store add payment_settlement_type tinyint(1) not null default 0 comment '门店货款结算方式,是否开启上传凭证,0:否;1:是';
  329. INSERT INTO `qimall_diy_components`( `code`, `title`, `group`, `icon`, `count`, `is_top`, `permission`, `sort`, `source`, `status`, `created_at`, `updated_at`) VALUES ( 'store', 'O2O门店', 'other', '', 999, 0, '{\"is_drag\":\"true\",\"is_up\":\"true\",\"id_down\":\"true\",\"is_copy\":\"true\"}', 999, 'Store', 1, 1652929474, 1652929474);
  330. CREATE TABLE `qimall_addons_store_mini_code` (
  331. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
  332. `mall_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  333. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  334. `type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1:推广码;2:收银台二维码',
  335. `code` varchar(255) NOT NULL DEFAULT '' COMMENT '分享码',
  336. `content` varchar(255) NOT NULL DEFAULT '' COMMENT '二维码参数',
  337. `applet_code` varchar(255) DEFAULT '' COMMENT '小程序二维码图片地址',
  338. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态【1启用 0禁用 -1删除】',
  339. `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  340. `updated_at` int(10) NOT NULL DEFAULT '0' COMMENT '上次更新数据时间',
  341. PRIMARY KEY (`id`) USING BTREE
  342. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='门店小程序码生成表'
  343. ALTER TABLE `qimall_addons_store_commission`
  344. ADD COLUMN `store_send_commission` decimal(12,2) NOT NULL DEFAULT 0 COMMENT '门店直接发放佣金,不包含平台设置的插件佣金' AFTER `settle_type`;
  345. ALTER TABLE qimall_addons_store_goods add is_recommend tinyint(1) not null default 0 COMMENT '店铺推荐:0:否;1:是';
  346. ALTER TABLE qimall_addons_store_goods add show_style tinyint(1) not null default 1 COMMENT '商品展示风格:1:;2:';
  347. ALTER TABLE qimall_addons_store_goods_attr add attr_detail text COMMENT '规格详情';
  348. ALTER TABLE qimall_addons_store add show_style tinyint(1) not null default 1 COMMENT '门店装修风格:1:;2:';
  349. ALTER TABLE qimall_addons_store add bannar_pic text COMMENT '门店轮播图';
  350. ALTER TABLE qimall_addons_store add introduce text COMMENT '门店介绍';
  351. ALTER TABLE `qimall_addons_store_goods` add package_data longtext NULL COMMENT '套餐json数据';
  352. ALTER TABLE qimall_addons_store_cate add is_collect_service_fee tinyint(1) not null default 0 comment '是否收取服务费:1是;0:否';
  353. ALTER TABLE qimall_addons_store_cate add collect_service_fee decimal(12,2) not null default 0 comment '服务费比例';