install_struct.sql 60 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  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) NOT NULL DEFAULT '' COMMENT '用户名',
  5. `password` varchar(255) 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=utf8 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) 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 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=utf8 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) NOT NULL DEFAULT '' COMMENT '分类名称',
  35. `status` tinyint(3) 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=utf8 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(255) 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=utf8 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) 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=utf8 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 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=utf8 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=utf8 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) 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 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) 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=utf8 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) 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`,`is_delete`),
  144. KEY `store_id` (`store_id`)
  145. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 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 NOT NULL COMMENT '可配送区域(城市id集)',
  151. `region_text` text 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=utf8 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) NOT NULL DEFAULT '' COMMENT '物流公司名称',
  166. `kuaidi100_code` varchar(30) NOT NULL DEFAULT '' COMMENT '物流公司编码 (快递100)',
  167. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  168. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  169. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  170. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  171. PRIMARY KEY (`express_id`),
  172. KEY `store_id` (`store_id`),
  173. KEY `kuaidi100_code` (`kuaidi100_code`) USING BTREE
  174. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='物流公司记录表';
  175. DROP TABLE IF EXISTS `yoshop_goods`;
  176. CREATE TABLE `yoshop_goods` (
  177. `goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品ID',
  178. `goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称',
  179. `goods_no` varchar(50) NOT NULL DEFAULT '' COMMENT '商品编码',
  180. `selling_point` varchar(500) NOT NULL DEFAULT '' COMMENT '商品卖点',
  181. `spec_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商品规格(10单规格 20多规格)',
  182. `goods_price_min` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格(最低)',
  183. `goods_price_max` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格(最高)',
  184. `line_price_min` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '划线价格(最低)',
  185. `line_price_max` decimal(10,2) unsigned DEFAULT '0.00' COMMENT '划线价格(最高)',
  186. `stock_total` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '库存总量(包含所有sku)',
  187. `deduct_stock_type` tinyint(3) unsigned NOT NULL DEFAULT '20' COMMENT '库存计算方式(10下单减库存 20付款减库存)',
  188. `content` longtext NOT NULL COMMENT '商品详情',
  189. `sales_initial` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '初始销量',
  190. `sales_actual` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '实际销量',
  191. `delivery_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '配送模板ID',
  192. `is_points_gift` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启积分赠送(1开启 0关闭)',
  193. `is_points_discount` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否允许使用积分抵扣(1允许 0不允许)',
  194. `is_alone_points_discount` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '积分抵扣设置(0默认抵扣 1单独设置抵扣)',
  195. `points_discount_config` varchar(500) NOT NULL DEFAULT '' COMMENT '单独设置积分抵扣的配置',
  196. `is_enable_grade` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启会员折扣(1开启 0关闭)',
  197. `is_alone_grade` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '会员折扣设置(0默认等级折扣 1单独设置折扣)',
  198. `alone_grade_equity` text COMMENT '单独设置折扣的配置',
  199. `status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '商品状态(10上架 20下架)',
  200. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  201. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  202. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  203. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  204. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  205. PRIMARY KEY (`goods_id`),
  206. KEY `goods_no` (`goods_no`),
  207. KEY `store_id` (`store_id`)
  208. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品记录表';
  209. DROP TABLE IF EXISTS `yoshop_goods_category_rel`;
  210. CREATE TABLE `yoshop_goods_category_rel` (
  211. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  212. `goods_id` int(11) unsigned NOT NULL COMMENT '商品ID',
  213. `category_id` int(11) unsigned NOT NULL COMMENT '商品分类ID',
  214. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  215. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  216. PRIMARY KEY (`id`),
  217. KEY `store_id` (`store_id`),
  218. KEY `goods_id` (`goods_id`),
  219. KEY `category_id` (`category_id`)
  220. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品与分类关系记录表';
  221. DROP TABLE IF EXISTS `yoshop_goods_image`;
  222. CREATE TABLE `yoshop_goods_image` (
  223. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  224. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  225. `image_id` int(11) NOT NULL COMMENT '图片id(关联文件记录表)',
  226. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  227. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  228. PRIMARY KEY (`id`),
  229. KEY `goods_id` (`goods_id`),
  230. KEY `store_id` (`store_id`)
  231. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品图片记录表';
  232. DROP TABLE IF EXISTS `yoshop_goods_service`;
  233. CREATE TABLE `yoshop_goods_service` (
  234. `service_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品服务ID',
  235. `name` varchar(50) NOT NULL DEFAULT '' COMMENT '服务名称',
  236. `summary` varchar(500) NOT NULL DEFAULT '' COMMENT '概述',
  237. `is_default` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否默认(新增商品时)',
  238. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1显示 0隐藏)',
  239. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序方式(数字越小越靠前)',
  240. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除(1已删除)',
  241. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  242. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  243. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  244. PRIMARY KEY (`service_id`),
  245. KEY `store_id` (`store_id`)
  246. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品服务与承诺记录表';
  247. DROP TABLE IF EXISTS `yoshop_goods_service_rel`;
  248. CREATE TABLE `yoshop_goods_service_rel` (
  249. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  250. `goods_id` int(11) unsigned NOT NULL COMMENT '商品ID',
  251. `service_id` int(11) unsigned NOT NULL COMMENT '服务承诺ID',
  252. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  253. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  254. PRIMARY KEY (`id`),
  255. KEY `store_id` (`store_id`),
  256. KEY `goods_id` (`goods_id`),
  257. KEY `service_id` (`service_id`)
  258. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品与服务承诺关系记录表';
  259. DROP TABLE IF EXISTS `yoshop_goods_sku`;
  260. CREATE TABLE `yoshop_goods_sku` (
  261. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '记录ID',
  262. `goods_sku_id` varchar(255) NOT NULL DEFAULT '0' COMMENT '商品sku唯一标识 (由规格id组成)',
  263. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  264. `image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格图片ID',
  265. `goods_sku_no` varchar(100) NOT NULL DEFAULT '' COMMENT '商品sku编码',
  266. `goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格',
  267. `line_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品划线价',
  268. `stock_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前库存数量',
  269. `goods_weight` double unsigned NOT NULL DEFAULT '0' COMMENT '商品重量(Kg)',
  270. `goods_props` varchar(255) NOT NULL DEFAULT '' COMMENT 'SKU的规格属性(json格式)',
  271. `spec_value_ids` varchar(255) NOT NULL DEFAULT '' COMMENT '规格值ID集(json格式)',
  272. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  273. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  274. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  275. PRIMARY KEY (`id`),
  276. UNIQUE KEY `sku_idx` (`goods_id`,`goods_sku_id`),
  277. KEY `store_id` (`store_id`)
  278. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品规格表';
  279. DROP TABLE IF EXISTS `yoshop_goods_spec_rel`;
  280. CREATE TABLE `yoshop_goods_spec_rel` (
  281. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  282. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  283. `spec_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格组ID',
  284. `spec_value_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格值ID',
  285. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  286. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  287. PRIMARY KEY (`id`),
  288. KEY `store_id` (`store_id`)
  289. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品与规格值关系记录表';
  290. DROP TABLE IF EXISTS `yoshop_help`;
  291. CREATE TABLE `yoshop_help` (
  292. `help_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  293. `title` varchar(255) NOT NULL DEFAULT '' COMMENT '帮助标题',
  294. `content` text NOT NULL COMMENT '帮助内容',
  295. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  296. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除(1已删除)',
  297. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  298. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  299. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  300. PRIMARY KEY (`help_id`),
  301. KEY `store_id` (`store_id`)
  302. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='帮助中心记录表';
  303. DROP TABLE IF EXISTS `yoshop_order`;
  304. CREATE TABLE `yoshop_order` (
  305. `order_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID',
  306. `order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单号',
  307. `total_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品总金额(不含优惠折扣)',
  308. `order_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '订单金额(含优惠折扣)',
  309. `coupon_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '优惠券ID',
  310. `coupon_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠券抵扣金额',
  311. `points_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '积分抵扣金额',
  312. `points_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分抵扣数量',
  313. `pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际付款金额(包含运费)',
  314. `update_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '后台修改的订单金额(差价)',
  315. `buyer_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '买家留言',
  316. `pay_type` tinyint(3) unsigned NOT NULL DEFAULT '20' COMMENT '支付方式(10余额支付 20微信支付)',
  317. `pay_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '付款状态(10未付款 20已付款)',
  318. `pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '付款时间',
  319. `delivery_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '配送方式(10快递配送)',
  320. `express_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '运费金额',
  321. `express_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '物流公司ID',
  322. `express_company` varchar(50) NOT NULL DEFAULT '' COMMENT '物流公司',
  323. `express_no` varchar(50) NOT NULL DEFAULT '' COMMENT '物流单号',
  324. `delivery_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '发货状态(10未发货 20已发货)',
  325. `delivery_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发货时间',
  326. `receipt_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '收货状态(10未收货 20已收货)',
  327. `receipt_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '收货时间',
  328. `order_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单状态(10进行中 20取消 21待取消 30已完成)',
  329. `points_bonus` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '赠送的积分数量',
  330. `is_settled` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '订单是否已结算(0未结算 1已结算)',
  331. `transaction_id` varchar(30) NOT NULL DEFAULT '' COMMENT '微信支付交易号',
  332. `is_comment` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否已评价(0否 1是)',
  333. `order_source` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单来源(10普通订单)',
  334. `order_source_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '来源记录ID',
  335. `platform` varchar(20) NOT NULL DEFAULT '' COMMENT '来源客户端 (APP、H5、小程序等)',
  336. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  337. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  338. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  339. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  340. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  341. PRIMARY KEY (`order_id`),
  342. UNIQUE KEY `order_no` (`order_no`) USING BTREE,
  343. KEY `store_id` (`store_id`),
  344. KEY `user_id` (`user_id`)
  345. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='订单记录表';
  346. DROP TABLE IF EXISTS `yoshop_order_address`;
  347. CREATE TABLE `yoshop_order_address` (
  348. `order_address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '地址ID',
  349. `name` varchar(100) NOT NULL DEFAULT '' COMMENT '收货人姓名',
  350. `last_name` varchar(100) NOT NULL DEFAULT '' COMMENT '收货人姓',
  351. `phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
  352. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '省份ID',
  353. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城市ID',
  354. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '区/县ID',
  355. `city` varchar(255) NOT NULL DEFAULT '' COMMENT '城市',
  356. `detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
  357. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  358. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  359. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  360. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  361. PRIMARY KEY (`order_address_id`) USING BTREE,
  362. KEY `user_id` (`user_id`),
  363. KEY `store_id` (`store_id`)
  364. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='订单收货地址记录表';
  365. DROP TABLE IF EXISTS `yoshop_order_goods`;
  366. CREATE TABLE `yoshop_order_goods` (
  367. `order_goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  368. `goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
  369. `goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称',
  370. `image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品封面图ID',
  371. `deduct_stock_type` tinyint(3) unsigned NOT NULL DEFAULT '20' COMMENT '库存计算方式(10下单减库存 20付款减库存)',
  372. `spec_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '规格类型(10单规格 20多规格)',
  373. `goods_sku_id` varchar(255) NOT NULL DEFAULT '' COMMENT '商品sku唯一标识',
  374. `goods_props` varchar(255) NOT NULL DEFAULT '' COMMENT 'SKU的规格属性(json格式)',
  375. `content` longtext NOT NULL COMMENT '商品详情',
  376. `goods_no` varchar(100) NOT NULL DEFAULT '' COMMENT '商品编码',
  377. `goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格(单价)',
  378. `line_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品划线价',
  379. `goods_weight` double unsigned NOT NULL DEFAULT '0' COMMENT '商品重量(Kg)',
  380. `is_user_grade` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否存在会员等级折扣',
  381. `grade_ratio` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '会员折扣比例(0-10)',
  382. `grade_goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '会员折扣的商品单价',
  383. `grade_total_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '会员折扣的总额差',
  384. `coupon_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠券折扣金额',
  385. `points_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '积分金额',
  386. `points_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '积分抵扣数量',
  387. `points_bonus` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '赠送的积分数量',
  388. `total_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '购买数量',
  389. `total_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品总价(数量×单价)',
  390. `total_pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际付款价(折扣和优惠后)',
  391. `is_comment` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否已评价(0否 1是)',
  392. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  393. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  394. `goods_source_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '来源记录ID',
  395. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  396. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  397. PRIMARY KEY (`order_goods_id`) USING BTREE,
  398. KEY `goods_id` (`goods_id`),
  399. KEY `order_id` (`order_id`),
  400. KEY `user_id` (`user_id`),
  401. KEY `store_id` (`store_id`)
  402. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='订单商品记录表';
  403. DROP TABLE IF EXISTS `yoshop_order_refund`;
  404. CREATE TABLE `yoshop_order_refund` (
  405. `order_refund_id` int(11) unsigned NOT NULL AUTO_INCREMENT 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. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  409. `type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后类型(10退货退款 20换货)',
  410. `apply_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '用户申请原因(说明)',
  411. `audit_status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家审核状态(0待审核 10已同意 20已拒绝)',
  412. `refuse_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '商家拒绝原因(说明)',
  413. `refund_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际退款金额',
  414. `is_user_send` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '用户是否发货(0未发货 1已发货)',
  415. `send_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户发货时间',
  416. `express_id` varchar(32) NOT NULL DEFAULT '' COMMENT '用户发货物流公司ID',
  417. `express_no` varchar(32) NOT NULL DEFAULT '' COMMENT '用户发货物流单号',
  418. `is_receipt` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家收货状态(0未收货 1已收货)',
  419. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后单状态(0进行中 10已拒绝 20已完成 30已取消)',
  420. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  421. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  422. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  423. PRIMARY KEY (`order_refund_id`),
  424. KEY `order_id` (`order_id`),
  425. KEY `order_goods_id` (`order_goods_id`),
  426. KEY `user_id` (`user_id`),
  427. KEY `store_id` (`store_id`)
  428. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='售后单记录表';
  429. DROP TABLE IF EXISTS `yoshop_order_refund_address`;
  430. CREATE TABLE `yoshop_order_refund_address` (
  431. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  432. `order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单ID',
  433. `name` varchar(30) NOT NULL DEFAULT '' COMMENT '收货人姓名',
  434. `phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
  435. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在省份ID',
  436. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在城市ID',
  437. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在区/县ID',
  438. `detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
  439. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  440. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  441. PRIMARY KEY (`id`),
  442. KEY `store_id` (`store_id`)
  443. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='售后单退货地址记录表';
  444. DROP TABLE IF EXISTS `yoshop_order_refund_image`;
  445. CREATE TABLE `yoshop_order_refund_image` (
  446. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  447. `order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单ID',
  448. `image_id` int(11) NOT NULL DEFAULT '0' COMMENT '图片id(关联文件记录表)',
  449. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  450. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  451. PRIMARY KEY (`id`),
  452. KEY `order_refund_id` (`order_refund_id`),
  453. KEY `store_id` (`store_id`)
  454. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='售后单图片记录表';
  455. DROP TABLE IF EXISTS `yoshop_page`;
  456. CREATE TABLE `yoshop_page` (
  457. `page_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '页面ID',
  458. `page_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '页面类型(10首页 20自定义页)',
  459. `page_name` varchar(255) NOT NULL DEFAULT '' COMMENT '页面名称',
  460. `page_data` longtext NOT NULL COMMENT '页面数据',
  461. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  462. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '软删除',
  463. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  464. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  465. PRIMARY KEY (`page_id`),
  466. KEY `store_id` (`store_id`),
  467. KEY `page_type` (`page_type`,`store_id`) USING BTREE
  468. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='店铺页面记录表';
  469. DROP TABLE IF EXISTS `yoshop_recharge_order`;
  470. CREATE TABLE `yoshop_recharge_order` (
  471. `order_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单ID',
  472. `order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单号',
  473. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  474. `recharge_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '充值方式(10自定义金额 20套餐充值)',
  475. `plan_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '充值套餐ID',
  476. `pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '用户支付金额',
  477. `gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
  478. `actual_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际到账金额',
  479. `pay_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '支付状态(10待支付 20已支付)',
  480. `pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '付款时间',
  481. `transaction_id` varchar(30) NOT NULL DEFAULT '' COMMENT '微信支付交易号',
  482. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城ID',
  483. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  484. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  485. PRIMARY KEY (`order_id`),
  486. KEY `order_no` (`order_no`),
  487. KEY `user_id` (`user_id`),
  488. KEY `plan_id` (`plan_id`),
  489. KEY `store_id` (`store_id`)
  490. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='会员充值订单表';
  491. DROP TABLE IF EXISTS `yoshop_recharge_order_plan`;
  492. CREATE TABLE `yoshop_recharge_order_plan` (
  493. `order_plan_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  494. `order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单ID',
  495. `plan_id` int(11) unsigned NOT NULL COMMENT '主键ID',
  496. `plan_name` varchar(255) NOT NULL DEFAULT '' COMMENT '方案名称',
  497. `money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '充值金额',
  498. `gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
  499. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城ID',
  500. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  501. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  502. PRIMARY KEY (`order_plan_id`),
  503. KEY `order_id` (`order_id`),
  504. KEY `plan_id` (`plan_id`),
  505. KEY `store_id` (`store_id`)
  506. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='会员充值订单套餐快照表';
  507. DROP TABLE IF EXISTS `yoshop_recharge_plan`;
  508. CREATE TABLE `yoshop_recharge_plan` (
  509. `plan_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  510. `plan_name` varchar(255) NOT NULL DEFAULT '' COMMENT '套餐名称',
  511. `money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '充值金额',
  512. `gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
  513. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  514. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  515. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城ID',
  516. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  517. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  518. PRIMARY KEY (`plan_id`),
  519. KEY `store_id` (`store_id`)
  520. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='会员充值套餐表';
  521. DROP TABLE IF EXISTS `yoshop_region`;
  522. CREATE TABLE `yoshop_region` (
  523. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '区划信息ID',
  524. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '区划名称',
  525. `pid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级ID',
  526. `code` varchar(255) NOT NULL DEFAULT '' COMMENT '区划编码',
  527. `level` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '层级(1省级 2市级 3区/县级)',
  528. PRIMARY KEY (`id`) USING BTREE
  529. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='省市区数据表';
  530. DROP TABLE IF EXISTS `yoshop_spec`;
  531. CREATE TABLE `yoshop_spec` (
  532. `spec_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '规格组ID',
  533. `spec_name` varchar(255) NOT NULL DEFAULT '' COMMENT '规格组名称',
  534. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  535. `create_time` int(11) NOT NULL COMMENT '创建时间',
  536. PRIMARY KEY (`spec_id`),
  537. KEY `spec_name` (`spec_name`),
  538. KEY `store_id` (`store_id`)
  539. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品规格组记录表';
  540. DROP TABLE IF EXISTS `yoshop_spec_value`;
  541. CREATE TABLE `yoshop_spec_value` (
  542. `spec_value_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '规格值ID',
  543. `spec_value` varchar(255) NOT NULL COMMENT '规格值',
  544. `spec_id` int(11) NOT NULL COMMENT '规格组ID',
  545. `store_id` int(11) NOT NULL COMMENT '商城ID',
  546. `create_time` int(11) NOT NULL COMMENT '创建时间',
  547. PRIMARY KEY (`spec_value_id`),
  548. KEY `spec_value` (`spec_value`),
  549. KEY `spec_id` (`spec_id`),
  550. KEY `store_id` (`store_id`)
  551. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品规格值记录表';
  552. DROP TABLE IF EXISTS `yoshop_store`;
  553. CREATE TABLE `yoshop_store` (
  554. `store_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商城ID',
  555. `store_name` varchar(50) NOT NULL DEFAULT '' COMMENT '商城名称',
  556. `describe` varchar(500) NOT NULL DEFAULT '' COMMENT '商城简介',
  557. `logo_image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城logo文件ID',
  558. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  559. `is_recycle` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否回收',
  560. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  561. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  562. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  563. PRIMARY KEY (`store_id`)
  564. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家(商户)记录表';
  565. DROP TABLE IF EXISTS `yoshop_store_address`;
  566. CREATE TABLE `yoshop_store_address` (
  567. `address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '地址ID',
  568. `type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '地址类型(10发货地址 20退货地址)',
  569. `name` varchar(30) NOT NULL DEFAULT '' COMMENT '联系人姓名',
  570. `phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
  571. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '省份ID',
  572. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城市ID',
  573. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '区/县ID',
  574. `detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
  575. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  576. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  577. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  578. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  579. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  580. PRIMARY KEY (`address_id`),
  581. KEY `type` (`type`),
  582. KEY `store_id` (`store_id`) USING BTREE
  583. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家地址记录表';
  584. DROP TABLE IF EXISTS `yoshop_store_api`;
  585. CREATE TABLE `yoshop_store_api` (
  586. `api_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  587. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '权限名称',
  588. `url` varchar(255) NOT NULL DEFAULT '' COMMENT '权限url',
  589. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级ID',
  590. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  591. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  592. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  593. PRIMARY KEY (`api_id`)
  594. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家后台api权限表';
  595. DROP TABLE IF EXISTS `yoshop_store_menu`;
  596. CREATE TABLE `yoshop_store_menu` (
  597. `menu_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '菜单ID',
  598. `module` tinyint(3) NOT NULL DEFAULT '10' COMMENT '模块类型(10菜单 20操作)',
  599. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '菜单名称',
  600. `path` varchar(255) NOT NULL DEFAULT '' COMMENT '菜单路径(唯一)',
  601. `action_mark` varchar(255) NOT NULL DEFAULT '' COMMENT '操作标识',
  602. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上级菜单ID',
  603. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  604. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  605. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  606. PRIMARY KEY (`menu_id`)
  607. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家后台菜单记录表';
  608. DROP TABLE IF EXISTS `yoshop_store_menu_api`;
  609. CREATE TABLE `yoshop_store_menu_api` (
  610. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  611. `menu_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '菜单ID',
  612. `api_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户角色ID',
  613. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  614. PRIMARY KEY (`id`),
  615. KEY `menu_id` (`menu_id`)
  616. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家后台用户角色与菜单权限关系表';
  617. DROP TABLE IF EXISTS `yoshop_store_role`;
  618. CREATE TABLE `yoshop_store_role` (
  619. `role_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '角色ID',
  620. `role_name` varchar(50) NOT NULL DEFAULT '' COMMENT '角色名称',
  621. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级角色ID',
  622. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  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 (`role_id`)
  627. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家用户角色表';
  628. DROP TABLE IF EXISTS `yoshop_store_role_menu`;
  629. CREATE TABLE `yoshop_store_role_menu` (
  630. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  631. `role_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户角色ID',
  632. `menu_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '菜单ID',
  633. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  634. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  635. PRIMARY KEY (`id`),
  636. KEY `role_id` (`role_id`),
  637. KEY `store_id` (`store_id`)
  638. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家后台用户角色与菜单权限关系表';
  639. DROP TABLE IF EXISTS `yoshop_store_setting`;
  640. CREATE TABLE `yoshop_store_setting` (
  641. `key` varchar(30) NOT NULL COMMENT '设置项标示',
  642. `describe` varchar(255) NOT NULL DEFAULT '' COMMENT '设置项描述',
  643. `values` mediumtext NOT NULL COMMENT '设置内容(json格式)',
  644. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  645. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  646. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  647. UNIQUE KEY `unique_key` (`key`,`store_id`),
  648. KEY `store_id` (`store_id`)
  649. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='商家设置记录表';
  650. DROP TABLE IF EXISTS `yoshop_store_user`;
  651. CREATE TABLE `yoshop_store_user` (
  652. `store_user_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  653. `user_name` varchar(255) NOT NULL DEFAULT '' COMMENT '用户名',
  654. `password` varchar(255) NOT NULL DEFAULT '' COMMENT '登录密码',
  655. `real_name` varchar(255) NOT NULL DEFAULT '' COMMENT '姓名',
  656. `is_super` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否为超级管理员',
  657. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  658. `sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
  659. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  660. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  661. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  662. PRIMARY KEY (`store_user_id`),
  663. KEY `user_name` (`user_name`),
  664. KEY `store_id` (`store_id`)
  665. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家用户记录表';
  666. DROP TABLE IF EXISTS `yoshop_store_user_role`;
  667. CREATE TABLE `yoshop_store_user_role` (
  668. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  669. `store_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '超管用户ID',
  670. `role_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色ID',
  671. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  672. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  673. PRIMARY KEY (`id`),
  674. KEY `store_user_id` (`store_user_id`) USING BTREE,
  675. KEY `role_id` (`role_id`),
  676. KEY `store_id` (`store_id`)
  677. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家用户角色记录表';
  678. DROP TABLE IF EXISTS `yoshop_upload_file`;
  679. CREATE TABLE `yoshop_upload_file` (
  680. `file_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '文件ID',
  681. `group_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文件分组ID',
  682. `channel` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '上传来源(10商户后台 20用户端)',
  683. `storage` varchar(10) NOT NULL DEFAULT '' COMMENT '存储方式',
  684. `domain` varchar(255) NOT NULL DEFAULT '' COMMENT '存储域名',
  685. `file_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '文件类型(10图片 20附件 30视频)',
  686. `file_name` varchar(255) NOT NULL DEFAULT '' COMMENT '文件名称(仅显示)',
  687. `file_path` varchar(255) NOT NULL DEFAULT '' COMMENT '文件路径',
  688. `file_size` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文件大小(字节)',
  689. `file_ext` varchar(20) NOT NULL DEFAULT '' COMMENT '文件扩展名',
  690. `cover` varchar(255) NOT NULL DEFAULT '' COMMENT '文件封面',
  691. `uploader_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上传者用户ID',
  692. `is_recycle` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否在回收站',
  693. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  694. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  695. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  696. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  697. PRIMARY KEY (`file_id`),
  698. KEY `group_id` (`group_id`),
  699. KEY `is_recycle` (`is_recycle`),
  700. KEY `store_id` (`store_id`)
  701. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='文件库记录表';
  702. DROP TABLE IF EXISTS `yoshop_upload_group`;
  703. CREATE TABLE `yoshop_upload_group` (
  704. `group_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '分组ID',
  705. `name` varchar(30) NOT NULL DEFAULT '' COMMENT '分组名称',
  706. `parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上级分组ID',
  707. `sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
  708. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  709. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  710. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  711. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  712. PRIMARY KEY (`group_id`),
  713. KEY `store_id` (`store_id`)
  714. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='文件库分组记录表';
  715. DROP TABLE IF EXISTS `yoshop_user`;
  716. CREATE TABLE `yoshop_user` (
  717. `user_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '用户ID',
  718. `mobile` varchar(100) NOT NULL DEFAULT '' COMMENT '用户邮箱',
  719. `nick_name` varchar(255) NOT NULL DEFAULT '' COMMENT '用户昵称',
  720. `avatar_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '头像文件ID',
  721. `gender` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '性别',
  722. `country` varchar(50) NOT NULL DEFAULT '' COMMENT '国家',
  723. `province` varchar(50) NOT NULL DEFAULT '' COMMENT '省份',
  724. `city` varchar(50) NOT NULL DEFAULT '' COMMENT '城市',
  725. `address_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '默认收货地址',
  726. `balance` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '用户可用余额',
  727. `points` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户可用积分',
  728. `pay_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '用户总支付的金额',
  729. `expend_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际消费的金额(不含退款)',
  730. `grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '会员等级ID',
  731. `platform` varchar(20) NOT NULL DEFAULT '' COMMENT '注册来源的平台 (APP、H5、小程序等)',
  732. `last_login_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后登录时间',
  733. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  734. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  735. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  736. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  737. `salt` varchar(50) NOT NULL DEFAULT '' COMMENT '盐',
  738. `password` varchar(255) NOT NULL DEFAULT '' COMMENT '密码',
  739. PRIMARY KEY (`user_id`),
  740. KEY `mobile` (`mobile`),
  741. KEY `store_id` (`store_id`)
  742. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户记录表';
  743. DROP TABLE IF EXISTS `yoshop_user_address`;
  744. CREATE TABLE `yoshop_user_address` (
  745. `address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  746. `name` varchar(100) NOT NULL DEFAULT '' COMMENT '收货人姓名',
  747. `last_name` varchar(100) NOT NULL DEFAULT '' COMMENT '收货人姓',
  748. `phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
  749. `email` varchar(100) NOT NULL DEFAULT '' COMMENT '联系邮箱',
  750. `zip_code` varchar(20) NOT NULL DEFAULT '' COMMENT '邮编',
  751. `province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '省份ID',
  752. `city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '城市ID',
  753. `region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '区/县ID',
  754. `city` varchar(255) NOT NULL DEFAULT '' COMMENT '城市',
  755. `detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
  756. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  757. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  758. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  759. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  760. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  761. PRIMARY KEY (`address_id`),
  762. KEY `user_id` (`user_id`),
  763. KEY `store_id` (`store_id`)
  764. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户收货地址表';
  765. DROP TABLE IF EXISTS `yoshop_user_balance_log`;
  766. CREATE TABLE `yoshop_user_balance_log` (
  767. `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  768. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  769. `scene` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)',
  770. `money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '变动金额',
  771. `describe` varchar(500) NOT NULL DEFAULT '' COMMENT '描述/说明',
  772. `remark` varchar(500) NOT NULL DEFAULT '' COMMENT '管理员备注',
  773. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城ID',
  774. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  775. PRIMARY KEY (`log_id`),
  776. KEY `user_id` (`user_id`),
  777. KEY `store_id` (`store_id`)
  778. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户余额变动明细表';
  779. DROP TABLE IF EXISTS `yoshop_user_coupon`;
  780. CREATE TABLE `yoshop_user_coupon` (
  781. `user_coupon_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  782. `coupon_id` int(11) unsigned NOT NULL COMMENT '优惠券ID',
  783. `name` varchar(255) NOT NULL DEFAULT '' COMMENT '优惠券名称',
  784. `coupon_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '优惠券类型(10满减券 20折扣券)',
  785. `reduce_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '满减券-减免金额',
  786. `discount` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '折扣券-折扣率(0-100)',
  787. `min_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '最低消费金额',
  788. `expire_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '到期类型(10领取后生效 20固定时间)',
  789. `expire_day` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '领取后生效-有效天数',
  790. `start_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '有效期开始时间',
  791. `end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '有效期结束时间',
  792. `apply_range` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '适用范围(10全部商品 20指定商品)',
  793. `apply_range_config` text COMMENT '适用范围配置(json格式)',
  794. `is_expire` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否过期(0未过期 1已过期)',
  795. `is_use` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否已使用(0未使用 1已使用)',
  796. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  797. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  798. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  799. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  800. PRIMARY KEY (`user_coupon_id`),
  801. KEY `coupon_id` (`coupon_id`),
  802. KEY `user_id` (`user_id`),
  803. KEY `store_id` (`store_id`)
  804. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户优惠券记录表';
  805. DROP TABLE IF EXISTS `yoshop_user_grade`;
  806. CREATE TABLE `yoshop_user_grade` (
  807. `grade_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '等级ID',
  808. `name` varchar(50) NOT NULL DEFAULT '' COMMENT '等级名称',
  809. `weight` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '等级权重(1-9999)',
  810. `upgrade` text NOT NULL COMMENT '升级条件',
  811. `equity` text NOT NULL COMMENT '等级权益(折扣率0-100)',
  812. `status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1启用 0禁用)',
  813. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  814. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  815. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  816. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  817. PRIMARY KEY (`grade_id`),
  818. KEY `store_id` (`store_id`)
  819. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户会员等级表';
  820. DROP TABLE IF EXISTS `yoshop_user_grade_log`;
  821. CREATE TABLE `yoshop_user_grade_log` (
  822. `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  823. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  824. `old_grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '变更前的等级ID',
  825. `new_grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '变更后的等级ID',
  826. `change_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '变更类型(10后台管理员设置 20自动升级)',
  827. `remark` varchar(500) DEFAULT '' COMMENT '管理员备注',
  828. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  829. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  830. PRIMARY KEY (`log_id`),
  831. KEY `store_id` (`store_id`)
  832. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户会员等级变更记录表';
  833. DROP TABLE IF EXISTS `yoshop_user_oauth`;
  834. CREATE TABLE `yoshop_user_oauth` (
  835. `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  836. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  837. `oauth_type` varchar(255) NOT NULL DEFAULT '' COMMENT '第三方登陆类型(MP-WEIXIN)',
  838. `oauth_id` varchar(100) NOT NULL DEFAULT '' COMMENT '第三方用户唯一标识 (uid openid)',
  839. `unionid` varchar(100) NOT NULL DEFAULT '' COMMENT '微信unionID',
  840. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  841. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  842. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  843. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  844. PRIMARY KEY (`id`),
  845. KEY `user_id` (`user_id`),
  846. KEY `oauth_type` (`oauth_type`),
  847. KEY `store_id` (`store_id`),
  848. KEY `oauth_type_2` (`oauth_type`,`oauth_id`) USING BTREE
  849. ) ENGINE=InnoDB AUTO_INCREMENT=10108 DEFAULT CHARSET=utf8 COMMENT='第三方用户信息表';
  850. DROP TABLE IF EXISTS `yoshop_user_points_log`;
  851. CREATE TABLE `yoshop_user_points_log` (
  852. `log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  853. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  854. `value` int(11) NOT NULL DEFAULT '0' COMMENT '变动数量',
  855. `describe` varchar(500) NOT NULL DEFAULT '' COMMENT '描述/说明',
  856. `remark` varchar(500) NOT NULL DEFAULT '' COMMENT '管理员备注',
  857. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城ID',
  858. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  859. PRIMARY KEY (`log_id`),
  860. KEY `user_id` (`user_id`),
  861. KEY `store_id` (`store_id`)
  862. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户积分变动明细表';
  863. DROP TABLE IF EXISTS `yoshop_wxapp`;
  864. CREATE TABLE `yoshop_wxapp` (
  865. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '微信小程序ID',
  866. `app_id` varchar(50) NOT NULL DEFAULT '' COMMENT '小程序AppID',
  867. `app_secret` varchar(50) NOT NULL DEFAULT '' COMMENT '小程序AppSecret',
  868. `mchid` varchar(50) NOT NULL DEFAULT '' COMMENT '微信商户号ID',
  869. `apikey` varchar(255) NOT NULL DEFAULT '' COMMENT '微信支付密钥',
  870. `cert_pem` longtext COMMENT '证书文件cert',
  871. `key_pem` longtext COMMENT '证书文件key',
  872. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  873. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  874. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  875. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  876. PRIMARY KEY (`id`),
  877. UNIQUE KEY `store_id` (`store_id`) USING BTREE
  878. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='微信小程序记录表(已废弃)';
  879. DROP TABLE IF EXISTS `yoshop_order_export`;
  880. CREATE TABLE `yoshop_order_export` (
  881. `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  882. `start_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单时间(开始)',
  883. `end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '下单时间(结束)',
  884. `file_path` varchar(255) NOT NULL DEFAULT '' COMMENT 'excel文件路径',
  885. `status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '导出状态(10进行中 20已完成 30失败)',
  886. `store_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  887. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  888. PRIMARY KEY (`id`) USING BTREE,
  889. KEY `store_id` (`store_id`)
  890. ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='订单导出Excel记录表';
  891. DROP TABLE IF EXISTS `yoshop_wxapp_setting`;
  892. CREATE TABLE `yoshop_wxapp_setting` (
  893. `key` varchar(30) NOT NULL DEFAULT '' COMMENT '设置项标示',
  894. `describe` varchar(255) NOT NULL DEFAULT '' COMMENT '设置项描述',
  895. `values` mediumtext NOT NULL COMMENT '设置内容(json格式)',
  896. `store_id` int unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  897. `update_time` int unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  898. UNIQUE KEY `unique_key` (`key`,`store_id`)
  899. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信小程序设置表';
  900. DROP TABLE IF EXISTS `yoshop_h5_setting`;
  901. CREATE TABLE `yoshop_h5_setting` (
  902. `key` varchar(30) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '设置项标示',
  903. `describe` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT '' COMMENT '设置项描述',
  904. `values` mediumtext CHARACTER SET utf8 NOT NULL COMMENT '设置内容(json格式)',
  905. `store_id` int unsigned NOT NULL DEFAULT '0' COMMENT '商城ID',
  906. `update_time` int unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  907. UNIQUE KEY `unique_key` (`key`,`store_id`)
  908. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='H5端设置表';
  909. ALTER TABLE `yoshop_goods`
  910. ADD COLUMN `video_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '主图视频ID' AFTER `goods_no`,
  911. ADD COLUMN `video_cover_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '主图视频ID' AFTER `video_id`;
  912. DROP TABLE IF EXISTS `yoshop_share_key`;
  913. CREATE TABLE `yoshop_share_key` (
  914. `key_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
  915. `key_string` varchar(255) NOT NULL DEFAULT '' COMMENT '分享链接key',
  916. `user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户ID',
  917. `is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
  918. `create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  919. `update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  920. PRIMARY KEY (`key_id`)
  921. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='用户分享商品记录key表';