install_struct.sql 61 KB

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