install_struct.sql 73 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077
  1. DROP TABLE IF EXISTS `yoshop_admin_user`;
  2. CREATE TABLE `yoshop_admin_user` (
  3. `admin_user_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  4. `user_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户名',
  5. `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '登录密码',
  6. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  7. `update_time` int(11) NOT NULL COMMENT '更新时间',
  8. PRIMARY KEY (`admin_user_id`),
  9. KEY `user_name` (`user_name`) USING BTREE
  10. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='超管用户记录表';
  11. DROP TABLE IF EXISTS `yoshop_article`;
  12. CREATE TABLE `yoshop_article` (
  13. `article_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '文章ID',
  14. `title` varchar(300) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '文章标题',
  15. `show_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '列表显示方式(10小图展示 20大图展示)',
  16. `category_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文章分类ID',
  17. `image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '封面图ID',
  18. `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文章内容',
  19. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文章排序(数字越小越靠前)',
  20. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '文章状态(0隐藏 1显示)',
  21. `virtual_views` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '虚拟阅读量(仅用作展示)',
  22. `actual_views` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '实际阅读量',
  23. `is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  24. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  25. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  26. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  27. PRIMARY KEY (`article_id`),
  28. KEY `category_id` (`category_id`),
  29. KEY `store_id` (`store_id`)
  30. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文章记录表';
  31. DROP TABLE IF EXISTS `yoshop_article_category`;
  32. CREATE TABLE `yoshop_article_category` (
  33. `category_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '文章分类ID',
  34. `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '分类名称',
  35. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1显示 0隐藏)',
  36. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序方式(数字越小越靠前)',
  37. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  38. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  39. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  40. PRIMARY KEY (`category_id`),
  41. KEY `store_id` (`store_id`)
  42. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文章分类表';
  43. DROP TABLE IF EXISTS `yoshop_cart`;
  44. CREATE TABLE `yoshop_cart` (
  45. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  46. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  47. `goods_sku_id` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品sku唯一标识',
  48. `goods_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品数量',
  49. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  50. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  51. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  52. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  53. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  54. PRIMARY KEY (`id`),
  55. KEY `goods_id` (`goods_id`),
  56. KEY `user_id` (`user_id`),
  57. KEY `store_id` (`store_id`),
  58. KEY `goods_id_2` (`goods_id`,`goods_sku_id`)
  59. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='购物车记录表';
  60. DROP TABLE IF EXISTS `yoshop_category`;
  61. CREATE TABLE `yoshop_category` (
  62. `category_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品分类ID',
  63. `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '分类名称',
  64. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类ID',
  65. `image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分类图片ID',
  66. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1显示 0隐藏)',
  67. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序方式(数字越小越靠前)',
  68. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  69. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  70. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  71. PRIMARY KEY (`category_id`),
  72. KEY `store_id` (`store_id`)
  73. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类表';
  74. DROP TABLE IF EXISTS `yoshop_comment`;
  75. CREATE TABLE `yoshop_comment` (
  76. `comment_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '评价ID',
  77. `score` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '评分 (10好评 20中评 30差评)',
  78. `content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '评价内容',
  79. `is_picture` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否为图片评价',
  80. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(0隐藏 1显示)',
  81. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '评价排序',
  82. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  83. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  84. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  85. `order_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单商品ID',
  86. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  87. `is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '软删除',
  88. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  89. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  90. PRIMARY KEY (`comment_id`),
  91. KEY `user_id` (`user_id`),
  92. KEY `order_id` (`order_id`),
  93. KEY `goods_id` (`goods_id`),
  94. KEY `store_id` (`store_id`)
  95. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单评价记录表';
  96. DROP TABLE IF EXISTS `yoshop_comment_image`;
  97. CREATE TABLE `yoshop_comment_image` (
  98. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  99. `comment_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '评价ID',
  100. `image_id` int(11) NOT NULL DEFAULT '0' COMMENT '图片id(关联文件记录表)',
  101. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  102. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  103. PRIMARY KEY (`id`),
  104. KEY `comment_id` (`comment_id`) USING BTREE,
  105. KEY `store_id` (`store_id`)
  106. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单评价图片记录表';
  107. DROP TABLE IF EXISTS `yoshop_coupon`;
  108. CREATE TABLE `yoshop_coupon` (
  109. `coupon_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '优惠券ID',
  110. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '优惠券名称',
  111. `coupon_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '优惠券类型(10满减券 20折扣券)',
  112. `reduce_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '满减券-减免金额',
  113. `discount` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '折扣券-折扣率(0-100)',
  114. `min_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最低消费金额',
  115. `expire_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '到期类型(10领取后生效 20固定时间)',
  116. `expire_day` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '领取后生效-有效天数',
  117. `start_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '固定时间-开始时间',
  118. `end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '固定时间-结束时间',
  119. `apply_range` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '适用范围(10全部商品 20指定商品 30排除商品)',
  120. `apply_range_config` text COLLATE utf8mb4_unicode_ci COMMENT '适用范围配置(json格式)',
  121. `total_num` int(11) NOT NULL DEFAULT '0' COMMENT '发放总数量(-1为不限制)',
  122. `receive_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已领取数量',
  123. `describe` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '优惠券描述',
  124. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1显示 0隐藏)',
  125. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序方式(数字越小越靠前)',
  126. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '软删除',
  127. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  128. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  129. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  130. PRIMARY KEY (`coupon_id`),
  131. KEY `store_id` (`store_id`)
  132. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='优惠券记录表';
  133. DROP TABLE IF EXISTS `yoshop_delivery`;
  134. CREATE TABLE `yoshop_delivery` (
  135. `delivery_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '模板ID',
  136. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '模板名称',
  137. `method` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '计费方式(10按件数 20按重量)',
  138. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序方式(数字越小越靠前)',
  139. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  140. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序d',
  141. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  142. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  143. PRIMARY KEY (`delivery_id`), /* delivery_id 已经是AUTO_INCREMENT,确保唯一了,并不需要复合主键 */
  144. KEY `store_id` (`store_id`)
  145. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='配送模板主表';
  146. DROP TABLE IF EXISTS `yoshop_delivery_rule`;
  147. CREATE TABLE `yoshop_delivery_rule` (
  148. `rule_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '规则ID',
  149. `delivery_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '配送模板ID',
  150. `region` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '可配送区域(城市id集)',
  151. `region_text` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '可配送区域(文字展示)',
  152. `first` double unsigned NOT NULL DEFAULT '0' COMMENT '首件(个)/首重(Kg)',
  153. `first_fee` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '运费(元)',
  154. `additional` double unsigned NOT NULL DEFAULT '0' COMMENT '续件/续重',
  155. `additional_fee` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '续费(元)',
  156. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  157. `create_time` int(11) unsigned NOT NULL COMMENT '创建时间',
  158. PRIMARY KEY (`rule_id`),
  159. KEY `delivery_id` (`delivery_id`),
  160. KEY `store_id` (`store_id`)
  161. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='配送模板区域及运费表';
  162. DROP TABLE IF EXISTS `yoshop_express`;
  163. CREATE TABLE `yoshop_express` (
  164. `express_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '物流公司ID',
  165. `express_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '物流公司名称',
  166. `kuaidi100_code` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '物流公司编码 (快递100)',
  167. `kdniao_code` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '物流公司编码 (快递鸟)',
  168. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  169. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  170. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  171. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  172. PRIMARY KEY (`express_id`),
  173. KEY `store_id` (`store_id`),
  174. KEY `kuaidi100_code` (`kuaidi100_code`) USING BTREE,
  175. KEY `express_name` (`express_name`) USING BTREE
  176. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='物流公司记录表';
  177. DROP TABLE IF EXISTS `yoshop_goods`;
  178. CREATE TABLE `yoshop_goods` (
  179. `goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品ID',
  180. `goods_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '商品类型(10实物商品)',
  181. `goods_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品名称',
  182. `goods_no` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品编码',
  183. `video_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '主图视频ID',
  184. `video_cover_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '主图视频ID',
  185. `selling_point` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品卖点',
  186. `spec_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商品规格(10单规格 20多规格)',
  187. `goods_price_min` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格(最低)',
  188. `goods_price_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格(最高)',
  189. `line_price_min` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '划线价格(最低)',
  190. `line_price_max` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '划线价格(最高)',
  191. `stock_total` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '库存总量(包含所有sku)',
  192. `deduct_stock_type` tinyint(3) unsigned NOT NULL DEFAULT '20' COMMENT '库存计算方式(10下单减库存 20付款减库存)',
  193. `is_restrict` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否开启限购(0未开启 1已开启)',
  194. `restrict_total` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '总限购数量(0为不限制)',
  195. `restrict_single` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '每单限购数量(0为不限制)',
  196. `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品详情',
  197. `sales_initial` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '初始销量',
  198. `sales_actual` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '实际销量',
  199. `delivery_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '配送模板ID',
  200. `is_points_gift` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启积分赠送(1开启 0关闭)',
  201. `is_points_discount` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否允许使用积分抵扣(1允许 0不允许)',
  202. `is_alone_points_discount` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '积分抵扣设置(0默认抵扣 1单独设置抵扣)',
  203. `points_discount_config` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '单独设置积分抵扣的配置',
  204. `is_enable_grade` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启会员折扣(1开启 0关闭)',
  205. `is_alone_grade` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '会员折扣设置(0默认等级折扣 1单独设置折扣)',
  206. `alone_grade_equity` text COLLATE utf8mb4_unicode_ci COMMENT '单独设置折扣的配置',
  207. `is_ind_delivery_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否单独设置配送方式(0关闭 1开启)',
  208. `delivery_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品配送方式(仅单独设置时有效)',
  209. `status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '商品状态(10上架 20下架)',
  210. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  211. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  212. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  213. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  214. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  215. PRIMARY KEY (`goods_id`),
  216. KEY `goods_no` (`goods_no`),
  217. KEY `store_id` (`store_id`)
  218. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品记录表';
  219. DROP TABLE IF EXISTS `yoshop_goods_category_rel`;
  220. CREATE TABLE `yoshop_goods_category_rel` (
  221. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  222. `goods_id` int(11) unsigned NOT NULL COMMENT '商品ID',
  223. `category_id` int(11) unsigned NOT NULL COMMENT '商品分类ID',
  224. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  225. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  226. PRIMARY KEY (`id`),
  227. KEY `store_id` (`store_id`),
  228. KEY `goods_id` (`goods_id`),
  229. KEY `category_id` (`category_id`)
  230. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品与分类关系记录表';
  231. DROP TABLE IF EXISTS `yoshop_goods_image`;
  232. CREATE TABLE `yoshop_goods_image` (
  233. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  234. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  235. `image_id` int(11) NOT NULL COMMENT '图片id(关联文件记录表)',
  236. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  237. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  238. PRIMARY KEY (`id`),
  239. KEY `goods_id` (`goods_id`),
  240. KEY `store_id` (`store_id`)
  241. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品图片记录表';
  242. DROP TABLE IF EXISTS `yoshop_goods_service`;
  243. CREATE TABLE `yoshop_goods_service` (
  244. `service_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品服务ID',
  245. `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '服务名称',
  246. `summary` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '概述',
  247. `is_default` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否默认(新增商品时)',
  248. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1显示 0隐藏)',
  249. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序方式(数字越小越靠前)',
  250. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除(1已删除)',
  251. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  252. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  253. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  254. PRIMARY KEY (`service_id`),
  255. KEY `store_id` (`store_id`)
  256. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品服务与承诺记录表';
  257. DROP TABLE IF EXISTS `yoshop_goods_service_rel`;
  258. CREATE TABLE `yoshop_goods_service_rel` (
  259. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  260. `goods_id` int(11) unsigned NOT NULL COMMENT '商品ID',
  261. `service_id` int(11) unsigned NOT NULL COMMENT '服务承诺ID',
  262. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  263. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  264. PRIMARY KEY (`id`),
  265. KEY `store_id` (`store_id`),
  266. KEY `goods_id` (`goods_id`),
  267. KEY `service_id` (`service_id`)
  268. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品与服务承诺关系记录表';
  269. DROP TABLE IF EXISTS `yoshop_goods_sku`;
  270. CREATE TABLE `yoshop_goods_sku` (
  271. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '记录ID',
  272. `goods_sku_id` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '0' COMMENT '商品sku唯一标识 (由规格id组成)',
  273. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  274. `image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格图片ID',
  275. `goods_sku_no` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品sku编码',
  276. `goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格',
  277. `line_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品划线价',
  278. `stock_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前库存数量',
  279. `goods_weight` double unsigned NOT NULL DEFAULT '0' COMMENT '商品重量(Kg)',
  280. `goods_props` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'SKU的规格属性(json格式)',
  281. `spec_value_ids` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '规格值ID集(json格式)',
  282. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  283. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  284. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  285. PRIMARY KEY (`id`),
  286. UNIQUE KEY `sku_idx` (`goods_id`,`goods_sku_id`),
  287. KEY `store_id` (`store_id`)
  288. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品规格表';
  289. DROP TABLE IF EXISTS `yoshop_goods_spec_rel`;
  290. CREATE TABLE `yoshop_goods_spec_rel` (
  291. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  292. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  293. `spec_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格组ID',
  294. `spec_value_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格值ID',
  295. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  296. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  297. PRIMARY KEY (`id`),
  298. KEY `store_id` (`store_id`)
  299. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品与规格值关系记录表';
  300. DROP TABLE IF EXISTS `yoshop_h5_setting`;
  301. CREATE TABLE `yoshop_h5_setting` (
  302. `key` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '设置项标示',
  303. `describe` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '设置项描述',
  304. `values` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设置内容(json格式)',
  305. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  306. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  307. UNIQUE KEY `unique_key` (`key`,`store_id`)
  308. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='H5端设置表';
  309. DROP TABLE IF EXISTS `yoshop_help`;
  310. CREATE TABLE `yoshop_help` (
  311. `help_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  312. `title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '帮助标题',
  313. `content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '帮助内容',
  314. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  315. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除(1已删除)',
  316. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  317. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  318. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  319. PRIMARY KEY (`help_id`),
  320. KEY `store_id` (`store_id`)
  321. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='帮助中心记录表';
  322. DROP TABLE IF EXISTS `yoshop_order`;
  323. CREATE TABLE `yoshop_order` (
  324. `order_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID',
  325. `order_no` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '订单号',
  326. `order_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单类型(10实物订单)',
  327. `total_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品总金额(不含优惠折扣)',
  328. `order_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '订单金额(含优惠折扣)',
  329. `coupon_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '优惠券ID',
  330. `coupon_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠券抵扣金额',
  331. `points_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '积分抵扣金额',
  332. `points_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分抵扣数量',
  333. `pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际付款金额(包含运费)',
  334. `update_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '后台修改的订单金额(差价)',
  335. `buyer_remark` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '买家留言',
  336. `pay_method` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付方式(余额/微信/支付宝)',
  337. `pay_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '付款状态(10未付款 20已付款)',
  338. `pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '付款时间',
  339. `trade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '第三方交易记录ID',
  340. `delivery_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '配送方式(10快递配送 20门店自提 30无需配送)',
  341. `express_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '运费金额',
  342. `delivery_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '发货状态(10未发货 20已发货 30部分发货)',
  343. `delivery_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发货时间',
  344. `receipt_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '收货状态(10未收货 20已收货)',
  345. `receipt_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '收货时间',
  346. `order_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单状态(10进行中 20取消 21待取消 30已完成)',
  347. `points_bonus` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '赠送的积分数量',
  348. `merchant_remark` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商家备注',
  349. `is_settled` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '订单是否已结算(0未结算 1已结算)',
  350. `is_comment` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否已评价(0否 1是)',
  351. `order_source` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单来源(10普通订单 20砍价订单 30秒杀订单)',
  352. `order_source_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '来源记录ID',
  353. `order_source_data` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '来源记录的参数 (json格式)',
  354. `platform` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '来源客户端 (APP、H5、小程序等)',
  355. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  356. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  357. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  358. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  359. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  360. PRIMARY KEY (`order_id`),
  361. UNIQUE KEY `order_no` (`order_no`) USING BTREE,
  362. KEY `store_id` (`store_id`),
  363. KEY `user_id` (`user_id`),
  364. KEY `pay_status` (`pay_status`) USING BTREE,
  365. KEY `delivery_status` (`delivery_status`) USING BTREE,
  366. KEY `receipt_status` (`receipt_status`) USING BTREE,
  367. KEY `order_status` (`order_status`) USING BTREE,
  368. KEY `is_settled` (`is_settled`) USING BTREE,
  369. KEY `order_source` (`order_source`) USING BTREE
  370. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单记录表';
  371. DROP TABLE IF EXISTS `yoshop_order_address`;
  372. CREATE TABLE `yoshop_order_address` (
  373. `order_address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '地址ID',
  374. `name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '收货人姓名',
  375. `phone` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '联系电话',
  376. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '省份ID',
  377. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城市ID',
  378. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '区/县ID',
  379. `detail` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '详细地址',
  380. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  381. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  382. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  383. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  384. PRIMARY KEY (`order_address_id`) USING BTREE,
  385. KEY `user_id` (`user_id`),
  386. KEY `store_id` (`store_id`)
  387. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单收货地址记录表';
  388. DROP TABLE IF EXISTS `yoshop_order_delivery`;
  389. CREATE TABLE `yoshop_order_delivery` (
  390. `delivery_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '发货单ID',
  391. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  392. `delivery_method` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '发货方式(10手动录入 20无需物流 30电子面单)',
  393. `express_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '物流公司ID',
  394. `express_no` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '物流单号',
  395. `eorder_html` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '电子面单模板内容',
  396. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  397. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  398. PRIMARY KEY (`delivery_id`) USING BTREE,
  399. KEY `order_id` (`order_id`),
  400. KEY `store_id` (`store_id`)
  401. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单发货单记录表';
  402. DROP TABLE IF EXISTS `yoshop_order_delivery_goods`;
  403. CREATE TABLE `yoshop_order_delivery_goods` (
  404. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  405. `delivery_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发货单ID',
  406. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  407. `order_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单商品ID',
  408. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  409. `delivery_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发货数量',
  410. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  411. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  412. PRIMARY KEY (`id`) USING BTREE,
  413. KEY `delivery_id` (`delivery_id`),
  414. KEY `order_id` (`order_id`),
  415. KEY `store_id` (`store_id`)
  416. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单发货单商品记录表';
  417. DROP TABLE IF EXISTS `yoshop_order_export`;
  418. CREATE TABLE `yoshop_order_export` (
  419. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  420. `start_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单时间(开始)',
  421. `end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单时间(结束)',
  422. `file_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'excel文件路径',
  423. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '导出状态(10进行中 20已完成 30失败)',
  424. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  425. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  426. PRIMARY KEY (`id`) USING BTREE,
  427. KEY `store_id` (`store_id`)
  428. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单导出Excel记录表';
  429. DROP TABLE IF EXISTS `yoshop_order_goods`;
  430. CREATE TABLE `yoshop_order_goods` (
  431. `order_goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单商品ID',
  432. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  433. `goods_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '商品类型(10实物商品)',
  434. `goods_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品名称',
  435. `image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品封面图ID',
  436. `deduct_stock_type` tinyint(3) unsigned NOT NULL DEFAULT '20' COMMENT '库存计算方式(10下单减库存 20付款减库存)',
  437. `spec_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '规格类型(10单规格 20多规格)',
  438. `goods_sku_id` varchar(150) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品sku唯一标识',
  439. `goods_props` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'SKU的规格属性(json格式)',
  440. `content` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '商品详情',
  441. `goods_no` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商品编码',
  442. `goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格(单价)',
  443. `line_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品划线价',
  444. `goods_weight` double unsigned NOT NULL DEFAULT '0' COMMENT '商品重量(Kg)',
  445. `is_user_grade` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否存在会员等级折扣',
  446. `grade_ratio` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '会员折扣比例(0-10)',
  447. `grade_goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '会员折扣的商品单价',
  448. `grade_total_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '会员折扣的总额差',
  449. `coupon_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠券折扣金额',
  450. `points_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '积分金额',
  451. `points_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分抵扣数量',
  452. `points_bonus` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '赠送的积分数量',
  453. `total_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '购买数量',
  454. `total_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品总价(数量×单价)',
  455. `total_pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际付款价(折扣和优惠后)',
  456. `delivery_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '发货状态(10未发货 20已发货 30部分发货)',
  457. `delivery_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已发货数量',
  458. `is_comment` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否已评价(0否 1是)',
  459. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  460. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  461. `goods_source_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '来源记录ID',
  462. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  463. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  464. PRIMARY KEY (`order_goods_id`) USING BTREE,
  465. KEY `goods_id` (`goods_id`),
  466. KEY `order_id` (`order_id`),
  467. KEY `user_id` (`user_id`),
  468. KEY `store_id` (`store_id`)
  469. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='订单商品记录表';
  470. DROP TABLE IF EXISTS `yoshop_order_refund`;
  471. CREATE TABLE `yoshop_order_refund` (
  472. `order_refund_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '售后单ID',
  473. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  474. `order_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单商品ID',
  475. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  476. `type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后类型(10退货退款 20换货)',
  477. `apply_desc` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户申请原因(说明)',
  478. `audit_status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家审核状态(0待审核 10已同意 20已拒绝)',
  479. `refuse_desc` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商家拒绝原因(说明)',
  480. `refund_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际退款金额',
  481. `is_user_send` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '用户是否发货(0未发货 1已发货)',
  482. `send_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户发货时间',
  483. `express_id` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户发货物流公司ID',
  484. `express_no` varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户发货物流单号',
  485. `is_receipt` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家收货状态(0未收货 1已收货)',
  486. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后单状态(0进行中 10已拒绝 20已完成 30已取消)',
  487. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  488. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  489. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  490. PRIMARY KEY (`order_refund_id`),
  491. KEY `order_id` (`order_id`),
  492. KEY `order_goods_id` (`order_goods_id`),
  493. KEY `user_id` (`user_id`),
  494. KEY `store_id` (`store_id`)
  495. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='售后单记录表';
  496. DROP TABLE IF EXISTS `yoshop_order_refund_address`;
  497. CREATE TABLE `yoshop_order_refund_address` (
  498. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  499. `order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单ID',
  500. `name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '收货人姓名',
  501. `phone` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '联系电话',
  502. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在省份ID',
  503. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在城市ID',
  504. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在区/县ID',
  505. `detail` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '详细地址',
  506. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  507. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  508. PRIMARY KEY (`id`),
  509. KEY `store_id` (`store_id`)
  510. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='售后单退货地址记录表';
  511. DROP TABLE IF EXISTS `yoshop_order_refund_image`;
  512. CREATE TABLE `yoshop_order_refund_image` (
  513. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  514. `order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单ID',
  515. `image_id` int(11) NOT NULL DEFAULT '0' COMMENT '图片id(关联文件记录表)',
  516. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  517. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  518. PRIMARY KEY (`id`),
  519. KEY `order_refund_id` (`order_refund_id`),
  520. KEY `store_id` (`store_id`)
  521. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='售后单图片记录表';
  522. DROP TABLE IF EXISTS `yoshop_page`;
  523. CREATE TABLE `yoshop_page` (
  524. `page_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '页面ID',
  525. `page_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '页面类型(10首页 20自定义页)',
  526. `page_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '页面名称',
  527. `page_data` longtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '页面数据',
  528. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  529. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '软删除',
  530. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  531. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  532. PRIMARY KEY (`page_id`),
  533. KEY `store_id` (`store_id`),
  534. KEY `page_type` (`page_type`,`store_id`) USING BTREE
  535. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
  536. DROP TABLE IF EXISTS `yoshop_payment`;
  537. CREATE TABLE `yoshop_payment` (
  538. `payment_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '支付方式ID',
  539. `client` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '客户端(H5、小程序、APP)',
  540. `method` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付方式(微信、支付宝、余额)',
  541. `is_must_template` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否需要支付模板',
  542. `template_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '支付模板ID',
  543. `is_enable` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否启用支付项',
  544. `is_default` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否为默认支付方式',
  545. `others` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '其他选项(json格式)',
  546. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  547. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  548. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  549. PRIMARY KEY (`payment_id`),
  550. KEY `store_id` (`store_id`),
  551. KEY `client` (`client`,`method`) USING BTREE
  552. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商城支付方式记录表';
  553. DROP TABLE IF EXISTS `yoshop_payment_template`;
  554. CREATE TABLE `yoshop_payment_template` (
  555. `template_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '支付模板ID',
  556. `name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付模板名称',
  557. `method` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付方式(微信、支付宝、余额)',
  558. `config` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付配置(json格式)',
  559. `remarks` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '管理员备注',
  560. `wechatpay_serial` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '微信支付V3平台证书序号',
  561. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  562. `is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  563. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  564. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  565. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  566. PRIMARY KEY (`template_id`),
  567. KEY `store_id` (`store_id`)
  568. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商城支付模板记录表';
  569. DROP TABLE IF EXISTS `yoshop_payment_trade`;
  570. CREATE TABLE `yoshop_payment_trade` (
  571. `trade_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '交易记录ID',
  572. `out_trade_no` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '交易订单号(全局唯一)',
  573. `client` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '发起客户端(H5、小程序、APP)',
  574. `pay_method` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付方式(微信、支付宝)',
  575. `order_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单类型(10商城订单 100余额充值订单)',
  576. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID(商城订单、充值订单)',
  577. `order_no` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商城订单号(商城订单、充值订单)',
  578. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单用户ID',
  579. `trade_no` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '第三方交易流水号',
  580. `prepay_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '预支付交易会话ID(微信支付)',
  581. `trade_state` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '交易状态(10未支付 20支付成功 30转入退款 40已关闭)',
  582. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  583. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  584. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  585. PRIMARY KEY (`trade_id`),
  586. UNIQUE KEY `out_trade_no` (`out_trade_no`),
  587. KEY `client` (`client`,`pay_method`) USING BTREE,
  588. KEY `order_type` (`order_type`),
  589. KEY `user_id` (`user_id`),
  590. KEY `trade_status` (`trade_state`),
  591. KEY `store_id` (`store_id`)
  592. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='第三方支付交易记录表';
  593. DROP TABLE IF EXISTS `yoshop_printer`;
  594. CREATE TABLE `yoshop_printer` (
  595. `printer_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '打印机ID',
  596. `printer_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '打印机名称',
  597. `printer_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '打印机类型',
  598. `printer_config` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '打印机配置',
  599. `print_times` smallint(5) unsigned NOT NULL DEFAULT '0' COMMENT '打印联数(次数)',
  600. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序 (数字越小越靠前)',
  601. `is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  602. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  603. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  604. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  605. PRIMARY KEY (`printer_id`),
  606. KEY `store_id` (`store_id`)
  607. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='小票打印机记录表';
  608. DROP TABLE IF EXISTS `yoshop_recharge_order`;
  609. CREATE TABLE `yoshop_recharge_order` (
  610. `order_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID',
  611. `order_no` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '订单号',
  612. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  613. `recharge_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '充值方式(10自定义金额 20套餐充值)',
  614. `plan_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '充值套餐ID',
  615. `pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '用户支付金额',
  616. `gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
  617. `actual_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际到账金额',
  618. `pay_method` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '支付方式(微信/支付宝)',
  619. `pay_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '支付状态(10待支付 20已支付)',
  620. `pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '付款时间',
  621. `trade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '第三方交易记录ID',
  622. `platform` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '来源客户端 (APP、H5、小程序等)',
  623. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  624. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  625. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  626. PRIMARY KEY (`order_id`),
  627. KEY `order_no` (`order_no`),
  628. KEY `user_id` (`user_id`),
  629. KEY `plan_id` (`plan_id`),
  630. KEY `store_id` (`store_id`)
  631. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员充值订单表';
  632. DROP TABLE IF EXISTS `yoshop_recharge_order_plan`;
  633. CREATE TABLE `yoshop_recharge_order_plan` (
  634. `order_plan_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  635. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  636. `plan_id` int(11) unsigned NOT NULL COMMENT '主键ID',
  637. `plan_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '方案名称',
  638. `money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '充值金额',
  639. `gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
  640. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  641. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  642. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  643. PRIMARY KEY (`order_plan_id`),
  644. KEY `order_id` (`order_id`),
  645. KEY `plan_id` (`plan_id`),
  646. KEY `store_id` (`store_id`)
  647. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员充值订单套餐快照表';
  648. DROP TABLE IF EXISTS `yoshop_recharge_plan`;
  649. CREATE TABLE `yoshop_recharge_plan` (
  650. `plan_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  651. `plan_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '套餐名称',
  652. `money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '充值金额',
  653. `gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
  654. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  655. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  656. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  657. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  658. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  659. PRIMARY KEY (`plan_id`),
  660. KEY `store_id` (`store_id`)
  661. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='会员充值套餐表';
  662. DROP TABLE IF EXISTS `yoshop_region`;
  663. CREATE TABLE `yoshop_region` (
  664. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '区划信息ID',
  665. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '区划名称',
  666. `pid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级ID',
  667. `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '区划编码',
  668. `level` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '层级(1省级 2市级 3区/县级)',
  669. PRIMARY KEY (`id`) USING BTREE
  670. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='省市区数据表';
  671. DROP TABLE IF EXISTS `yoshop_spec`;
  672. CREATE TABLE `yoshop_spec` (
  673. `spec_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '规格组ID',
  674. `spec_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '规格组名称',
  675. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  676. `create_time` int(11) NOT NULL COMMENT '创建时间',
  677. PRIMARY KEY (`spec_id`),
  678. KEY `spec_name` (`spec_name`),
  679. KEY `store_id` (`store_id`)
  680. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品规格组记录表';
  681. DROP TABLE IF EXISTS `yoshop_spec_value`;
  682. CREATE TABLE `yoshop_spec_value` (
  683. `spec_value_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '规格值ID',
  684. `spec_value` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '规格值',
  685. `spec_id` int(11) NOT NULL COMMENT '规格组ID',
  686. `store_id` int(11) NOT NULL COMMENT '商城ID',
  687. `create_time` int(11) NOT NULL COMMENT '创建时间',
  688. PRIMARY KEY (`spec_value_id`),
  689. KEY `spec_value` (`spec_value`),
  690. KEY `spec_id` (`spec_id`),
  691. KEY `store_id` (`store_id`)
  692. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品规格值记录表';
  693. DROP TABLE IF EXISTS `yoshop_store`;
  694. CREATE TABLE `yoshop_store` (
  695. `store_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商城ID',
  696. `store_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商城名称',
  697. `describe` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '商城简介',
  698. `logo_image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城logo文件ID',
  699. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  700. `is_recycle` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否回收',
  701. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  702. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  703. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  704. PRIMARY KEY (`store_id`)
  705. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家(商户)记录表';
  706. DROP TABLE IF EXISTS `yoshop_store_address`;
  707. CREATE TABLE `yoshop_store_address` (
  708. `address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '地址ID',
  709. `type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '地址类型(10发货地址 20退货地址)',
  710. `name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '联系人姓名',
  711. `phone` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '联系电话',
  712. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '省份ID',
  713. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城市ID',
  714. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '区/县ID',
  715. `detail` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '详细地址',
  716. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  717. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  718. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  719. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  720. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  721. PRIMARY KEY (`address_id`),
  722. KEY `type` (`type`),
  723. KEY `store_id` (`store_id`) USING BTREE
  724. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家地址记录表';
  725. DROP TABLE IF EXISTS `yoshop_store_api`;
  726. CREATE TABLE `yoshop_store_api` (
  727. `api_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  728. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '权限名称',
  729. `url` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '权限url',
  730. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级ID',
  731. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  732. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  733. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  734. PRIMARY KEY (`api_id`)
  735. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家后台api权限表';
  736. DROP TABLE IF EXISTS `yoshop_store_menu`;
  737. CREATE TABLE `yoshop_store_menu` (
  738. `menu_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
  739. `type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '菜单类型(10页面 20操作)',
  740. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '菜单名称',
  741. `path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '菜单路径(唯一)',
  742. `is_page` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否为页面(1是 0否)',
  743. `module_key` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '功能模块key',
  744. `action_mark` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '操作标识',
  745. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上级菜单ID',
  746. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  747. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  748. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  749. PRIMARY KEY (`menu_id`)
  750. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家后台菜单记录表';
  751. DROP TABLE IF EXISTS `yoshop_store_menu_api`;
  752. CREATE TABLE `yoshop_store_menu_api` (
  753. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  754. `menu_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '菜单ID',
  755. `api_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '后台api ID',
  756. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  757. PRIMARY KEY (`id`),
  758. KEY `menu_id` (`menu_id`)
  759. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家后台菜单与API权限关系表';
  760. DROP TABLE IF EXISTS `yoshop_store_role`;
  761. CREATE TABLE `yoshop_store_role` (
  762. `role_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '角色ID',
  763. `role_name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '角色名称',
  764. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级角色ID',
  765. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  766. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  767. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  768. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  769. PRIMARY KEY (`role_id`)
  770. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家用户角色表';
  771. DROP TABLE IF EXISTS `yoshop_store_role_menu`;
  772. CREATE TABLE `yoshop_store_role_menu` (
  773. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  774. `role_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户角色ID',
  775. `menu_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '菜单ID',
  776. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  777. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  778. PRIMARY KEY (`id`),
  779. KEY `role_id` (`role_id`),
  780. KEY `store_id` (`store_id`)
  781. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家后台用户角色与菜单权限关系表';
  782. DROP TABLE IF EXISTS `yoshop_store_setting`;
  783. CREATE TABLE `yoshop_store_setting` (
  784. `key` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设置项标示',
  785. `describe` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '设置项描述',
  786. `values` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设置内容(json格式)',
  787. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  788. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  789. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  790. UNIQUE KEY `unique_key` (`key`,`store_id`),
  791. KEY `store_id` (`store_id`)
  792. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家设置记录表';
  793. DROP TABLE IF EXISTS `yoshop_store_user`;
  794. CREATE TABLE `yoshop_store_user` (
  795. `store_user_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  796. `user_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户名',
  797. `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '登录密码',
  798. `real_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '姓名',
  799. `is_super` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否为超级管理员',
  800. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  801. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  802. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  803. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  804. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  805. PRIMARY KEY (`store_user_id`),
  806. KEY `user_name` (`user_name`),
  807. KEY `store_id` (`store_id`)
  808. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家用户记录表';
  809. DROP TABLE IF EXISTS `yoshop_store_user_role`;
  810. CREATE TABLE `yoshop_store_user_role` (
  811. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  812. `store_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '超管用户ID',
  813. `role_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色ID',
  814. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  815. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  816. PRIMARY KEY (`id`),
  817. KEY `store_user_id` (`store_user_id`) USING BTREE,
  818. KEY `role_id` (`role_id`),
  819. KEY `store_id` (`store_id`)
  820. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商家用户角色记录表';
  821. DROP TABLE IF EXISTS `yoshop_system_process`;
  822. CREATE TABLE `yoshop_system_process` (
  823. `key` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '进程标识',
  824. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  825. `last_working_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后运行时间',
  826. PRIMARY KEY (`key`),
  827. UNIQUE KEY `key` (`key`)
  828. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='系统进程记录';
  829. DROP TABLE IF EXISTS `yoshop_upload_file`;
  830. CREATE TABLE `yoshop_upload_file` (
  831. `file_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '文件ID',
  832. `group_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文件分组ID',
  833. `channel` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '上传来源(10商户后台 20用户端)',
  834. `storage` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '存储方式',
  835. `domain` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '存储域名',
  836. `file_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '文件类型(10图片 20附件 30视频)',
  837. `file_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '文件名称(仅显示)',
  838. `file_path` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '文件路径',
  839. `file_size` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文件大小(字节)',
  840. `file_ext` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '文件扩展名',
  841. `cover` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '文件封面',
  842. `uploader_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上传者用户ID',
  843. `is_recycle` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否在回收站',
  844. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  845. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  846. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  847. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  848. PRIMARY KEY (`file_id`),
  849. KEY `group_id` (`group_id`),
  850. KEY `is_recycle` (`is_recycle`),
  851. KEY `store_id` (`store_id`)
  852. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件库记录表';
  853. DROP TABLE IF EXISTS `yoshop_upload_group`;
  854. CREATE TABLE `yoshop_upload_group` (
  855. `group_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '分组ID',
  856. `name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '分组名称',
  857. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上级分组ID',
  858. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  859. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  860. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  861. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  862. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  863. PRIMARY KEY (`group_id`),
  864. KEY `store_id` (`store_id`)
  865. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='文件库分组记录表';
  866. DROP TABLE IF EXISTS `yoshop_user`;
  867. CREATE TABLE `yoshop_user` (
  868. `user_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  869. `mobile` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户手机号',
  870. `nick_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '用户昵称',
  871. `avatar_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '头像文件ID',
  872. `gender` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '性别',
  873. `country` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '国家',
  874. `province` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '省份',
  875. `city` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '城市',
  876. `address_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '默认收货地址',
  877. `balance` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '用户可用余额',
  878. `points` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户可用积分',
  879. `pay_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '用户总支付的金额',
  880. `expend_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际消费的金额(不含退款)',
  881. `grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '会员等级ID',
  882. `platform` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '注册来源客户端 (APP、H5、小程序等)',
  883. `last_login_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后登录时间',
  884. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  885. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  886. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  887. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  888. PRIMARY KEY (`user_id`),
  889. KEY `mobile` (`mobile`),
  890. KEY `store_id` (`store_id`)
  891. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户记录表';
  892. DROP TABLE IF EXISTS `yoshop_user_address`;
  893. CREATE TABLE `yoshop_user_address` (
  894. `address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  895. `name` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '收货人姓名',
  896. `phone` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '联系电话',
  897. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '省份ID',
  898. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城市ID',
  899. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '区/县ID',
  900. `detail` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '详细地址',
  901. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  902. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  903. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  904. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  905. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  906. PRIMARY KEY (`address_id`),
  907. KEY `user_id` (`user_id`),
  908. KEY `store_id` (`store_id`)
  909. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户收货地址表';
  910. DROP TABLE IF EXISTS `yoshop_user_balance_log`;
  911. CREATE TABLE `yoshop_user_balance_log` (
  912. `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  913. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  914. `scene` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)',
  915. `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '变动金额',
  916. `describe` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '描述/说明',
  917. `remark` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '管理员备注',
  918. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  919. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  920. PRIMARY KEY (`log_id`),
  921. KEY `user_id` (`user_id`),
  922. KEY `store_id` (`store_id`)
  923. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户余额变动明细表';
  924. DROP TABLE IF EXISTS `yoshop_user_coupon`;
  925. CREATE TABLE `yoshop_user_coupon` (
  926. `user_coupon_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  927. `coupon_id` int(11) unsigned NOT NULL COMMENT '优惠券ID',
  928. `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '优惠券名称',
  929. `coupon_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '优惠券类型(10满减券 20折扣券)',
  930. `reduce_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '满减券-减免金额',
  931. `discount` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '折扣券-折扣率(0-100)',
  932. `min_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最低消费金额',
  933. `expire_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '到期类型(10领取后生效 20固定时间)',
  934. `expire_day` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '领取后生效-有效天数',
  935. `start_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '有效期开始时间',
  936. `end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '有效期结束时间',
  937. `apply_range` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '适用范围(10全部商品 20指定商品)',
  938. `apply_range_config` text COLLATE utf8mb4_unicode_ci COMMENT '适用范围配置(json格式)',
  939. `is_expire` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否过期(0未过期 1已过期)',
  940. `is_use` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否已使用(0未使用 1已使用)',
  941. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  942. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  943. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  944. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  945. PRIMARY KEY (`user_coupon_id`),
  946. KEY `coupon_id` (`coupon_id`),
  947. KEY `user_id` (`user_id`),
  948. KEY `store_id` (`store_id`)
  949. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户优惠券记录表';
  950. DROP TABLE IF EXISTS `yoshop_user_grade`;
  951. CREATE TABLE `yoshop_user_grade` (
  952. `grade_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '等级ID',
  953. `name` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '等级名称',
  954. `weight` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '等级权重(1-9999)',
  955. `upgrade` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '升级条件',
  956. `equity` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '等级权益(折扣率0-100)',
  957. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1启用 0禁用)',
  958. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  959. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  960. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  961. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  962. PRIMARY KEY (`grade_id`),
  963. KEY `store_id` (`store_id`)
  964. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户会员等级表';
  965. DROP TABLE IF EXISTS `yoshop_user_grade_log`;
  966. CREATE TABLE `yoshop_user_grade_log` (
  967. `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  968. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  969. `old_grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '变更前的等级ID',
  970. `new_grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '变更后的等级ID',
  971. `change_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '变更类型(10后台管理员设置 20自动升级)',
  972. `remark` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '管理员备注',
  973. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  974. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  975. PRIMARY KEY (`log_id`),
  976. KEY `store_id` (`store_id`)
  977. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户会员等级变更记录表';
  978. DROP TABLE IF EXISTS `yoshop_user_oauth`;
  979. CREATE TABLE `yoshop_user_oauth` (
  980. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  981. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  982. `oauth_type` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '第三方登陆类型(MP-WEIXIN)',
  983. `oauth_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '第三方用户唯一标识 (uid openid)',
  984. `unionid` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '微信unionID',
  985. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  986. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  987. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  988. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  989. PRIMARY KEY (`id`),
  990. KEY `user_id` (`user_id`),
  991. KEY `oauth_type` (`oauth_type`),
  992. KEY `store_id` (`store_id`),
  993. KEY `oauth_type_2` (`oauth_type`,`oauth_id`) USING BTREE
  994. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='第三方用户信息表';
  995. DROP TABLE IF EXISTS `yoshop_user_points_log`;
  996. CREATE TABLE `yoshop_user_points_log` (
  997. `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  998. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  999. `value` int(11) NOT NULL DEFAULT '0' COMMENT '变动数量',
  1000. `describe` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '描述/说明',
  1001. `remark` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '管理员备注',
  1002. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  1003. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  1004. PRIMARY KEY (`log_id`),
  1005. KEY `user_id` (`user_id`),
  1006. KEY `store_id` (`store_id`)
  1007. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户积分变动明细表';
  1008. DROP TABLE IF EXISTS `yoshop_wxapp_setting`;
  1009. CREATE TABLE `yoshop_wxapp_setting` (
  1010. `key` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '设置项标示',
  1011. `describe` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '设置项描述',
  1012. `values` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '设置内容(json格式)',
  1013. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  1014. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  1015. UNIQUE KEY `unique_key` (`key`,`store_id`)
  1016. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='微信小程序设置表';