create table if not exists lucky_addon ( id int auto_increment comment '主键' primary key, name varchar(40) default '' not null comment '插件名称或者标识', type varchar(255) default '' not null comment '插件类型', icon varchar(255) default '' not null comment '插件图标', title varchar(20) default '' not null comment '中文名', description text null comment '插件描述', status tinyint default 1 not null comment '状态', author varchar(40) default '' not null comment '作者', version varchar(20) default '' not null comment '版本号', version_no varchar(255) default '' not null comment '版本编号', content text null comment '详情', create_time int default 0 not null comment '安装时间', constraint UK_nc_addons_name unique (name) ) comment '插件表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_addon_quick ( id int auto_increment comment '主键' primary key, name varchar(40) default '' not null comment '插件名称或者标识', package_name varchar(255) default '' not null comment '套餐名称', type varchar(255) default '' not null comment '插件类型', icon varchar(255) default '' not null comment '插件图标', title varchar(20) default '' not null comment '中文名', description text null comment '插件描述', author varchar(40) default '' not null comment '作者', version varchar(20) default '' not null comment '版本号', version_no varchar(255) default '' not null comment '版本编号', content text null comment '详情', create_time int default 0 not null, constraint UK_nc_addons_name unique (name) ) comment '插件表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_adv ( adv_id int auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', ap_id int default 0 not null comment '广告位id', adv_title varchar(255) default '' not null comment '广告内容描述', adv_url text null comment '广告链接', adv_image varchar(255) default '' not null comment '广告内容图片', slide_sort int default 0 not null comment '排序号', price decimal(10, 2) default 0.00 not null comment '广告价格/月', background varchar(255) default '#FFFFFF' not null comment '背景色', state tinyint default 1 not null comment '状态 1:启用 0:关闭' ) comment '广告表' charset = utf8 avg_row_length = 1365 row_format = DYNAMIC; create table if not exists lucky_adv_position ( ap_id mediumint(9) unsigned auto_increment comment '广告位置id' primary key, site_id int default 0 not null comment '站点id', ap_name varchar(100) default '' not null comment '广告位置名', ap_intro varchar(255) default '' not null comment '广告位简介', ap_height int default 0 not null comment '广告位高度', ap_width int default 0 not null comment '广告位宽度', default_content varchar(300) default '' not null, ap_background_color varchar(50) default '#FFFFFF' not null comment '广告位背景色 默认白色', type tinyint default 1 not null comment '广告位所在位置类型 1 pc端 2 手机端', keyword varchar(255) default '' not null comment '关键字', is_system tinyint default 0 not null comment '是否系统', state tinyint default 1 not null comment '状态 1:启用 0:关闭' ) comment '广告位表' charset = utf8 avg_row_length = 2048 row_format = DYNAMIC; create table if not exists lucky_album ( album_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', site_name varchar(255) default '' not null comment '站点名称', album_name varchar(50) default '' not null comment '相册,名称', sort int default 0 not null comment '排序', cover varchar(255) default '' not null comment '背景图', `desc` varchar(255) default '' not null comment '介绍', is_default tinyint default 0 not null comment '是否默认', update_time int default 0 not null comment '更新时间', num int default 0 not null comment '相册图片数', type varchar(50) default 'img' not null comment '类型', pid int default 0 not null comment '上级pid', level int default 0 not null comment '层级', merch_id int default 0 not null comment '商户id' ) comment '相册表' charset = utf8 row_format = DYNAMIC; create index IDX_sys_album_is_default on lucky_album (is_default); create index IDX_sys_album_site_id on lucky_album (site_id); create index IDX_sys_album_sort on lucky_album (sort); create table if not exists lucky_album_pic ( pic_id int(11) unsigned auto_increment comment '主键' primary key, pic_name varchar(255) default '' not null comment '名称', pic_path varchar(255) default '' not null comment '路径', pic_spec varchar(255) default '' not null comment '规格', site_id int default 0 not null comment '站点id', update_time int default 0 not null comment '更新时间', album_id int default 0 not null comment '相册id', is_thumb tinyint default 1 not null comment '是否缩略图 0否 1是', type varchar(50) default '' not null comment '类型', merch_id int default 0 not null comment '商户id' ) comment '相册图片表' charset = utf8 row_format = DYNAMIC; create index IDX_sys_album_pic_site_id on lucky_album_pic (site_id); create table if not exists lucky_area ( id int(11) unsigned auto_increment primary key, pid int default 0 not null comment '父级', name varchar(50) default '' not null comment '名称', shortname varchar(30) default '' not null comment '简称', longitude varchar(30) default '' not null comment '经度', latitude varchar(30) default '' not null comment '纬度', level smallint default 0 not null comment '级别', sort mediumint default 0 not null comment '排序', status tinyint default 1 not null comment '状态1有效' ) comment '地址表' charset = utf8 avg_row_length = 84 row_format = DYNAMIC; create index IDX_nc_area on lucky_area (name, shortname); create index level on lucky_area (level, sort, status); create index longitude on lucky_area (longitude, latitude); create index pid on lucky_area (pid); create table if not exists lucky_article ( article_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '店铺id', site_name varchar(255) default '' not null comment '店铺名称', article_title varchar(255) default '' not null comment '标题', article_abstract varchar(255) default '' not null comment '摘要', category_id int default 0 not null comment '分类id', cover_img varchar(2000) default '' not null comment '封面图片', article_content text null comment '内容', status tinyint default 0 not null comment '状态(0草稿箱 1发布)', is_show_release_time tinyint default 0 not null comment '发布时间是否显示', is_show_read_num tinyint default 0 not null comment '阅读数是否显示', is_show_dianzan_num tinyint default 0 not null comment '点赞数是否显示', read_num int default 0 not null comment '阅读数', dianzan_num int default 0 not null comment '点赞数', create_time int default 0 null, update_time int default 0 not null, initial_read_num int default 0 not null comment '初始阅读数', initial_dianzan_num int default 0 not null comment '初始点赞数', sort int default 0 not null comment '排序' ) comment '文章表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_article_class_id on lucky_article (category_id); create index IDX_ns_article_site_id on lucky_article (site_id); create table if not exists lucky_article_category ( category_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', category_name varchar(255) default '' not null comment '分类名称', sort int default 0 not null comment '排序', article_num int default 0 not null comment '文章数', create_time int default 0 not null, update_time int default 0 not null ) comment '文章分类' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_blindbox ( blindbox_id int(11) unsigned auto_increment primary key, category_id int default 0 not null comment '分类Id', blindbox_name varchar(128) default '' not null comment '盲盒名称', goods_ids varchar(128) default '' not null comment '商品组', blindbox_images varchar(255) default '' not null comment '盲盒封面', blindbox_count int default 0 not null comment '盲盒放置总量', blindbox_inventory int default 0 not null comment '盲盒库存', blindbox_num int default 0 not null comment '已拆数量', price decimal(10, 2) default 0.00 not null comment '拆盒价格', new_price decimal(10, 2) default 0.00 not null comment '新人拆盒价', blindbox_status int default 0 not null comment '状态 0未开始 1 进行中 2已结束 -1已关闭', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', remark varchar(255) default '' not null comment '说明', sort int default 0 not null comment '排序', is_emptybox int default 1 not null comment '空盒是否显示1显示 2不显示', is_balance int default 0 not null comment '是否用余额支付', site_id int default 0 not null comment '站点Id', early_inventory int default 0 not null comment '预警库存', create_time int default 0 not null comment '创建时间' ) comment '盲盒表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_blindbox_category ( category_id int(11) unsigned auto_increment primary key, category_name varchar(64) default '' not null comment '分类名称', sort int default 0 not null comment '排序', status int default 1 not null comment '分类状态 1显示 2隐藏', site_id int default 0 not null comment '站点Id', create_time int default 0 not null comment '创建时间' ) comment '盲盒分类表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_blindbox_goods ( id int(11) unsigned auto_increment primary key, blindbox_id int default 0 not null comment '盲盒Id', sku_id int default 0 not null comment '商品SKUID', site_id int default 0 not null comment '站点Id', status int default 0 not null comment '状态 0 未拆 1已拆', address_id int default 0 not null comment '地址Id', sort int default 0 not null comment '排序', member_id int default 0 not null comment '用户Id', create_time int default 0 not null comment '创建时间' ) comment '盲盒商品表(盒子表)' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_blindbox_member_group ( id int(11) unsigned auto_increment primary key, blindbox_id int default 0 not null comment '盲盒活动Id', blindbox_goods_id int default 0 not null comment '盲盒商品Id', member_id int default 0 not null comment '会员Id', sku_id int default 0 not null comment 'sku_id', site_id int default 0 not null comment '站点Id', order_id int default 0 not null comment '订单Id', create_time int default 0 not null comment '创建时间' ) comment '盲盒参与组' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_blindbox_order ( order_id int(11) unsigned auto_increment primary key, order_number varchar(255) default '' not null comment '订单编号', blindbox_id int default 0 not null comment '盲盒id', blindbox_goods_id int default 0 not null comment '盲盒商品Id', sku_id int default 0 not null comment 'sku_id', price decimal(10, 2) default 0.00 not null comment '单价', num int default 0 not null comment '购买数量', create_time int default 0 not null comment '下单时间', pay_time int default 0 not null comment '支付时间', status int default 0 not null comment '状态0待支付1已完成2已取消', site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '会员id', out_trade_no varchar(255) default '' not null comment '支付流水号', buyer_ip varchar(255) default '' not null comment '购买人ip', order_from varchar(255) default '' not null comment '订单来源', pay_type_name varchar(255) default '' not null comment '支付名', pay_type varchar(255) default '' not null comment '支付方式', is_delete int default 0 not null comment '0未删除1已删除', order_from_name varchar(255) default '' not null comment '订单来源名', is_invoice int default 0 not null comment '是否需要发票 0 无发票 1 有发票', invoice_type int default 1 not null comment '发票类型 1 纸质发票 2 电子发票', invoice_title varchar(255) default '' not null comment '发票抬头', taxpayer_number varchar(255) default '' not null comment '纳税人识别号', invoice_content varchar(255) default '' not null comment '发票内容', invoice_full_address varchar(255) default '' not null comment '发票邮寄地址', is_tax_invoice int default 0 not null comment '是否需要增值税专用发票', invoice_email varchar(255) default '' not null comment '发票发送邮件', invoice_title_type int default 0 not null comment '发票抬头类型 1 个人 2 企业', address_id int default 0 not null comment '地址Id', is_dispatch int default 0 not null comment '待发货 0 是 1已发货' ) comment '盲盒订单表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_business ( id int auto_increment primary key, realname varchar(255) null ) comment '业务员' charset = utf8mb4; create table if not exists lucky_card ( card_id int auto_increment primary key, site_id int default 0 not null comment 'site_id', account varchar(255) null comment '卡号', password varchar(255) null comment '卡密', member_id int default 0 not null comment '领取用户', use_time int default 0 not null comment '领取时间', status int default 0 not null comment '0正常1已使用', createtime int default 0 not null comment '添加时间' ) engine = MyISAM collate = utf8_unicode_ci; create table if not exists lucky_card_import_log ( id int(11) unsigned auto_increment primary key, account varchar(255) default '' not null comment '卡号', password varchar(255) default '' not null comment '卡密', create_time int default 0 not null comment '添加时间', content varchar(255) default '' not null comment '内容', record_id int default 0 not null, site_id int default 0 not null comment 'site_id' ) comment '会员导入记录' charset = utf8; create table if not exists lucky_card_import_record ( id int auto_increment primary key, member_num int default 0 null comment '会员总数', success_num int default 0 null comment '会员导入成功数量', error_num int default 0 null comment '会员导入失败数量', status_name varchar(255) default '' null comment '导入状态', create_time int default 0 null comment '导入时间', site_id int default 0 not null comment 'site_id' ) comment '会员导入记录' charset = utf8; create table if not exists lucky_cases ( id int auto_increment primary key, site_id int default 0 null, realname varchar(50) default '' null, displayorder int default 0 null, mobile varchar(255) null, address varchar(255) null, landline varchar(255) null comment '座机', position varchar(255) null comment '职位', title_text varchar(255) null, position_text varchar(255) null, mobile_text varchar(255) null, address_text varchar(255) null, email varchar(255) null comment '电子邮箱' ) engine = MyISAM charset = utf8; create index idx_displayorder on lucky_cases (displayorder); create index idx_uniacid on lucky_cases (site_id); create table if not exists lucky_cases_files ( files_id int auto_increment primary key, site_id int null, files_title varchar(255) null, files_url varchar(255) null, createtime int null, imgs longtext null, size decimal(10, 2) default 0.00 null comment '大小' ) engine = MyISAM collate = utf8_unicode_ci; create table if not exists lucky_cases_video ( video_id int auto_increment primary key, site_id int null, video_title varchar(255) null, video_url varchar(255) null, images longtext null, createtime int null ) engine = MyISAM collate = utf8_unicode_ci; create table if not exists lucky_cashier_auth ( id int auto_increment primary key, name varchar(200) default '' not null comment '权限关键字', title varchar(255) default '' not null comment '权限标题', type varchar(255) default '' not null comment '类型 page 页面 api 操作', parent varchar(255) default '' not null, url varchar(2500) default '' not null comment '权限内容', addon varchar(255) default '' not null comment '所属插件', constraint UK_ns_cashier_auth_name unique (name) ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_cashier_auth_group ( group_id int auto_increment primary key, group_name varchar(255) default '' not null comment '权限组名称', menu_array text null comment '权限集', keyword varchar(255) default '' not null comment '关键字 自定义权限组为空', site_id int default 0 not null comment '站点id', `desc` varchar(2000) default '' not null ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_cashier_pendorder ( order_id int auto_increment primary key, site_id int default 0 not null comment '站点id', store_id int default 0 not null comment '门店id', member_id int default 0 not null comment '会员id 0为散客', create_time int default 0 not null comment '创建时间', remark varchar(2500) default '' not null comment '备注', order_money decimal(10, 2) default 0.00 not null comment '订单金额', discount_money decimal(10, 2) default 0.00 not null, discount_data text not null ) comment '本地服务挂单表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_cashier_pendorder_goods ( order_goods_id int auto_increment primary key, order_id int default 0 not null, sku_id int default 0 not null, num decimal(12, 3) default 0.000 not null, goods_id int default 0 not null, price decimal(10, 2) default 0.00 not null, site_id int default 0 not null, store_id int default 0 not null, goods_class varchar(255) default '' not null ) comment '本地服务挂单订单项表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_change_shifts_record ( id int auto_increment primary key, site_id int default 0 not null comment '所属站点', store_id int default 0 not null comment '所属门店', uid int default 0 not null comment '交班员工', start_time int default 0 not null comment '交班 班次开始时间', end_time int default 0 not null comment '交班 班次结束时间', billing_count int default 0 not null comment '开单数量', billing_money decimal(10, 2) default 0.00 not null comment '开单金额', buycard_count int default 0 not null comment '办卡数量', buycard_money decimal(10, 2) default 0.00 not null comment '办卡金额', recharge_count int default 0 not null comment '充值数量', recharge_money decimal(10, 2) default 0.00 not null comment '充值金额', refund_count int default 0 not null comment '退款数量', refund_money decimal(10, 2) default 0.00 not null comment '退款金额', cash decimal(10, 2) default 0.00 not null comment '现金收款金额', alipay decimal(10, 2) default 0.00 not null comment '支付宝线上收款金额', wechatpay decimal(10, 2) default 0.00 not null comment '微信线上收款金额', own_wechatpay decimal(10, 2) default 0.00 not null comment '个人微信收款金额', own_alipay decimal(10, 2) default 0.00 not null comment '个人支付宝收款金额', own_pos decimal(10, 2) default 0.00 not null comment '个人pos刷卡收款金额', cash_count int default 0 not null comment '现金收款数量', alipay_count int default 0 not null comment '支付宝收款数量', wechatpay_count int default 0 not null comment '微信收款数量', own_wechatpay_count int default 0 not null comment '个人微信收款数量', own_alipay_count int default 0 not null comment '各人支付宝收款数量', own_pos_count int default 0 not null comment '个人pos收款数量' ) comment '收银台交接班记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_config ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id(店铺,分站),总平台端为0', app_module varchar(255) default '' not null comment '应用端口关键字', config_key varchar(255) default '' not null comment '配置项关键字', value text null comment '配置值json', config_desc varchar(1000) default '' not null comment '描述', is_use tinyint default 1 not null comment '是否启用 1启用 0不启用', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', constraint IDX_sys_config_site_id unique (site_id, app_module, config_key) ) comment '系统配置表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_cron ( id int(11) unsigned auto_increment comment '主键' primary key, type int default 1 not null comment '1.固定任务 2.循环任务', period int default 0 not null comment '循环周期(分钟)', period_type int default 0 not null comment '循环周期类型 0默认分钟 1.月 2.周 3. 日', name varchar(50) default '' not null comment '任务名称', event varchar(255) default '' not null comment '执行事件', execute_time int default 0 not null comment '待执行时间', relate_id int default 0 not null comment '关联关键字id', create_time int default 0 not null comment '创建时间' ) comment '计划任务表' charset = utf8 row_format = DYNAMIC; create index IDX_sys_cron_execute_time on lucky_cron (execute_time); create table if not exists lucky_cron_log ( id int(11) unsigned auto_increment primary key, name varchar(255) default '' not null comment '任务名称', event varchar(255) default '' not null comment '任务事件', execute_time varchar(255) default '' not null comment '执行时间', relate_id int default 0 not null comment '关联id', is_success int default 1 not null comment '是否成功', message text null comment '返回结果' ) comment '事件执行记录' charset = utf8 row_format = DYNAMIC; create index IDX_nc_cron_execute_list_execute_time on lucky_cron_log (execute_time); create table if not exists lucky_diy_template ( id int auto_increment primary key, title varchar(50) default '' not null comment '模板名称', name varchar(255) default '' not null comment '模板标识', page varchar(255) default '' not null comment '页面路径', addon_name varchar(255) default '' not null comment '插件标识', value longtext null comment '默认值', rule varchar(255) default '' not null comment '规则', sort int default 0 not null comment '排序', `show` int default 0 null comment '是否显示' ) comment '自定义模板页面类型表' charset = utf8 row_format = DYNAMIC; create index addon_name on lucky_diy_template (addon_name); create table if not exists lucky_diy_template_category ( category_id int(11) unsigned auto_increment comment '主键' primary key, name varchar(255) default '' not null comment '名称', pid int default 0 not null comment '上级分类id', level int default 0 not null comment '层级', state int default 1 not null comment '状态(是否展示)', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', sort int default 0 not null comment '排序' ) comment '自定义模板分类表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_diy_template_goods ( goods_id int(11) unsigned auto_increment comment '主键' primary key, goods_item_id int default 0 not null comment '装修的页面项id,默认取第一个页面', title varchar(255) default '' not null comment '模板名称', name varchar(255) default '' not null comment '模板标识', addon_name varchar(255) default '' not null comment '插件标识', cover varchar(255) default '' not null comment '封面图', preview varchar(255) default '' not null comment '预览图', `desc` varchar(255) default '' not null comment '模版描述', category_id int default 0 not null comment '模板分类id', category_name varchar(255) default '' not null comment '模板分类名称', use_num int default 0 not null comment '使用次数', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', constraint name unique (name) ) comment '自定义模板组表' charset = utf8 row_format = DYNAMIC; create index addon_name on lucky_diy_template_goods (addon_name); create table if not exists lucky_diy_template_goods_item ( goods_item_id int(11) unsigned auto_increment comment '主键' primary key, goods_id int default 0 not null comment '模板组id', title varchar(255) default '' not null comment '名称', name varchar(255) default '' not null comment '所属页面(首页、分类,空为微页面)', addon_name varchar(255) default '' not null comment '插件标识', value longtext null comment '模板数据', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '模板组页面' charset = utf8 row_format = DYNAMIC; create index addon_name on lucky_diy_template_goods_item (addon_name); create table if not exists lucky_diy_theme ( id int auto_increment primary key, title varchar(255) default '' not null comment '名称', name varchar(255) default '' not null comment '标识', addon_name varchar(255) default '' not null comment '插件标识', main_color varchar(50) default '' not null comment '主色调', aux_color varchar(50) default '' not null comment '辅色调', preview varchar(550) default '' not null comment '预览图,多个逗号隔开', color_img varchar(255) default '' not null comment '配色图片', value text null comment '其他配色' ) comment '自定义模板主题风格配色表' charset = utf8 row_format = DYNAMIC; create index addon_name on lucky_diy_theme (addon_name); create table if not exists lucky_diy_view_util ( id int auto_increment primary key, name varchar(50) default '' not null comment '标识', title varchar(50) default '' not null comment '组件名称', type varchar(50) default 'SYSTEM' not null comment '组件类型', value text null comment '配置:json格式', addon_name varchar(50) default '' not null comment '插件标识', sort int default 0 not null comment '排序号', support_diy_view varchar(500) default '' not null comment '支持的自定义页面(为空表示公共组件都支持)', max_count int default 0 not null comment '限制添加次数', is_delete int default 0 not null comment '是否可以删除,0 允许,1 禁用', icon varchar(255) default '' not null comment '组件图标', icon_type int default 0 not null comment '0图片1图标', constraint name unique (name) ) comment '自定义模板组件' charset = utf8 row_format = DYNAMIC; create index IDX_nc_diy_view_util_sort on lucky_diy_view_util (sort); create index IDX_nc_diy_view_util_type on lucky_diy_view_util (type); create table if not exists lucky_document ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id(店铺,分站),总平台端为0', app_module varchar(255) default '' not null comment '应用模块', document_key varchar(255) default '' not null comment '关键字', title varchar(255) default '' not null comment '文本关键字', content text null comment '文本内容', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '系统配置性相关文件' charset = utf8 row_format = DYNAMIC; create index IDX_ns_document_app_module on lucky_document (app_module); create index IDX_ns_document_document_key on lucky_document (document_key); create index IDX_ns_document_site_id on lucky_document (site_id); create table if not exists lucky_express_company ( id int auto_increment primary key, site_id int default 0 not null comment '店铺id', company_id int default 0 not null comment '物流公司id', company_name varchar(50) default '' not null comment '物流公司名称', logo varchar(255) default '' not null comment 'logo', express_no varchar(20) default '' not null comment '编码', content_json text null comment '打印内容', background_image varchar(255) default '' not null comment '背景图', font_size varchar(10) default '' not null comment '打印字体', width varchar(10) default '' not null comment '宽度', height varchar(10) default '' not null comment '高度', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', scale decimal(10, 2) default 1.00 not null comment '真实尺寸(mm)与显示尺寸(px)的比例' ) comment '店铺物流公司' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_express_company_template ( company_id int auto_increment primary key, site_id int default 0 not null comment '站点id', company_name varchar(50) default '' not null comment '物流公司名称', logo varchar(255) default '' not null comment '物流公司logo', url varchar(255) default '' not null comment '物流公司网址', sort int default 0 not null comment '排序', express_no varchar(20) default '' not null comment '编码', express_no_kd100 varchar(20) default '' not null comment '编码(快递100)', express_no_cainiao varchar(20) default '' not null comment '编码(菜鸟)', content_json text null comment '打印内容', background_image varchar(255) default '' not null comment '背景图', font_size int default 14 not null comment '打印字体', width int default 0 not null comment '宽度', height int default 0 not null comment '高度', scale decimal(10, 2) default 1.00 not null comment '真实尺寸(mm)与显示尺寸(px)的比例', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', is_electronicsheet tinyint default 0 not null comment '是否支持电子面单(0不支持 1支持)', print_style varchar(2000) default '' not null comment '电子面单打印风格' ) comment '系统物流公司表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_express_deliver ( deliver_id int auto_increment comment '配送员id' primary key, deliver_name varchar(255) default '' not null comment '配送员名称', deliver_mobile varchar(20) default '' not null comment '配送员手机号', site_id int default 0 not null, create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', store_id int default 0 not null comment '门店id' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_express_delivery_package ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', order_id int default 0 not null comment '订单id', order_goods_id_array varchar(1000) default '' not null comment '订单项商品组合列表', goods_id_array text null comment '商品组合列表', package_name varchar(50) default '' not null comment '包裹名称(包裹- 1 包裹 - 2)', delivery_type tinyint default 0 not null comment '发货方式1 需要物流 0无需物流', express_company_id int default 0 not null comment '快递公司id', express_company_name varchar(255) default '' not null comment '物流公司名称', delivery_no varchar(50) default '' not null comment '运单编号', delivery_time int default 0 not null comment '发货时间', member_id int default 0 not null comment '会员id', member_name varchar(50) default '' not null comment '会员名称', express_company_image varchar(255) default '' not null comment '发货公司图片', type varchar(20) default '' not null comment '发货方式(manual 手动发货 electronicsheet 电子面单发货)', template_id int default 0 not null comment '电子面单模板id', template_name varchar(255) default '' not null comment '电子面单模板名称' ) comment '商品订单物流信息表(多次发货)' charset = utf8 row_format = DYNAMIC; create index IDX_ns_express_delivery_package_order_id on lucky_express_delivery_package (order_id); create index IDX_ns_express_delivery_package_site_id on lucky_express_delivery_package (site_id); create table if not exists lucky_express_electronicsheet ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', template_name varchar(255) default '' not null comment '模板名称', company_id int default 0 not null comment '物流公司id', company_name varchar(255) default '' not null comment '物流公司名称', express_no varchar(255) default '' not null comment '编码', customer_name varchar(255) default '' not null comment 'CustomerName', customer_pwd varchar(255) default '' not null comment 'CustomerPwd', send_site varchar(255) default '' not null comment 'SendSite', send_staff varchar(255) default '' not null comment 'SendStaff', month_code varchar(255) default '' not null comment 'MonthCode', postage_payment_method tinyint default 0 not null comment '邮费支付方式(1现付 2到付 3月结)', is_notice tinyint default 0 not null comment '快递员上门揽件(0否 1是)', status tinyint default 0 not null comment '状态(0正常 -1不使用)', is_default tinyint default 0 not null comment '是否默认(0否 1是)', create_time int default 0 not null, update_time int default 0 not null, print_style int default 0 not null comment '模板风格' ) comment '电子面单' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_express_template ( template_id int auto_increment primary key, site_id int default 0 not null comment '商家店铺id', template_name varchar(50) default '' not null comment '模板名称', fee_type int default 0 not null comment '运费计算方式1.重量2体积3按件', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', is_default int default 0 not null comment '是否默认', surplus_area_ids mediumtext null comment '剩余地址id', appoint_free_shipping int default 0 not null comment '是否指定免邮', shipping_surplus_area_ids mediumtext null comment '包邮地区剩余地址id' ) comment '运费模板' charset = utf8 row_format = DYNAMIC; create index IDX_ns_express_template_is_default on lucky_express_template (is_default); create index IDX_ns_express_template_site_id on lucky_express_template (site_id); create table if not exists lucky_express_template_free_shipping ( item_id int auto_increment primary key, template_id int default 0 not null comment '模板id', area_ids mediumtext null comment '地址id序列', area_names mediumtext null comment '地址名称序列', snum int default 0 not null comment '件数', sprice decimal(10, 2) default 0.00 not null comment '价格' ) comment '运费模板免邮地区' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_express_template_item ( item_id int auto_increment primary key, template_id int default 0 not null comment '模板id', area_ids mediumtext null comment '地址id序列', area_names mediumtext null comment '地址名称序列', snum int default 0 not null comment '起步计算标准', sprice decimal(10, 2) default 0.00 not null comment '起步计算价格', xnum int default 0 not null comment '续步计算标准', xprice decimal(10, 2) default 0.00 not null comment '续步计算价格', fee_type int default 1 not null comment '运费计算方式' ) comment '运费模板细节' charset = utf8 row_format = DYNAMIC; create index IDX_ns_express_template_item_fee_type on lucky_express_template_item (fee_type); create index IDX_ns_express_template_item_template_id on lucky_express_template_item (template_id); create table if not exists lucky_fenxiao ( fenxiao_id int auto_increment primary key, site_id int default 0 null comment '站点id', fenxiao_no varchar(255) default '' not null comment '分销商编号', fenxiao_name varchar(255) default '' not null comment '分销店铺名', mobile varchar(255) default '' not null comment '联系电话', member_id int default 0 not null comment '会员ID', level_id int default 0 not null comment '分销商等级id', level_name varchar(255) default '' not null comment '等级名称', parent int default 0 not null comment '上级ID', grand_parent int default 0 not null comment '上上级id', account decimal(10, 2) default 0.00 not null comment '当前佣金', account_withdraw decimal(10, 2) default 0.00 not null comment '已提现佣金', account_withdraw_apply decimal(10, 2) default 0.00 not null comment '提现中佣金', status tinyint default 1 not null comment '状态(1已审核 2拒绝 -1已冻结)', create_time int default 0 not null comment '创建时间', audit_time int default 0 not null comment '成为经分销商时间', lock_time int default 0 not null comment '冻结时间', one_fenxiao_order_num int default 0 not null comment '一级分销订单总数', one_fenxiao_total_order decimal(10, 2) default 0.00 not null comment '一级分销订单总额', one_fenxiao_order_money decimal(10, 2) default 0.00 not null comment '一级分销订单佣金总额', one_child_num int default 0 not null comment '一级下线人数', one_child_fenxiao_num int default 0 not null comment '一级下线分销商', two_child_fenxiao_num int default 0 not null comment '二级下线分销商', total_commission decimal(10, 2) default 0.00 not null comment '累计佣金', is_delete tinyint default 0 not null comment '是否删除 0未删除 1已删除' ) comment '分销商表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_fenxiao_audit_time on lucky_fenxiao (audit_time); create index IDX_ns_fenxiao_create_time on lucky_fenxiao (create_time); create index IDX_ns_fenxiao_grand_parent on lucky_fenxiao (grand_parent); create index IDX_ns_fenxiao_level_id on lucky_fenxiao (level_id); create index IDX_ns_fenxiao_member_id on lucky_fenxiao (member_id); create index IDX_ns_fenxiao_parent on lucky_fenxiao (parent); create index IDX_ns_fenxiao_site_id on lucky_fenxiao (site_id); create index IDX_ns_fenxiao_status on lucky_fenxiao (status); create table if not exists lucky_fenxiao_account ( id int(11) unsigned auto_increment primary key, account_no varchar(255) default '' not null comment '账单编号', fenxiao_id int default 0 not null comment '分销商ID', fenxiao_name varchar(255) default '' not null comment '分销商名称', money decimal(10, 2) default 0.00 not null comment '费用', type varchar(50) default '1' not null comment '类型(withdraw提现 order订单结算)', type_name varchar(255) default '' not null comment '类型名称', relate_id int default 0 not null comment '关联id', create_time int default 0 not null comment '时间' ) comment '分销商流水表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_fenxiao_apply ( apply_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', fenxiao_name varchar(255) default '' not null comment '分销商店铺名', parent int default 0 not null comment '上级分销商ID', member_id int default 0 not null comment '会员ID', mobile varchar(255) default '' not null comment '联系电话', nickname varchar(50) default '' not null comment '用户昵称', headimg varchar(255) default '' not null comment '用户头像', level_id int default 0 not null comment '申请等级', level_name varchar(50) default '' not null comment '等级名称', order_complete_money decimal(10, 2) default 0.00 not null comment '订单完成-消费金额', order_complete_num int default 0 not null comment '订单完成-消费次数', reg_time int default 0 not null comment '注册时间', create_time int default 0 not null comment '申请时间', update_time int default 0 not null, status tinyint default 1 not null comment '申请状态(1申请中 2通过 -1拒绝)' ) comment '分销商申请表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_fenxiao_goods ( fenxiao_goods_id int(11) unsigned auto_increment primary key, goods_id int default 0 not null comment '商品ID', one_rate decimal(10, 2) default 0.00 not null comment '一级佣金', two_rate decimal(10, 2) default 0.00 not null comment '二级佣金', three_rate decimal(10, 2) default 0.00 not null comment '三级佣金', state tinyint default 0 not null comment '是否参与' ) comment '分销商品表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_fenxiao_goods_collect ( collect_id int(11) unsigned auto_increment comment '主键' primary key, member_id int default 0 not null comment '会员id', fenxiao_id int default 0 not null comment '分销商id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment 'skuid', create_time int default 0 not null comment '收藏时间', site_id int default 0 not null comment '站点id' ) comment '分销商关注商品表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_fenxiao_goods_collect_member_id on lucky_fenxiao_goods_collect (member_id); create index IDX_ns_fenxiao_goods_collect_sku_id on lucky_fenxiao_goods_collect (sku_id); create table if not exists lucky_fenxiao_goods_sku ( goods_sku_id int(11) unsigned auto_increment primary key, goods_id int default 0 not null comment '商品ID', sku_id int default 0 not null comment '商品skuID', level_id int default 0 not null comment '分销等级ID', one_rate decimal(10, 2) default 0.00 not null comment '一级佣金比例', one_money decimal(10, 2) default 0.00 not null comment '一级佣金金额', two_rate decimal(10, 2) default 0.00 not null comment '二级佣金比例', two_money decimal(10, 2) default 0.00 not null comment '二级佣金金额', three_rate decimal(10, 2) default 0.00 not null comment '三级佣金比例', three_money decimal(10, 2) default 0.00 not null comment '三级佣金金额' ) comment '分销商品sku表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_fenxiao_level ( level_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', level_num int default 0 not null comment '等级权重', level_name varchar(30) default '' not null comment '等级名称', one_rate decimal(10, 2) default 0.00 not null comment '一级佣金比例', two_rate decimal(10, 2) default 0.00 not null comment '二级佣金比例', three_rate decimal(10, 2) default 0.00 not null comment '三级佣金比例', upgrade_type tinyint default 0 not null comment '升级方式(0满足任意条件 1满足全部条件)', fenxiao_order_num int default 0 not null comment '订单总数', fenxiao_order_meney decimal(10, 2) default 0.00 not null comment '订单总金额', one_fenxiao_order_num int default 0 not null comment '一级分销订单总数', one_fenxiao_total_order decimal(10, 2) default 0.00 not null comment '一级分销订单总额', one_fenxiao_order_money decimal(10, 2) default 0.00 not null comment '一级分销订单佣金总额', order_num int default 0 not null comment '自购订单总数', order_money decimal(10, 2) default 0.00 not null comment '自购订单总额', child_num int default 0 not null comment '下线人数', child_fenxiao_num int default 0 not null comment '下线分销商人数', one_child_num int default 0 not null comment '一级下线人数', one_child_fenxiao_num int default 0 not null comment '一级下线分销商', status tinyint default 0 not null comment '状态(0关闭 1启用)', create_time int default 0 not null, update_time int default 0 not null, is_default int default 0 not null comment '是否是默认等级' ) comment '分销等级配置表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_fenxiao_order ( fenxiao_order_id int(11) unsigned auto_increment primary key, order_id int default 0 not null comment '订单ID', order_no varchar(255) default '' not null comment '订单编号', order_goods_id int default 0 not null comment '订单项ID', site_id int default 0 not null comment '站点ID', site_name varchar(255) default '' not null comment '站点名称', goods_id int default 0 not null comment '商品ID', sku_id int default 0 not null comment '商品skuid', sku_name varchar(255) default '' not null comment '商品sku名称', sku_image varchar(255) default '' not null comment '商品图片', price decimal(10, 2) default 0.00 not null comment '商品卖价', num int default 0 not null comment '商品数量', real_goods_money decimal(10, 2) default 0.00 not null comment '商品总价', member_id int default 0 not null comment '购买人ID', member_name varchar(255) default '' not null comment '购买人名称', member_mobile varchar(255) default '' not null comment '购买人电话', full_address varchar(255) default '' not null comment '购买人详细地址', commission decimal(10, 2) default 0.00 not null comment '总佣金', commission_rate decimal(10, 2) default 0.00 not null comment '分销总比率', one_fenxiao_id int default 0 not null comment '一级分销商ID', one_rate decimal(10, 2) default 0.00 not null comment '一级分销比例', one_commission decimal(10, 2) default 0.00 not null comment '一级分销佣金', one_fenxiao_name varchar(255) default '' not null comment '一级分销商名', two_fenxiao_id int default 0 not null comment '二级分销商ID', two_rate decimal(10, 2) default 0.00 not null comment '二级分销比例', two_commission decimal(10, 2) default 0.00 not null comment '二级分销佣金', two_fenxiao_name varchar(255) default '' not null comment '二级分销商名', three_fenxiao_id int default 0 not null comment '三级分销商ID', three_rate decimal(10, 2) default 0.00 not null comment '三级分销比例', three_commission decimal(10, 2) default 0.00 not null comment '三级分销佣金', three_fenxiao_name varchar(255) default '' not null comment '三级分销商名', is_settlement tinyint default 0 not null comment '是否结算', is_refund tinyint default 0 not null comment '是否退款', create_time int default 0 not null comment '创建时间' ) comment '分销配置表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_fenxiao_withdraw ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', withdraw_no varchar(255) default '' not null comment '提现流水号', member_id int default 0 not null comment '会员id', fenxiao_id int default 0 not null comment '分销商id', fenxiao_name varchar(255) default '' not null comment '分销商名称', withdraw_type varchar(32) default '' not null comment '提现类型(weixin-微信 alipay-支付宝 balance-余额 bank银行卡)', bank_name varchar(50) default '' not null comment '提现银行名称', account_number varchar(50) default '' not null comment '提现银行账号', realname varchar(10) default '' not null comment '提现账户姓名', mobile varchar(255) default '' not null comment '手机', money decimal(10, 2) default 0.00 not null comment '提现金额', withdraw_rate decimal(10, 2) default 0.00 not null comment '提现手续费率', withdraw_rate_money decimal(10, 2) default 0.00 not null comment '提现手续费金额', real_money decimal(10, 2) default 0.00 not null comment '实际到账金额', status smallint default 1 not null comment '当前状态 1待审核 2已审核 -1 已拒绝', remark varchar(255) default '' not null comment '备注', create_time int default 0 not null comment '申请日期', payment_time int default 0 not null comment '到账日期', modify_time int default 0 not null comment '修改日期', transfer_type varchar(30) default '1' not null comment '转账方式', transfer_name varchar(50) default '' not null comment '转账银行名称', transfer_remark varchar(255) default '' not null comment '转账备注', transfer_no varchar(255) default '' not null comment '转账流水号', transfer_account_no varchar(255) default '' not null comment '转账银行账号', document varchar(1000) default '' not null comment '转账单据', audit_time int default 0 not null comment '审核时间', refuse_reason varchar(255) default '' not null comment '拒绝理由', applet_type int default 0 not null ) comment '会员余额提现记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_files ( files_id int auto_increment primary key, site_id int null, files_title varchar(255) null, files_url varchar(255) null, createtime int null, imgs longtext null, size decimal(10, 2) default 0.00 null comment '大小', category_name varchar(255) null, category_id int default 0 not null ) engine = MyISAM collate = utf8_unicode_ci row_format = DYNAMIC; create table if not exists lucky_files_category ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', category_name varchar(50) default '' not null comment '分类名称', `desc` varchar(255) default '' not null comment '描述', create_time int default 0 not null, update_time int default 0 not null, sort int default 0 not null ) comment '商户分类' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_form ( id int auto_increment primary key, form_name varchar(255) default '' not null comment '表单名称', form_type varchar(50) default '' not null comment '表单类型:order 统一下单 goods 商品表单', is_use tinyint default 0 not null comment '是否启用0禁用1启用', site_id int default 0 not null comment '关联id', json_data text not null comment 'json', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_form_data ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', form_id int default 0 not null comment '表单id', member_id int default 0 not null comment '所属会员id', relation_id int default 0 not null comment '表单关联id', create_time int default 0 not null comment '创建时间', form_data text null comment '表单数据', scene varchar(255) default '' not null comment '场景 order订单' ) comment '系统表单数据' charset = utf8 row_format = DYNAMIC; create index UK_ns_form_data on lucky_form_data (relation_id, scene); create table if not exists lucky_giftcard ( giftcard_id int auto_increment primary key, site_id int default 0 not null comment '站点id', category_id int default 0 not null comment '卡分类id', card_cover varchar(2000) default '' not null comment '礼品卡封面', media_ids varchar(255) default '' not null comment '素材id', card_name varchar(255) default '' not null comment '礼品卡名称', cdk_length int default 0 not null comment '卡密位数', cdk_type varchar(25) default '' not null comment '卡密类型 number 数字 letter 英文字母', card_prefix varchar(25) default '' not null comment '卡号前缀', card_suffix varchar(255) default '' not null comment '卡号后缀', card_right_type varchar(50) default '' not null comment '卡权益类型balance储值 goods商品', card_right_goods_type varchar(50) default '' not null comment '卡权益商品类型all总体数量item按照商品数量', card_right_goods_count int default 0 not null comment '针对总体数量设置总数量', card_price decimal(10, 2) default 0.00 not null comment '礼品卡价格', balance decimal(10, 2) default 0.00 not null comment '储值余额', sort int default 0 not null comment '排序', validity_type varchar(50) default '' not null comment '有效期类型 forever:永久有效 day:购买后x天有效 date:指定过期日期', validity_time int default 0 not null comment '有效时间', validity_day int(11) unsigned default 0 not null comment '有效天数', is_delete int default 0 not null comment '0未删除1已删除', is_allow_transfer int default 0 not null comment '是否允许转赠', status int default 1 not null comment '0:已结束,1:进行中', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '修改时间', `desc` text null comment '活动详情', card_num int default 0 not null comment '制卡数量', card_type varchar(255) default '' not null comment '卡类型', sale_num int default 0 not null comment '卡销量(获取数量)', use_count int default 0 not null comment '使用量', invalid_count int default 0 not null comment '作废数量', activate_count int default 0 not null comment '激活数量', card_count int default 0 not null comment '制卡总数', del_count int default 0 not null comment '删除卡总数', instruction text null comment '说明' ) comment '礼品卡' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_card ( card_id int auto_increment primary key, site_id int default 0 not null comment '站点id', card_no varchar(255) default '' not null comment '卡编号', card_cdk varchar(255) default '' not null comment '卡密(实体卡有效)', giftcard_id int default 0 not null comment '活动id', member_id int default 0 not null comment '领取用户id', status varchar(50) default '' not null comment '0未激活1待使用2已使用-1已过期-2已作废', source varchar(50) default '' not null comment '来源 order 购买电子卡 gift别人赠送', card_right_type varchar(50) default '' not null comment '礼品卡权益类型balance储值goods商品', card_right_goods_type varchar(255) default '' not null comment '卡权益商品类型all总体数量item按照商品数量', card_right_goods_count int default 0 not null comment '针对总体数量设置总数量', use_count int default 0 not null comment '已使用次数', balance decimal(10, 2) default 0.00 not null comment '储值金额', create_time int default 0 not null comment '生成时间', activate_time int default 0 not null comment '激活时间', use_time int default 0 not null comment '使用时间', order_id int default 0 not null comment '订单id', valid_time int default 0 not null comment '有效期', is_allow_transfer int default 0 not null comment '是否允许转赠', init_member_id int default 0 not null comment '初始所属会员', card_name varchar(255) default '' not null comment '礼品卡名称', card_cover varchar(500) default '' not null, card_import_id int default 0 not null, card_type varchar(255) default '' not null comment '卡类型', invalid_time int default 0 not null comment '失效时间' ) comment '礼品卡获取记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_card_blessing ( blessing_id int auto_increment primary key, site_id int default 0 not null comment '站点id', card_id int default 0 not null comment '站点id', member_id int default 0 not null comment '用户id', member_card_id int default 0 not null comment '用户卡id', status int default 0 not null comment '0 正常1 已作废', to_member_id int default 0 not null, create_time int default 0 not null comment '创建时间', to_time int default 0 not null comment '领取时间', blessing text null comment '祝福语', no varchar(255) default '' not null comment '匹配key值(建议六十二进制)' ) comment '礼品卡祝福语' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_card_goods ( id int auto_increment primary key, card_id int default 0 not null comment '卡id', site_id int default 0 not null comment '站点id', giftcard_id int default 0 not null comment '关联id', card_right_type varchar(50) default '' not null comment '礼品卡权益类型1储值2商品', balance decimal(10, 2) default 0.00 not null comment '储值金额', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment '商品skuid', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(255) default '' not null comment '商品图片', goods_name varchar(400) default '' not null comment '商品名称', sku_no varchar(255) default '' not null comment '商品编码', price decimal(10, 2) default 0.00 not null comment '商品卖价', total_num int default 0 not null comment '总数量', use_num int default 0 not null comment '已提货数量', order_id int default 0 not null comment '订单id', order_goods_id int default 0 not null comment '订单项id', total_balance decimal(10, 2) default 0.00 not null ) comment '礼品卡获取记录商品项' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_card_import ( import_id int auto_increment comment ' ' primary key, site_id int default 0 not null comment '站点id', giftcard_id int default 0 not null, total_count int default 0 not null comment '总数量', imported_count int default 0 not null comment '已经导入的数量', success_count int default 0 not null comment '成功数量', fail_count int default 0 not null comment '失败数量', import_time int default 0 not null comment '导入时间', type varchar(255) default '' not null comment '导入方式', cdk_length int default 0 not null, card_prefix varchar(255) default '' not null, card_suffix varchar(255) default '' not null, cdk_type varchar(255) default '' not null, file_name varchar(255) default '' not null, create_time int default 0 not null, card_cdk varchar(255) default '' not null, error varchar(255) default '' not null comment '错误', name varchar(255) default '' not null comment '导入批次名称', use_count int default 0 not null comment '使用量', invalid_count int default 0 not null comment '作废数量', activate_count int default 0 not null comment '激活数量', del_count int default 0 not null comment '删卡数量', status int default 1 not null comment '状态 1 正常 2作废', card_type varchar(255) default '' not null comment '卡类型' ) comment '礼品卡导入记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_card_log ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', card_id int default 0 not null comment '卡id', giftcard_id int default 0 not null comment '活动id', member_id int default 0 not null comment '领取用户id', status varchar(50) default '' not null comment '0未激活1待使用2已使用-1已过期-2已作废', create_time int default 0 not null comment '时间', operator_type varchar(255) default '' not null comment '操作人类型 system 系统 shop 站点管理员 member 会员', operator int default 0 not null comment '操作人id', operator_name varchar(255) default '' not null comment '操作人名称', type varchar(255) default '' not null comment '操作类型', type_id int default 0 not null comment '操作主键id', remark varchar(2000) default '' not null comment '描述', extend text null comment '扩展字段' ) comment '礼品卡操作日志记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_card_use_records ( records_id int auto_increment primary key, card_id int default 0 not null comment '卡id', site_id int default 0 not null comment '站点id', giftcard_id int default 0 not null comment '礼品卡活动id', card_right_type varchar(50) default '' not null comment '礼品卡权益类型1储值2商品', use_time int default 0 not null comment '使用时间', member_id int default 0 not null, member_card_id int default 0 not null, order_id int default 0 not null ) comment '礼品卡使用记录卡项' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_card_use_records_goods ( records_goods_id int auto_increment primary key, records_id int default 0 not null comment '使用记录id', site_id int default 0 not null comment '站点id', card_goods_id int default 0 not null comment '关联礼品卡项id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment '商品skuid', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(255) default '' not null comment '商品图片', goods_name varchar(400) default '' not null comment '商品名称', sku_no varchar(255) default '' not null comment '商品编码', use_num int default 0 not null comment '使用数量', balance decimal(10, 2) default 0.00 not null comment '储值余额', member_id int default 0 not null, order_goods_id int default 0 not null, order_id int default 0 not null ) comment '礼品卡使用记录商品项' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_category ( category_id int auto_increment primary key, category_name varchar(255) default '' not null comment '分组名称', font_color varchar(255) default '' not null comment '字体颜色', sort int default 0 not null comment '排序', site_id int default 0 not null comment '站点id', create_time int default 0 not null, update_time int default 0 not null ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_goods ( id int auto_increment primary key, giftcard_id int default 0 not null comment '关联id', goods_id int default 0 not null comment '关联商品id', sku_id int default 0 not null comment '关联商品sku_id', goods_num int default 0 not null comment '关联商品数量(实体卡商品数量)', goods_price decimal(10, 2) default 0.00 not null comment '关联商品价格', site_id int default 0 not null ) comment '礼品卡关联商品' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_media ( media_id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', media_type varchar(50) default 'img' not null comment '类型 img 图片', is_system tinyint default 0 not null comment '是否是系统素材', media_name varchar(255) default '' not null comment '名称', media_path varchar(255) default '' not null comment '路径', media_spec varchar(255) default '' not null comment '规格', create_time int default 0 not null comment '添加时间', update_time int default 0 not null comment '更新时间' ) comment '相册图片表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_member_card ( member_card_id int auto_increment primary key, card_id int default 0 not null comment '卡id', site_id int default 0 not null comment '站点id', from_member_id int default 0 not null comment '来源用户id', member_id int default 0 not null comment '领取用户id', to_member_id int default 0 not null comment '领取用户id', is_transfer int default 0 not null comment '是否已被转赠', source varchar(50) default '' not null comment '来源 order 购买电子卡 gift别人赠送', get_time int default 0 not null comment '生成时间', transfer_time int default 0 not null comment '使用时间', snapshot text null comment '快照' ) comment '礼品卡会员所属记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_order ( order_id int auto_increment primary key, order_no varchar(50) default '' not null comment '订单编号', site_id int default 0 not null comment '商家id', site_name varchar(50) default '' not null comment '店铺名称', order_name varchar(1000) default '' not null comment '订单内容', out_trade_no varchar(255) default '' not null comment '支付流水号', giftcard_id int default 0 not null comment '礼品卡id', card_right_type varchar(50) default '' not null comment '礼品卡权益类型1储值2商品', card_cover varchar(500) default '' not null comment '礼品卡封面', media_id int default 0 not null, order_money decimal(10, 2) default 0.00 not null comment '订单合计金额', goods_money decimal(10, 2) default 0.00 not null comment '商品总额', pay_money decimal(10, 2) default 0.00 not null comment '实际应付现金金额', pay_type varchar(55) default '' not null comment '支付方式', pay_type_name varchar(50) default '' not null comment '支付类型名称', create_time int default 0 not null comment '下单时间', pay_time int default 0 not null comment '支付时间', order_status varchar(50) default '' not null comment '状态topay待支付complete已完成close已取消', member_id int default 0 not null comment '会员id', buyer_ip varchar(255) default '' not null comment '购买人ip', order_from varchar(255) default '' not null comment '订单来源', order_from_name varchar(255) default '' not null comment '订单来源名', close_cause varchar(255) default '' not null comment '关闭原因', is_delete int default 0 not null comment '0未删除1已删除', buyer_message varchar(255) default '' not null comment '买家留言', validity_type varchar(50) default '' not null comment '有效期类型 forever:永久有效 day:购买后x天有效 date:指定过期日期', validity_time int default 0 not null comment '有效时间', validity_day int default 0 not null comment '有效天数', num int default 1 not null comment '礼品卡套数', close_time int default 0 not null comment '订单关闭时间', pay_status int default 0 not null comment '支付状态', is_allow_transfer int default 0 not null comment '是否允许转赠', card_right_goods_type varchar(50) default '' not null comment '卡权益商品类型all总体数量item按照商品数量', card_right_goods_count int default 0 not null comment '针对总体数量设置总数量', card_price decimal(10, 2) default 0.00 not null comment '礼品卡单价' ) comment '礼品卡订单表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_giftcard_order_goods ( order_goods_id int auto_increment primary key, order_id int default 0 not null comment '订单id', order_no varchar(20) default '' not null comment '订单编号', site_id int default 0 not null comment '商家id', member_id int default 0 not null comment '购买会员id', sku_id int default 0 not null comment '商品skuid', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(255) default '' not null comment '商品图片', sku_no varchar(255) default '' not null comment '商品编码', goods_id int default 0 not null comment '商品id', goods_name varchar(400) default '' not null comment '商品名称', goods_class int default 0 not null comment '商品种类(1.实物 2.虚拟3.卡券)', goods_class_name varchar(50) default '' not null comment '商品类型名称', price decimal(10, 2) default 0.00 not null comment '商品卖价', num int default 0 not null comment '购买数量', card_right_type varchar(50) default '' not null comment '卡权益类型balance储值 goods商品', balance decimal(10, 2) default 0.00 not null comment '单个储值余额', total_balance decimal(10, 2) default 0.00 not null comment '总的储值余额', goods_money decimal(10, 2) default 0.00 not null comment '商品总价', refund_no varchar(50) default '' not null comment '退款编号(申请产生)', refund_status int default 0 not null comment '退款状态', refund_status_name varchar(50) default '' not null comment '退款状态名称', refund_status_action varchar(1000) default '' not null comment '退款操作', refund_apply_money decimal(10, 2) default 0.00 not null comment '退款申请金额', refund_reason varchar(255) default '' not null comment '退款原因', refund_real_money decimal(10, 2) default 0.00 not null comment '实际退款金额', refund_time int default 0 not null comment '实际退款时间', refund_refuse_reason varchar(255) default '' not null comment '退款拒绝原因', refund_action_time int default 0 not null comment '退款时间', real_goods_money decimal(10, 2) default 0.00 not null comment '实际商品购买价', refund_remark varchar(255) default '' not null comment '退款说明', refund_pay_money decimal(10, 2) default 0.00 not null comment '真实退款金额', refund_money_type int default 1 not null comment '退款方式 1 原路退款 2线下退款3退款到余额', is_fenxiao int default 1 not null ) comment '礼品卡订单商品表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods ( goods_id int(11) unsigned auto_increment comment '商品id' primary key, goods_name varchar(255) default '' not null comment '商品名称', goods_class int default 1 not null comment '商品种类1.实物商品2.虚拟商品3.卡券商品4.服务项目5.卡项商品', goods_class_name varchar(25) default '' not null comment '商品种类', goods_attr_class int default 1 not null comment '商品类型id', goods_attr_name varchar(255) default '' not null comment '商品类型名称', site_id int default 0 not null comment '所属店铺id', site_name varchar(255) default '' not null comment '所属店铺名称', goods_image varchar(2000) default '' not null comment '商品主图路径', goods_content longtext null comment '商品详情', goods_state tinyint default 1 not null comment '商品状态(1.正常0下架)', category_id varchar(255) default '' not null comment '商品分类id,逗号隔开', category_json varchar(500) default '' not null comment '分类json字符串', brand_id int default 0 not null comment '商品品牌id', brand_name varchar(255) default '' not null comment '品牌名称', price decimal(10, 2) default 0.00 not null comment '商品价格(取第一个sku)', market_price decimal(10, 2) default 0.00 not null comment '划线价格(取第一个sku)', cost_price decimal(10, 2) default 0.00 not null comment '成本价(取第一个sku)', goods_stock decimal(12, 3) default 0.000 not null comment '商品库存(总和)', goods_stock_alarm int default 0 not null comment '库存预警', is_virtual tinyint default 0 not null comment '是否虚拟类商品(0实物1.虚拟)', virtual_indate int default 1 not null comment '虚拟商品有效期', is_free_shipping tinyint default 0 not null comment '是否免邮', shipping_template int default 0 not null comment '指定运费模板', goods_spec_format text null comment '商品规格格式', goods_attr_format text null comment '商品属性格式', is_delete tinyint default 0 not null comment '是否已经删除', introduction varchar(255) default '' not null comment '促销语', keywords varchar(255) default '' not null comment '关键词', unit varchar(255) default '' not null comment '单位', sort int default 0 not null comment '排序', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', video_url varchar(555) default '' not null comment '视频', sale_num decimal(12, 3) default 0.000 not null comment '销量', evaluate int default 0 not null comment '评价数', evaluate_shaitu int default 0 not null comment '评价晒图数', evaluate_shipin int default 0 not null comment '评价视频数', evaluate_zhuiping int default 0 not null comment '评价追评数', evaluate_haoping int default 0 not null comment '评价好评数', evaluate_zhongping int default 0 not null comment '评价中评数', evaluate_chaping int default 0 not null comment '评价差评数', is_fenxiao tinyint default 0 not null comment '参与分销(0不参与 1参与)', fenxiao_type tinyint default 1 not null comment '分销佣金类型(1默认 2自行设置)', supplier_id int default 0 not null comment '供应商id', is_consume_discount tinyint default 0 not null comment '是否参与会员等级折扣', discount_config tinyint default 0 not null comment '优惠设置(0默认 1自定义)', discount_method varchar(20) default '' not null comment '优惠方式(discount打折 manjian 满减 fixed_price 指定价格)', sku_id int default 0 not null comment 'sku_id', promotion_addon varchar(255) default '' not null comment '当前参与的营销活动,逗号分隔(限时折扣、团购、拼团、秒杀、专题活动)', goods_service_ids varchar(255) default '' not null comment '商品服务id', label_id int default 0 not null comment '商品分组id', label_name varchar(50) default '' not null comment '商品分组名称', virtual_sale decimal(12, 3) default 0.000 not null comment '虚拟销量', max_buy int default 0 not null comment '限购', min_buy int default 0 not null comment '起购数', recommend_way int default 0 not null comment '推荐方式,1:新品,2:精品,3;推荐', timer_on int default 0 not null comment '定时上架', timer_off int default 0 not null comment '定时下架', is_need_verify int default 0 not null comment '是否需要核销 ', verify_validity_type int default 0 not null comment '核销有效期类型 0:永久有效 1:购买后x天有效 2:指定过期日期', is_limit int default 0 not null comment '商品是否限购(0:否 1:是)', limit_type int default 1 not null comment '限购类型(1:单次限购 2:长期限购)', qr_id int default 0 not null comment '社群二维码id', template_id int default 0 not null comment '海报id', success_evaluate_num int default 0 not null comment '评价审核通过数', fail_evaluate_num int default 0 not null comment '评价审核失败数', wait_evaluate_num int default 0 not null comment '评价待审核数', sale_show int default 0 not null comment '销量是否展示', stock_show int default 0 not null comment '库存是否展示', virtual_deliver_type varchar(20) default '' not null comment '虚拟商品发货方式', virtual_receive_type varchar(20) default '' not null comment '虚拟商品收货方式', barrage_show int default 0 not null comment '弹幕是否展示', market_price_show int default 0 not null comment '划线价是否展示', form_id int default 0 not null comment '商品表单id', support_trade_type varchar(255) default '' not null comment '支持的配送方式', sale_channel varchar(50) default 'all' not null comment '销售渠道 all 线上线下销售 online 线上销售 offline线下销售', sale_store varchar(5000) default 'all' not null comment '适用门店 all 全部门店 ,门店id,门店id, 部分门店', service_category varchar(2000) default '' not null comment '服务类目', is_unify_price int default 1 not null comment '是否统一销售价', real_stock decimal(12, 3) default 0.000 not null comment '实物库存', pricing_type varchar(10) default 'num' not null comment '计价方式 num 计件 weight 计重', merch_id int default 0 not null comment '多商户id', ischeck int default 1 not null comment '0待审核1已审核', isinformation int default 0 not null comment '0普通商品1电话咨询2留言咨询', goods_mobile varchar(255) null comment '手机号码', en_goods_name varchar(255) null comment '英文商品标题', pdf_url varchar(255) null, pdf_name varchar(255) null ) comment '商品表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_category_id on lucky_goods (category_id); create index IDX_ns_goods_goods_class on lucky_goods (goods_class); create index IDX_ns_goods_is_delete on lucky_goods (is_delete); create index IDX_ns_goods_site_id on lucky_goods (site_id); create index IDX_ns_goods_sku_id on lucky_goods (sku_id); create index IDX_ns_goods_sort on lucky_goods (sort); create table if not exists lucky_goods_attr_class ( class_id int auto_increment primary key, class_name varchar(50) default '' not null comment '类型名称', site_id int default 0 not null comment '所属店铺id', sort int default 0 not null comment '排序号' ) comment ' 商品类型' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_attribute ( attr_id int auto_increment primary key, attr_name varchar(50) default '' not null comment '属性名称', attr_class_id int default 0 not null comment '商品类型id', attr_class_name varchar(50) default '' not null comment '商品类型名称', sort int default 0 not null comment '属性排序号', is_query int default 0 not null comment '是否参与筛选', is_spec int default 0 not null comment '是否是规格属性', attr_value_list varchar(255) default '' not null comment '属性值列表('',''隔开注意键值对)', attr_value_format text null comment '属性值格式json', attr_type int default 0 not null comment '属性类型 (1.单选 2.多选3. 输入 注意输入不参与筛选)', site_id int default 0 not null comment '站点id', site_name varchar(50) default '' not null comment '店铺名称' ) comment '商品属性' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_attribute_value ( attr_value_id int auto_increment primary key, attr_value_name varchar(50) default '' not null comment '属性值名称', attr_id int default 0 not null comment '属性id', attr_class_id int default 0 not null comment '类型id', sort int default 0 not null comment '排序' ) comment '商品属性值表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_brand ( brand_id bigint auto_increment comment '索引ID' primary key, brand_name varchar(100) default '' not null comment '品牌名称', brand_initial varchar(1) default '' not null comment '品牌首字母', image_url varchar(255) default '' not null comment '品牌logo', banner varchar(255) default '' not null comment '品牌广告图', brand_desc varchar(1000) default '' not null comment '品牌简介', site_id int default 0 not null comment '所属店铺id', sort int default 0 not null comment '排序', create_time int default 0 not null comment '创建时间', is_recommend tinyint default 0 not null comment '是否推荐' ) comment '商品品牌表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_browse ( id int auto_increment primary key, member_id int default 0 not null comment '浏览人', browse_time int default 0 not null comment '浏览时间', site_id int default 0 not null comment '站点id', sku_id int default 0 not null comment 'sku_id', goods_id int default 0 not null comment '商品id' ) comment '商品浏览历史' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_browse_member_id on lucky_goods_browse (member_id); create index IDX_ns_goods_browse_sku_id on lucky_goods_browse (sku_id); create table if not exists lucky_goods_card ( card_id int auto_increment primary key, site_id int default 0 not null comment '站点id', goods_id int default 0 not null comment '商品id', card_type varchar(255) default '' not null comment '卡类型', card_type_name varchar(255) default '' not null comment '卡类型名称', renew_price decimal(10, 2) default 0.00 not null comment '续费价格', recharge_money decimal(10, 2) default 0.00 not null comment '充值到账金额', common_num int default 0 not null comment '通卡总可用次数', discount_goods_type varchar(50) default 'all' not null comment '折扣卡适用商品类型 all 全部商品 part 部分商品', discount decimal(10, 2) default 100.00 not null comment '折扣卡全部商品时的折扣', validity_type smallint default 0 not null comment '有效期类型 0永久有效 1购买后几日有效 2指定有效时间', validity_day int default 0 not null comment '有效期天数', validity_time int default 0 not null comment '有效时间', constraint UK_ns_goods_card_goods_id unique (goods_id) ) comment '商品卡项表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_card_card_type on lucky_goods_card (card_type); create table if not exists lucky_goods_card_item ( id int auto_increment primary key, site_id int default 0 not null, card_goods_id int default 0 not null, goods_id int default 0 not null, sku_id int default 0 not null, num int default 0 not null comment '次卡可用次数', discount decimal(10, 2) default 100.00 not null comment '折扣卡折扣' ) comment '卡项商品关联表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_card_item_card_goods_id on lucky_goods_card_item (card_goods_id); create index IDX_ns_goods_card_item_sku_id on lucky_goods_card_item (sku_id); create table if not exists lucky_goods_cart ( cart_id int auto_increment primary key, site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '会员id', sku_id int default 0 not null comment 'sku_id', num int default 0 not null comment '数量', form_data text not null comment '表单数据' ) comment ' 购物车' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_cart_member_id on lucky_goods_cart (member_id); create table if not exists lucky_goods_category ( category_id int auto_increment primary key, site_id int default 0 not null comment '站点id', category_name varchar(50) default '' not null comment '分类名称', short_name varchar(50) default '' not null comment '简称', pid int default 0 not null comment '分类上级', level int default 0 not null comment '层级', is_show int default 0 not null comment '是否显示(0显示 -1不显示)', sort int default 0 not null comment '排序', image varchar(255) default '' not null comment '分类图片', keywords varchar(255) default '' not null comment '分类页面关键字', description varchar(255) default '' not null comment '分类介绍', attr_class_id int default 0 not null comment '关联商品类型id', attr_class_name varchar(255) default '' not null comment '关联商品类型名称', category_id_1 int default 0 not null comment '一级分类id', category_id_2 int default 0 not null comment '二级分类id', category_id_3 int default 0 not null comment '三级分类id', category_full_name varchar(255) default '' not null comment '组装名称', image_adv varchar(255) default '' not null comment '分类广告图', commission_rate decimal(10, 2) default 0.00 not null comment '佣金比率%', link_url varchar(2000) default '' not null comment '广告链接', is_recommend int default 0 not null comment '是否推荐', icon varchar(255) default '' not null comment '图标', en_category_name varchar(255) null comment '英文版分类名称' ) comment ' 商品分类' charset = utf8 row_format = DYNAMIC; create index pid_level on lucky_goods_category (pid, level); create table if not exists lucky_goods_collect ( collect_id int(11) unsigned auto_increment comment '主键' primary key, member_id int default 0 not null comment '会员id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment 'skuid', category_id int default 0 not null comment '商品分类id', sku_name varchar(255) default '' not null comment '商品名称', sku_price decimal(10, 2) default 0.00 not null comment '商品价格', sku_image varchar(255) default '' not null comment '商品图片', create_time int default 0 not null comment '收藏时间', site_id int default 0 not null comment '站点id' ) comment '商品收藏表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_collect_member_id on lucky_goods_collect (member_id); create index IDX_ns_goods_collect_sku_id on lucky_goods_collect (sku_id); create table if not exists lucky_goods_community_qrcode ( qr_id int(11) unsigned auto_increment comment '社群二维码id' primary key, qr_img varchar(255) default '' not null comment '社群二维码图片', qr_name varchar(255) default '' not null comment '社群二维码名称', community_describe varchar(255) default '' not null comment '社群描述', qr_state tinyint default 0 not null comment '二维码状态(0未启用1启用)', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', site_id int default 0 not null comment '所属店铺id' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_evaluate ( evaluate_id int(11) unsigned auto_increment comment '评价ID' primary key, site_id int default 0 not null comment '站点id', website_id int default 0 not null comment '分站id', order_id int default 0 not null comment '订单ID', order_no bigint unsigned default 0 not null comment '订单编号', order_goods_id int default 0 not null comment '订单项ID', goods_id int default 0 not null comment '商品ID', sku_id int default 0 not null comment '商品skuid', sku_name varchar(100) default '' not null comment '商品名称', sku_price decimal(10, 2) default 0.00 not null comment '商品价格', sku_image varchar(255) default '' not null comment '商品图片', content varchar(255) default '' not null comment '评价内容', images varchar(1000) default '' not null comment '评价图片', explain_first varchar(255) default '' not null comment '解释内容', member_id int default 0 not null comment '评价人id', member_name varchar(100) default '' not null comment '评价人名称', member_headimg varchar(255) default '' not null comment '评价人头像', is_anonymous tinyint default 0 not null comment '0表示不是 1表示是匿名评价', scores tinyint default 0 not null comment '1-5分', again_content varchar(255) default '' not null comment '追加评价内容', again_images varchar(1000) default '' not null comment '追评评价图片', again_explain varchar(255) default '' not null comment '追加解释内容', explain_type int default 0 not null comment '1好评2中评3差评', is_show int default 1 not null comment '1显示 0隐藏', create_time int default 0 not null comment '评价时间', again_time int default 0 not null comment '追加评价时间', shop_desccredit decimal(10, 2) default 5.00 not null comment '描述分值', shop_servicecredit decimal(10, 2) default 5.00 not null comment '服务分值', shop_deliverycredit decimal(10, 2) default 5.00 not null comment '配送分值', is_audit int default 1 not null comment '审核状态:0 未审核 1 审核通过,2 审核拒绝', again_is_audit int default 0 not null comment '审核状态:0 未审核 1 审核通过,2 审核拒绝' ) comment '商品评价表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_export ( export_id int auto_increment primary key, `condition` varchar(2000) default '' not null comment '条件 json', status int default 0 not null comment '导出状态 0 正在导出 1 已导出 2 已删除', create_time int default 0 not null comment '导出时间', path varchar(255) default '' not null comment '导出文件的物理路径', site_id int default 0 not null comment '站点id' ) comment '商品导出记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_form ( id int auto_increment primary key, site_id int null comment '平台id', member_id int null comment '用户id', goods_id int null comment '商品id', form_data longtext null comment '表单内容', create_time int null ) comment '商品留言表' engine = MyISAM collate = utf8_unicode_ci row_format = DYNAMIC; create table if not exists lucky_goods_giftcard ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', sku_id int default 0 not null comment 'sku_id', giftcard_id int default 0 not null comment '礼品卡id', num int default 0 not null comment '数量' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_grab ( grab_id int auto_increment primary key, site_id int default 0 not null, is_virtual tinyint default 0 not null comment '商品类型(0实物1.虚拟)', category_id varchar(255) default '' not null comment '商品分类', category_name varchar(255) default '' not null comment '商品分类名称', total_num int default 0 not null comment '采集数', success_num int default 0 not null comment '成功数', error_num int default 0 not null comment '失败数', create_time int default 0 not null ) comment '商品采集' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_grab_detail ( id int auto_increment primary key, site_id int default 0 not null, grab_id int default 0 not null, url varchar(255) default '' not null comment '采集地址', type varchar(255) default '' null comment '采集平台', type_name varchar(255) default '' not null comment '采集平台名称', reason varchar(255) default '' not null comment '失败原因', status tinyint default 1 not null comment '状态(1成功 2失败)' ) comment '采集明细' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_import_record ( id int auto_increment primary key, site_id int default 0 not null comment '站点ID', record_name varchar(255) default '' not null comment '记录名称', import_time int default 0 not null comment '导入时间', success_num int default 0 not null comment '成功数', fail_num int default 0 not null comment '失败数', fail_data text null comment '失败数据', data text null comment '导入原始数据' ) comment '商品导入记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_label ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', label_name varchar(50) default '' not null comment '标签名称', `desc` varchar(255) default '' not null comment '描述', create_time int default 0 not null, update_time int default 0 not null, sort int default 0 not null ) comment '商品标签' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_poster ( poster_id int(11) unsigned auto_increment comment 'id' primary key, poster_name varchar(255) default '' not null comment '海报名', poster_type tinyint default 1 not null comment '海报类型 1商品海报', scan_num tinyint default 0 not null comment '扫码数', status tinyint default 0 not null comment '状态 1启用0未启用', json_data text not null comment 'json数据', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', site_id int default 0 not null comment '站点id' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_recommend ( id int auto_increment primary key, name varchar(255) default '' not null comment '排行名称', sort int default 0 not null comment '排序', number int default 0 not null comment '数量', type int default 0 not null comment '类型:1一周销售排名,2一月销售排名,3自定义推荐', category_id int default 0 not null comment '商品分类ID', goods_ids varchar(255) default '' not null comment '自定义推荐商品ID', create_time int default 0 not null, modify_time int default 0 not null ) comment '商品热门排行' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_service ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', service_name varchar(50) default '' not null comment '服务名称', `desc` varchar(255) default '' not null comment '描述', create_time int default 0 not null, update_time int default 0 not null, icon varchar(2000) default '' not null ) comment '商品服务' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_goods_sku ( sku_id int(11) unsigned auto_increment comment '商品sku_id' primary key, site_id int default 0 not null comment '所属店铺id', goods_id int default 0 not null comment '商品id', sku_name varchar(255) default '' not null comment '商品sku名称', sku_no varchar(255) default '' not null comment '商品sku编码', sku_spec_format text null comment 'sku规格格式', price decimal(10, 2) default 0.00 not null comment 'sku单价', market_price decimal(10, 2) default 0.00 not null comment 'sku划线价', cost_price decimal(10, 2) default 0.00 not null comment 'sku成本价', discount_price decimal(10, 2) default 0.00 not null comment 'sku折扣价(默认等于单价)', promotion_type tinyint default 0 not null comment '活动类型1.限时折扣', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', stock decimal(12, 3) default 0.000 not null comment '商品sku库存', weight decimal(10, 2) default 0.00 not null comment '重量(单位g)', volume decimal(10, 2) default 0.00 not null comment '体积(单位立方米)', click_num int default 0 not null comment '点击量', sale_num decimal(12, 3) default 0.000 not null comment '销量', collect_num int default 0 not null comment '收藏量', sku_image varchar(255) default '' not null comment 'sku主图', sku_images varchar(2000) default '' not null comment 'sku图片', goods_class int default 1 not null comment '商品种类1.实物商品2.虚拟商品3.卡券商品4.服务项目5.卡项商品', goods_class_name varchar(25) default '' not null comment '商品种类', goods_attr_class int default 1 not null comment '商品类型id', goods_attr_name varchar(255) default '' not null comment '商品类型名称', goods_name varchar(255) default '' not null comment '商品名称', goods_content text null comment '商品详情', goods_state tinyint default 1 not null comment '商品状态(1.正常0下架)', goods_stock_alarm int default 0 not null comment '库存预警', is_virtual tinyint default 0 not null comment '是否虚拟类商品(0实物1.虚拟)', virtual_indate int default 1 not null comment '虚拟商品有效期', is_free_shipping tinyint default 0 not null comment '是否免邮', shipping_template int default 0 not null comment '指定运费模板', goods_spec_format text null comment '商品规格格式', goods_attr_format text null comment '商品属性格式', is_delete tinyint default 0 not null comment '是否已经删除', introduction varchar(255) default '' not null comment '促销语', keywords varchar(255) default '' not null comment '关键词', unit varchar(255) default '' not null comment '单位', sort int default 0 not null comment '排序', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', video_url varchar(555) default '' not null comment '视频', evaluate int default 0 not null comment '评价数', evaluate_shaitu int default 0 not null comment '晒图评价数', evaluate_shipin int default 0 not null comment '视频评价数', evaluate_zhuiping int default 0 not null comment '追评数', evaluate_haoping int default 0 not null comment '好评数', evaluate_zhongping int default 0 not null comment '中评数', evaluate_chaping int default 0 not null comment '差评数', spec_name varchar(255) default '' not null comment '规格名称', supplier_id int default 0 not null comment '供应商id', is_consume_discount tinyint default 0 not null comment '是否参与会员等级折扣', discount_config tinyint default 0 not null comment '优惠设置(0默认 1自定义)', discount_method varchar(20) default '' not null comment '优惠方式(discount打折 manjian 满减 fixed_price 指定价格)', member_price varchar(255) default '' not null comment '会员价', goods_service_ids varchar(255) default '' not null comment '商品服务id', virtual_sale decimal(12, 3) default 0.000 not null comment '虚拟销量', max_buy int default 0 not null comment '限购', min_buy int default 0 not null, recommend_way int default 0 not null comment '推荐方式,1:新品,2:精品,3;推荐', fenxiao_price decimal(10, 2) default 0.00 not null comment '分销计算价格', stock_alarm int default 0 not null comment 'sku库存预警', sale_sort int default 0 not null comment '销量排序字段 占位用', is_default tinyint default 0 not null comment '是否默认', verify_num int default 0 not null comment '核销次数', is_limit int default 0 not null comment '是否限购(0否1是)', limit_type int default 1 not null comment '限购类型(1单次限购2长期限购)', qr_id int default 0 not null comment '社群二维码id', template_id int default 0 not null comment '海报id', success_evaluate_num int default 0 not null comment '评价审核通过数', fail_evaluate_num int default 0 not null comment '评价审核失败数', wait_evaluate_num int default 0 not null comment '评价待审核数', brand_id int default 0 not null comment '品牌id', brand_name varchar(255) default '' not null comment '品牌名称', form_id int default 0 not null comment '表单id', support_trade_type varchar(255) default '' not null comment '支持的配送方式', sale_channel varchar(50) default 'all' not null comment '销售渠道 all 线上线下销售 online 线上销售 offline线下销售', sale_store varchar(5000) default 'all' not null comment '适用门店 all 全部门店 ,门店id,门店id, 部分门店', service_length int default 0 null comment '服务时长分钟', real_stock decimal(12, 3) default 0.000 not null comment '实物库存', is_unify_price int default 1 not null comment '是否统一销售价', plu varchar(4) default '' not null comment 'plu码', pricing_type varchar(10) default 'num' not null comment '计价方式 num 计件 weight 计重' ) comment '商品表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_goods_class on lucky_goods_sku (goods_class); create index IDX_ns_goods_is_delete on lucky_goods_sku (is_delete); create index IDX_ns_goods_site_id on lucky_goods_sku (site_id); create index IDX_ns_goods_sort on lucky_goods_sku (sort); create table if not exists lucky_goods_virtual ( id int auto_increment primary key, site_id int default 0 not null comment '店铺id', order_id int default 0 not null comment '订单id', order_no varchar(255) default '' not null comment '订单编号', sku_id int default 0 not null comment '商品sku_id', sku_name varchar(50) default '' not null comment '商品名称', code varchar(255) default '' not null comment '虚拟商品编码', is_veirfy int default 0 not null comment '是否已经核销', verify_time int default 0 not null comment '核销时间', member_id int default 0 not null comment '所属人', sku_image varchar(255) default '' not null comment '虚拟商品图片', expire_time int default 0 not null comment '核销有效期 0永久 ', card_info varchar(2500) default '' not null comment '卡密信息', sold_time int default 0 not null comment '售出时间', goods_id int default 0 not null comment '商品id', verify_total_count int default 0 not null comment '核销次数', verify_use_num int default 0 not null comment '已核销次数' ) comment '用户虚拟商品表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_group ( group_id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id(店铺,分站,门店,供应商),总平台端为0', app_module varchar(255) default '' not null comment '使用端口', group_name varchar(50) default '' not null comment '用户组名称', group_status int default 1 not null comment '用户组状态', is_system int default 0 not null comment '是否是系统用户组', menu_array text null comment '系统菜单权限组,用,隔开', `desc` varchar(255) default '' not null comment '描述', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '用户组表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_help ( id int(11) unsigned auto_increment comment '主键id' primary key, site_id int default 0 not null comment 'site_id', app_module varchar(255) default '' not null comment '应用模块', title varchar(255) default '' not null comment '帮助主题', link_address varchar(1000) default '' not null comment '链接地址', content text null comment '帮助内容', class_id int default 0 not null comment '帮助类型id', class_name varchar(50) default '' not null comment '帮助类型名称', sort int default 0 not null comment '排序号', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '帮助文章表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_help_class ( class_id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment 'site_id', app_module varchar(255) default '' not null comment '应用模块', class_name varchar(50) default '' not null comment '帮助类型名称', sort int default 0 not null comment '排序号', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '帮助类型' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_information ( id int auto_increment primary key, site_id int not null, member_id int null, realname varchar(255) null, mobile varchar(255) null, mailbox varchar(255) null, citys varchar(255) null, remark varchar(255) null, createtime int not null ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_link ( id int auto_increment primary key, name varchar(50) default '' not null comment '标识', addon_name varchar(50) default '' not null, title varchar(255) default '' not null comment '中文名称', parent varchar(255) default '' not null comment '父级', sort int default 0 not null comment '排序', level int default 0 not null comment '级别', web_url varchar(255) default '' not null comment 'pc端页面跳转路径', wap_url varchar(255) default '' not null comment 'wap端跳转路径', icon varchar(255) default '' not null comment '图标', support_diy_view varchar(255) default '' not null comment '支持的自定义页面(为空表示都支持)' ) comment '链接入口' charset = utf8 row_format = DYNAMIC; create index IDX_nc_link on lucky_link (addon_name); create table if not exists lucky_local ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', type varchar(255) default 'default' not null comment '配送方式 default 商家自配送 other 第三方配送', area_type int default 1 not null comment '配送区域', local_area_json varchar(2000) default '' not null comment '区域配送设置', time_is_open int default 0 not null comment '订单达是否开启 0 关闭 1 开启', time_type int default 0 not null comment '时间选取类型 0 全天 1 自定义', time_week varchar(255) default '' not null comment '营业时间 周一 周二.......', start_time int default 0 not null comment '当日的起始时间', end_time int default 0 not null comment '当日的营业结束时间', update_time int default 0 not null, is_open_step int default 0 not null comment '是否启用阶梯价(适用于行政区域)', start_distance decimal(10, 2) default 1.00 not null comment '多少距离以内,...', start_delivery_money decimal(10, 2) default 0.00 not null comment '多少距离以内,多少钱', continued_distance decimal(10, 2) default 1.00 not null comment '每增加多少距离', continued_delivery_money decimal(10, 2) default 0.00 not null comment '每增加多少距离,运费增加', start_money decimal(10, 2) default 0.00 not null comment '起送价', delivery_money decimal(10, 2) default 0.00 not null comment '配送费', area_array varchar(255) default '' not null comment '地域集合', man_money decimal(10, 2) default 0.00 not null comment '满多少钱', man_type varchar(255) default '' not null comment '满足条件优惠类型 free discount', man_discount decimal(10, 2) default 0.00 not null comment '满减优惠金额', time_interval int default 30 not null comment '时段设置单位分钟', delivery_time varchar(2000) default '' not null comment '配送时间段', store_id int default 0 not null comment '门店id', advance_day int default 0 not null comment '时间选择需提前多少天', most_day int default 7 not null comment '最多可预约多少天' ) comment '本地配送设置' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_local_delivery_package ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', order_id int default 0 not null comment '订单id', order_goods_id_array varchar(1000) default '' not null comment '订单项商品组合列表', goods_id_array varchar(1000) default '' not null comment '商品组合列表', package_name varchar(50) default '' not null comment '包裹名称 (包裹- 1 包裹 - 2)', delivery_type varchar(50) default 'default' not null comment '发货方式 default 商家自配送 other 第三方配送', delivery_no varchar(50) default '' not null comment '运单编号', delivery_time int default 0 not null comment '发货时间', member_id int default 0 not null comment '会员id', member_name varchar(50) default '' not null comment '会员名称', deliverer varchar(255) default '' not null comment '配送员', deliverer_mobile varchar(255) default '' not null, store_id int default 0 not null comment '所属门店' ) comment '外卖配送物流信息表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member ( member_id int auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', share_member int default 0 not null comment '分享人', source_member int default 0 not null comment '推荐人', fenxiao_id int default 0 not null comment '分销商(分销有效)', is_fenxiao tinyint default 0 not null comment '是否是分销商', username varchar(50) default '' not null comment '用户名', nickname varchar(50) default '' not null comment '用户昵称', mobile varchar(255) default '' not null comment '手机号', email varchar(50) default '' not null comment '邮箱', password varchar(255) default '' not null comment '用户密码(MD5)', status int default 1 not null comment '用户状态 用户状态默认为1', headimg varchar(255) default '' not null comment '用户头像', member_level int default 0 not null comment '用户等级', member_level_name varchar(50) default '' not null comment '会员等级名称', member_label varchar(255) default ',' not null comment '用户标签', member_label_name varchar(255) default '' not null comment '会员标签名称', qq varchar(255) default '' not null comment 'qq号', qq_openid varchar(255) default '' not null comment 'qq互联id', wx_openid varchar(255) default '' not null comment '微信用户openid', weapp_openid varchar(255) default '' not null comment '微信小程序openid', wx_unionid varchar(255) default '' not null comment '微信unionid', ali_openid varchar(255) default '' not null comment '支付宝账户id', baidu_openid varchar(255) default '' not null comment '百度账户id', toutiao_openid varchar(255) default '' not null comment '头条账号', douyin_openid varchar(255) default '' not null comment '抖音小程序openid', login_ip varchar(255) default '' not null comment '当前登录ip', login_type varchar(255) default 'h5' not null comment '当前登录的操作终端类型', login_time int default 0 not null comment '当前登录时间', last_login_ip varchar(255) default '' not null comment '上次登录ip', last_login_type varchar(11) default 'h5' not null comment '上次登录的操作终端类型', last_login_time int default 0 not null comment '上次登录时间', last_visit_time int default 0 not null comment '最后访问时间', last_consum_time int default 0 not null comment '最后消费时间', login_num int default 0 not null comment '登录次数', realname varchar(50) default '' not null comment '真实姓名', sex smallint default 0 not null comment '性别 0保密 1男 2女', location varchar(255) default '' not null comment '定位地址', birthday int default 0 not null comment '出生日期', reg_time int default 0 not null comment '注册时间', point int default 0 not null comment '积分', balance decimal(10, 2) default 0.00 not null comment '余额', growth int default 0 not null comment '成长值', balance_money decimal(10, 2) default 0.00 not null comment '现金余额(可提现)', account5 decimal(10, 2) default 0.00 not null comment '账户5', is_auth int default 0 not null comment '是否认证', is_member tinyint default 0 not null comment '是否是会员', member_time int default 0 not null comment '成为会员时间', sign_time int default 0 not null comment '最后一次签到时间', sign_days_series int default 0 not null comment '持续签到天数', pay_password varchar(32) default '' not null comment '交易密码', order_money decimal(10, 2) default 0.00 not null comment '付款后-消费金额', order_complete_money decimal(10, 2) default 0.00 not null comment '订单完成-消费金额', order_num int default 0 not null comment '付款后-消费次数', order_complete_num int default 0 not null comment '订单完成-消费次数', balance_withdraw_apply decimal(10, 2) default 0.00 not null comment '提现中余额', balance_withdraw decimal(10, 2) default 0.00 not null comment '已提现余额', is_delete tinyint default 0 not null comment '0正常 1已删除', member_level_type int default 0 not null comment '会员卡类型 0免费卡 1付费卡', level_expire_time int default 0 not null comment '会员卡过期时间', is_edit_username int default 0 not null comment '是否可修改用户名', login_type_name varchar(50) default '' not null comment '登陆类型名称', can_receive_registergift int default 0 not null comment '是否可以领取新人礼(只针对后台注册的用户 1可以 0不可以)', balance_lock decimal(10, 2) default 0.00 not null comment '冻结中的不可提现余额', balance_money_lock decimal(10, 2) default 0.00 not null comment '冻结中的可提现余额', province_id int default 0 not null comment '省id', city_id int default 0 not null comment '市id', district_id int default 0 not null comment '区县id', community_id int default 0 not null comment '社区id', address varchar(255) default '' not null comment '地址信息', full_address varchar(255) default '' not null comment '详细地址信息', longitude varchar(255) default '' not null comment '经度', latitude varchar(255) default '' not null comment '纬度', member_code varchar(50) default '' not null comment '会员卡号', bind_fenxiao_time int default 0 not null comment '会员与分销商绑定关系的时间', qrcode varchar(255) null comment '会员卡code', card_id varchar(255) null comment '卡id', huawei_openid varchar(255) default '' not null comment '华为账号' ) comment '系统用户表' charset = utf8 row_format = DYNAMIC; create index IDX_member_balance on lucky_member (balance); create index IDX_member_balance_money on lucky_member (balance_money); create index IDX_member_code on lucky_member (member_code); create index IDX_member_is_delete on lucky_member (is_delete); create index IDX_member_last_login_time on lucky_member (last_login_time); create index IDX_member_member_label on lucky_member (member_label); create index IDX_member_member_level on lucky_member (member_level); create index IDX_member_order_money on lucky_member (order_money); create index IDX_member_point on lucky_member (point); create index IDX_member_reg_time on lucky_member (reg_time); create index IDX_ns_member_is_delete on lucky_member (is_delete); create index IDX_ns_member_site_id on lucky_member (site_id); create index IDX_ns_member_status on lucky_member (status); create index IDX_ns_member_weapp_openid on lucky_member (weapp_openid); create index IDX_sys_user_user_email on lucky_member (email); create index IDX_sys_user_user_name on lucky_member (username); create index IDX_sys_user_user_password on lucky_member (password); create index IDX_sys_user_user_tel on lucky_member (mobile); create index IDX_sys_user_wx_openid on lucky_member (wx_openid); create index IDX_sys_user_wx_unionid on lucky_member (wx_unionid); create table if not exists lucky_member_account ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '用户id', account_type varchar(255) default 'point' not null comment '账户类型', account_data decimal(10, 2) default 0.00 not null comment '账户数据', from_type varchar(255) default '' not null comment '来源类型', type_name varchar(50) default '' not null comment '来源类型名称', type_tag varchar(255) default '' not null comment '关联关键字', remark varchar(255) default '' not null comment '备注信息', create_time int default 0 not null comment '创建时间', username varchar(255) default '' not null comment '用户名', mobile varchar(255) default '' not null comment '手机', order_number varchar(255) default '' not null comment '订单消费和退款的订单号', email varchar(255) default '' not null comment '邮箱', related_id int default 0 not null comment '关联Id(拼团返利使用)', point_expire tinyint default 0 not null comment '积分到期状态' ) comment '账户流水' charset = utf8 row_format = DYNAMIC; create index IDX_ns_member_account_account_type on lucky_member_account (account_type); create index IDX_ns_member_account_create_time on lucky_member_account (create_time); create index IDX_ns_member_account_from_type on lucky_member_account (from_type); create index IDX_ns_member_account_member_id on lucky_member_account (member_id); create table if not exists lucky_member_address ( id int(11) unsigned auto_increment primary key, member_id int default 0 not null comment '会员id', site_id int default 0 not null comment '站点id', name varchar(255) default '' not null comment '用户姓名', mobile varchar(255) default '' not null comment '手机', telephone varchar(255) default '' not null comment '联系电话', province_id int default 0 not null comment '省id', city_id int default 0 not null comment '市id', district_id int default 0 not null comment '区县id', community_id int default 0 not null comment '社区id', address varchar(255) default '' not null comment '地址信息', full_address varchar(255) default '' not null comment '详细地址信息', longitude varchar(255) default '' not null comment '经度', latitude varchar(255) default '' not null comment '纬度', is_default tinyint default 0 not null comment '是否是默认地址', type int default 1 not null comment '地址类型 1 普通地址 2 定位地址' ) comment '用户地址管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_auth ( auth_id int auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '会员ID', member_username varchar(50) default '' not null comment '会员用户名', auth_card_name varchar(50) default '' not null comment '实名姓名', auth_card_no varchar(18) default '' not null comment '实名身份证', auth_card_hand varchar(255) default '' not null comment '申请人手持身份证电子版', auth_card_front varchar(255) default '' not null comment '申请人身份证正面', auth_card_back varchar(255) default '' not null comment '申请人身份证反面', status int default 0 not null comment '审核状态0待审核1.已审核-1已拒绝', remark varchar(255) default '' null comment '审核意见', create_time int default 0 not null comment '创建时间', audit_time int default 0 not null comment '审核通过时间' ) comment '会员实名认证表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_bank_account ( id int auto_increment primary key, member_id int default 0 not null comment '会员id', realname varchar(50) default '' not null comment '真实姓名', mobile varchar(255) default '' not null comment '手机号', withdraw_type varchar(32) default '' null comment '账户类型 alipay-支付宝 bank银行卡', branch_bank_name varchar(50) default '' not null comment '银行名称', bank_account varchar(50) default '' not null comment '银行账号', is_default int default 0 not null comment '是否默认账号', create_time int default 0 null comment '创建日期', modify_time int default 0 null comment '修改日期' ) comment '会员提现账号' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_cancel ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '会员id', username varchar(255) default '' not null comment '会员账号', mobile varchar(255) default '' not null comment '电话', nickname varchar(255) default '' not null comment '会员昵称', status tinyint default 0 not null comment '状态', audit_uid int default 0 not null comment '审核人UID', audit_username varchar(255) default '' not null comment '审核人账号', reason varchar(255) default '' not null comment '审核拒绝原因', audit_time int default 0 not null comment '审核时间', create_time int default 0 not null comment '申请注销时间', member_json text null comment '会员信息', fenxiao_json text null comment '分销信息' ) comment '会员注销表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_cluster ( cluster_id int(11) unsigned auto_increment comment '会员群体ID' primary key, site_id int default 0 not null comment '站点ID', cluster_name varchar(255) default '' not null comment '群体名称', rule_json text null comment '规则json', member_num int default 0 not null comment '群体内会员 数量', member_ids text null comment '群体内会员ID', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '更新时间' ) comment '会员群体表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_goods_card ( card_id int auto_increment primary key, site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '会员id', goods_id int default 0 not null comment '卡项商品id', goods_name varchar(2000) default '' not null comment '卡项名称', create_time int default 0 not null comment '创建时间', end_time int default 0 not null comment '到期时间', card_code varchar(50) default '' not null comment '卡号', order_id int default 0 not null comment '关联订单id', total_num int default 0 not null comment '卡项总次数', total_use_num int default 0 not null comment '卡项使用次数', card_type varchar(255) default '' not null comment '卡项类型', status smallint default 1 not null comment '状态 1可用 0已失效', delivery_method varchar(50) default '' not null comment '产品出库方式 buy 购买时出库 verify 核销时出库', store_id int default 0 not null comment '门店id' ) comment '会员卡项表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_goods_card_item ( item_id int auto_increment primary key, site_id int default 0 not null comment '站点id', card_id int default 0 not null comment '会员卡项id', member_id int default 0 not null comment '会员id', goods_id int default 0 not null comment '服务商品id', sku_id int default 0 not null comment '服务商品规格id', goods_class varchar(255) default '' not null comment '商品类型', num int default 0 not null comment '商品次数/数量', use_num int default 0 not null comment '使用次数/数量', end_time int default 0 not null comment '有效期', member_verify_id int default 0 not null comment '会员核销码id', store_id int default 0 not null comment '门店id', card_type varchar(255) default '' not null comment '卡项类型' ) comment '会员卡项内容表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_goods_card_records ( id int auto_increment primary key, card_id int default 0 not null, site_id int default 0 not null, card_item_id int default 0 not null, type varchar(255) default '' not null comment 'verify核销order订单', relation_id int default 0 not null comment '关联id 核销码id orderid', create_time int default 0 not null, store_id int default 0 not null comment '使用门店', num int default 1 not null comment '使用次数' ) comment '会员卡项使用记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_import_log ( id int(11) unsigned auto_increment primary key, mobile varchar(255) default '' not null comment '手机号', username varchar(255) default '' not null comment '用户名', nickname varchar(255) default '' not null comment '昵称', password varchar(255) default '' not null comment '密码', realname varchar(255) default '' not null comment '真实姓名', wx_openid varchar(255) default '' not null comment '微信公众号openid', weapp_openid varchar(255) default '' not null comment '小程序openid', create_time int default 0 not null comment '添加时间', content varchar(255) default '' not null comment '内容', record_id int default 0 not null ) comment '会员导入记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_import_record ( id int auto_increment primary key, member_num int default 0 null comment '会员总数', success_num int default 0 null comment '会员导入成功数量', error_num int default 0 null comment '会员导入失败数量', status_name varchar(255) default '' null comment '导入状态', create_time int default 0 null comment '导入时间' ) comment '会员导入记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_journal ( id int auto_increment primary key, site_id int not null, member_id int null, createtime int null, type int default 0 not null, remark varchar(255) null, follow varchar(255) null, goodsid int default 0 not null ) engine = MyISAM charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_label ( label_id int(11) unsigned auto_increment comment '标签id' primary key, site_id int default 0 not null comment 'site_id', label_name varchar(50) default '' not null comment '标签名称', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', remark varchar(1000) default '' not null comment '备注', sort int default 0 not null comment '排序' ) comment '会员标签' charset = utf8 row_format = DYNAMIC; create index IDX_nc_member_label_label_id on lucky_member_label (label_id); create table if not exists lucky_member_level ( level_id int(11) unsigned auto_increment comment '会员等级' primary key, site_id int default 0 not null comment '站点id', level_name varchar(50) default '' not null comment '等级名称', sort int default 1 not null comment '等级排序列', growth decimal(10, 2) default 0.00 not null comment '所需成长值', remark varchar(255) default '' not null comment '备注', is_default int default 0 not null comment '是否默认,0:否,1:是', is_free_shipping tinyint default 0 not null comment '是否包邮', consume_discount decimal(10, 2) default 100.00 not null comment '消费折扣', point_feedback decimal(10, 2) default 0.00 not null comment '积分回馈倍率', send_point int default 0 not null comment '赠送积分(等级礼包)', send_balance decimal(10, 2) default 0.00 not null comment '赠送红包(等级礼包)', send_coupon varchar(255) default '' not null comment '赠送优惠券', level_type int default 0 not null comment '等级类型 0免费卡 1付费卡', charge_rule text null comment '付费规则', charge_type int default 0 not null comment '付费类型 0付款 1充值', bg_color varchar(255) default '#333' not null, status int default 1 not null comment '状态 0已下架 1发售中 ', is_recommend int default 0 not null comment '是否推荐', level_background varchar(100) default '' not null comment '背景色', level_text_color varchar(100) default '' not null comment '文字颜色', level_picture varchar(255) default '' not null comment '背景图' ) comment '会员等级' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_level_order ( order_id int auto_increment primary key, site_id int default 0 not null, order_no varchar(50) default '' not null comment '订单号', out_trade_no varchar(50) default '' not null comment '交易号', level_name varchar(255) default '' not null comment '会员卡名称', level_id int default 0 not null comment '会员卡id', order_type int default 1 not null comment '订单类型 1购卡 2续费', charge_type int default 0 not null comment '会员卡付费类型 0付款 1充值', period_unit varchar(255) default '' not null comment '单位 week-周 month-月 quarter-季 year-年', buy_num int default 1 not null comment '购买时长', order_money decimal(10, 2) default 0.00 not null comment '订单金额', buyer_id int default 0 not null comment '购买人id', nickname varchar(255) default '' not null comment '购买人昵称', headimg varchar(255) default '' not null comment '购买人头像', pay_type varchar(255) default '' not null comment '支付方式', pay_type_name varchar(255) default '' not null comment '支付方式名称', pay_status int default 0 not null comment '支付状态 0待支付 1已支付', order_status int default 0 not null comment '订单状态', create_time int default 0 not null comment '创建时间', pay_time int default 0 not null comment '支付时间' ) comment '会员卡订单表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_level_records ( id int auto_increment primary key, member_id int default 0 not null comment '会员id', site_id int default 0 not null, before_level_id int default 0 not null comment '变更前会员卡id', before_level_name varchar(255) default '' not null comment '变更前会员卡名称', before_level_type int default 0 not null comment '变更前会员卡类型 0免费卡 1付费卡', before_expire_time int default 0 not null comment '变更前会员卡过期时间 0永久', after_level_id int default 0 not null comment '变更后会员卡id', after_level_name varchar(255) default '' not null comment '变更后会员卡名称', after_level_type int default 0 not null comment '变更后会员卡类型 0免费卡 1付费卡', prev_id int default 0 not null comment '本次变更前该会员最新变更记录id', change_time int default 0 not null comment '变更时间', action_uid int default 0 not null comment '操作人id', action_type varchar(255) default '' not null comment '操作人类型 user后台用户 member会员自身', action_name varchar(255) default '' not null comment '操作人昵称', action_desc varchar(2500) default '' not null comment '操作描述', change_type varchar(255) default '' not null comment '变更方式', change_type_name varchar(255) default '' not null comment '变更方式名称' ) comment '会员等级变更记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_log ( id int(11) unsigned auto_increment primary key, member_id int default 0 not null comment '会员id', action varchar(255) default '' not null comment '操作行为插件', action_name varchar(255) default '' not null comment '操作行为名称', create_time int default 0 not null comment '创建时间', remark varchar(1000) default '' not null comment '备注' ) comment '会员操作日志表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_recharge ( recharge_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '店铺ID', site_name varchar(50) default '' not null comment '店铺名称', recharge_name varchar(255) default '' not null comment '套餐名称', cover_img varchar(255) default '' not null comment '封面', face_value decimal(10, 2) default 0.00 not null comment '面值', buy_price decimal(10, 2) default 0.00 not null comment '购买金额', point int default 0 not null comment '积分', growth int default 0 not null comment '成长值', coupon_id varchar(255) default '0' not null comment '优惠券ID', sale_num int default 0 not null comment '发放数量', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '修改时间', status tinyint default 0 not null comment '状态(1正常 2关闭)' ) comment '会员充值套餐' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_recharge_card ( card_id int(11) unsigned auto_increment primary key, recharge_id int default 0 not null comment '套餐ID', site_id int default 0 not null comment '店铺ID', site_name varchar(50) default '' not null comment '店铺名称', card_account varchar(255) default '' not null comment '充值卡号', recharge_name varchar(255) default '' not null comment '套餐名称', cover_img varchar(255) default '' not null comment '封面', face_value decimal(11, 2) unsigned default 0.00 not null comment '面值', point int default 0 not null comment '积分', growth int default 0 not null comment '成长值', coupon_id varchar(255) default '' not null comment '优惠券ID', buy_price decimal(10, 2) default 0.00 not null comment '购买金额', member_id int default 0 not null comment '会员ID', member_img varchar(255) default '' not null comment '会员头像', nickname varchar(255) default '' not null comment '会员昵称', order_id int default 0 not null comment '订单ID', order_no varchar(255) default '' not null comment '订单编号', from_type tinyint default 0 not null comment '获取来源', use_status tinyint default 1 not null comment '使用状态(1未使用 2已使用)', create_time int default 0 not null comment '创建时间', use_time int default 0 not null comment '使用时间' ) comment '充值卡' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_recharge_order ( order_id int(11) unsigned auto_increment primary key, recharge_id int default 0 not null comment '套餐ID', site_id int default 0 not null comment '店铺ID', site_name varchar(50) default '' not null comment '店铺名称', order_no varchar(255) default '' not null comment '订单编号', out_trade_no varchar(255) default '' not null comment '订单流水号', recharge_name varchar(255) default '' not null comment '套餐名称', cover_img varchar(255) default '' not null comment '封面', face_value decimal(10, 2) default 0.00 not null comment '面值', buy_price decimal(10, 2) default 0.00 not null comment '价格', point int default 0 not null comment '积分', growth int default 0 not null comment '成长值', coupon_id varchar(255) default '0' not null comment '优惠券ID', price decimal(10, 2) default 0.00 not null comment '实付金额', pay_type varchar(20) default '' not null comment '支付方式', pay_type_name varchar(255) default '' not null comment '支付方式名称', status varchar(255) default '1' not null comment '支付状态(1未支付 2已支付)', create_time int default 0 not null comment '创建时间', pay_time int default 0 not null comment '支付时间', member_id int default 0 not null comment '用户ID', member_img varchar(255) default '' not null comment '用户头像', nickname varchar(255) default '' not null comment '用户昵称', order_from varchar(50) default '' not null comment '订单来源', order_from_name varchar(255) default '' not null comment '订单来源名称', store_id int default 0 not null comment '门店id', relate_id int default 0 not null comment '业务id', relate_type varchar(255) default '' not null comment '业务类型' ) comment '充值卡订单' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_recommend ( recommend_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点ID', recommend_name varchar(255) default '' not null comment '活动名称', start_time int default 0 not null comment '邀请奖励 开始时间', end_time int default 0 not null comment '邀请奖励 结束时间', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '修改时间', status int default 0 not null comment '状态(0未开始1进行中2已结束-1已关闭)', point int default 0 not null comment '积分', balance decimal(10, 2) default 0.00 not null comment '余额', coupon varchar(255) default '' not null comment '优惠券ID 以逗号隔开', max_point decimal(10, 2) default 0.00 not null comment '每月最多积分', max_balance decimal(10, 2) default 0.00 not null comment '每月最多余额', max_coupon int default 0 not null comment '每月最多优惠券数量', remark varchar(255) default '' not null comment '备注', type varchar(255) default '' not null comment '奖励方式', max_fetch int(11) unsigned default 0 null comment '每人邀请奖励上限 0为不限制' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_recommend_award ( award_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点ID', recommend_id int default 0 not null comment '奖励活动ID', recommend_name varchar(255) default '' not null comment '奖励活动名称', member_id int default 0 not null comment '奖励人ID', member_nickname varchar(255) default '' not null comment '奖励人昵称', source_member int default 0 not null comment '被邀请人ID', source_member_nickname varchar(255) default '' not null comment '被邀请人昵称', create_time int default 0 not null comment '创建时间', remark varchar(255) default '' not null comment '备注', point decimal(10, 2) default 0.00 not null comment '赠送积分', balance decimal(10, 2) default 0.00 not null comment '赠送的余额', coupon varchar(255) default '' not null comment '优惠券ID', coupon_num int default 0 not null comment '已发放优惠券数量' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_member_withdraw ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', withdraw_no varchar(50) default '' not null comment '提现交易号', member_name varchar(50) default '' not null comment '会员姓名', member_id int default 0 not null comment '会员id', transfer_type varchar(20) default '' not null comment '转账提现类型', realname varchar(50) default '' not null comment '真实姓名', apply_money decimal(10, 2) default 0.00 not null comment '提现申请金额', rate decimal(10, 2) default 0.00 not null comment '提现手续费比率', service_money decimal(10, 2) default 0.00 not null comment '提现手续费', money decimal(10, 2) default 0.00 not null comment '提现到账金额', apply_time int default 0 not null comment '申请时间', audit_time int default 0 not null comment '审核时间', payment_time int default 0 not null comment '转账时间', status int default 0 not null comment '状态0待审核1.待转账2已转账 -1拒绝 -2转账失败', memo varchar(100) default '' not null comment '备注', refuse_reason varchar(100) default '' not null comment '拒绝理由', member_headimg varchar(255) default '' not null, status_name varchar(20) default '' not null comment '提现状态名称', transfer_type_name varchar(20) default '' not null comment '转账方式名称', bank_name varchar(255) default '' not null comment '银行名称', account_number varchar(255) default '' not null comment '收款账号', mobile varchar(255) default '' not null comment '手机号', certificate varchar(255) default '' not null comment '凭证', certificate_remark varchar(255) default '' not null comment '凭证说明', account_name varchar(50) default '' not null comment '账号', applet_type int default 0 not null, fail_reason varchar(255) default '' not null comment '失败原因' ) comment '会员提现表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_menu ( id int(11) unsigned auto_increment comment '菜单ID' primary key, app_module varchar(255) default 'admin' not null comment '应用模块', addon varchar(255) default '' not null comment '所属插件', title varchar(50) default '' not null comment '菜单标题', name varchar(50) default '' not null comment '菜单关键字', parent varchar(255) default '' not null comment '上级菜单', level int default 1 not null comment '深度等级', url varchar(255) default '' not null comment '链接地址', is_show tinyint default 0 not null comment '是否展示', sort int default 0 not null comment '排序(同级有效)', `desc` varchar(255) default '' not null comment '描述', is_icon tinyint default 0 not null comment '是否是矢量菜单图', picture varchar(255) default '' not null comment '图片(矢量图)', picture_select varchar(255) default '' not null comment '图片(矢量图)(选中)', is_control tinyint default 1 not null comment '是否控制权限' ) comment '菜单表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_menu_app_module on lucky_menu (app_module); create index IDX_ns_menu_is_control on lucky_menu (is_control); create index IDX_ns_menu_is_show on lucky_menu (is_show); create index IDX_ns_menu_level on lucky_menu (level); create index IDX_ns_menu_name on lucky_menu (name); create index IDX_ns_menu_parent on lucky_menu (parent); create index IDX_ns_menu_url on lucky_menu (url); create table if not exists lucky_merch ( merch_id int auto_increment primary key, status int default 1 not null comment '店铺经营状态(0.关闭,1正常)', merch_name varchar(255) null, close_info varchar(255) default '' not null comment '店铺关闭原因', sort int default 0 not null comment '排序号', end_time int default 0 not null comment '关闭时间', banner varchar(255) default '' null comment '店铺条幅', realname varchar(255) default '' null comment '联系人姓名', telphone varchar(255) default '' null comment '联系电话', mobile varchar(255) default '' null comment '联系手机号', workingtime int default 0 null comment '工作时间', province_id int default 0 null comment '省id', province_name varchar(50) default '' null comment '省名称', city_id int default 0 null comment '城市id', city_name varchar(50) default '' null comment '城市名称', district_id int default 0 null comment '区县id', district_name varchar(50) default '' null comment '区县地址', community_id int default 0 null comment '乡镇地址id', community_name varchar(50) default '' null comment '乡镇地址名称', address varchar(255) default '' null comment '详细地址', full_address varchar(255) default '' null comment '完整地址', longitude varchar(20) default '' null comment '经度', latitude varchar(20) default '' null comment '纬度', email varchar(50) default '' null, create_time int default 0 not null comment '创建时间', store_settlement_time int default 0 null comment '门店最后结算时间', work_week varchar(50) default '' null comment '工作日', site_id int not null, merch_image varchar(255) null comment '商户logo', uid int null comment '对应用户组id', settlement_rate decimal(10, 2) default 0.00 not null comment '抽成比例', order_money decimal(10, 2) default 0.00 null comment '累计订单金额', `desc` varchar(255) null comment '简介', balance decimal(10, 2) default 0.00 not null comment '余额', balance_withdraw decimal(10, 2) default 0.00 not null comment '已提现金额', balance_withdraw_apply decimal(10, 2) default 0.00 not null comment '提现中余额', category_id int default 0 not null comment '商户分类id' ) comment '店铺表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_merch_category ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', category_name varchar(50) default '' not null comment '分类名称', `desc` varchar(255) default '' not null comment '描述', create_time int default 0 not null, update_time int default 0 not null, sort int default 0 not null ) comment '商户分类' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_merch_log ( id int auto_increment primary key, site_id int default 0 not null, merch_id int not null, money decimal(10, 2) default 0.00 not null comment '金额', remark varchar(255) null comment '备注', createtime int null ) engine = MyISAM collate = utf8_unicode_ci row_format = DYNAMIC; create table if not exists lucky_merch_settlement ( id int auto_increment primary key, site_id int not null, merch_id int not null, order_no varchar(255) null comment '订单编号', order_money decimal(10, 2) default 0.00 not null comment '订单金额', proportion decimal(10, 2) default 0.00 not null comment '抽成比例', withdrawal decimal(10, 2) default 0.00 not null comment '分佣后金额=订单金额/抽成比例', finish_time int null comment '订单完成时间', status int default 0 not null comment '0不入账1入账', createtime int null, proportion_money decimal(10, 2) default 0.00 not null comment '平台获得佣金' ) engine = MyISAM collate = utf8_unicode_ci row_format = DYNAMIC; create table if not exists lucky_merch_withdraw ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', withdraw_no varchar(50) default '' not null comment '提现交易号', merch_name varchar(50) default '' not null comment '商户名称', merch_id int default 0 not null comment '商户id', transfer_type varchar(20) default '' not null comment '转账提现类型', realname varchar(50) default '' not null comment '真实姓名', apply_money decimal(10, 2) default 0.00 not null comment '提现申请金额', rate decimal(10, 2) default 0.00 not null comment '提现手续费比率', service_money decimal(10, 2) default 0.00 not null comment '提现手续费', money decimal(10, 2) default 0.00 not null comment '提现到账金额', apply_time int default 0 not null comment '申请时间', audit_time int default 0 not null comment '审核时间', payment_time int default 0 not null comment '转账时间', status int default 0 not null comment '状态0待审核1.待转账2已转账 -1拒绝 -2转账失败', memo varchar(100) default '' null comment '备注', refuse_reason varchar(100) default '' null comment '拒绝理由', merch_logo varchar(255) default '' not null, status_name varchar(20) default '' not null comment '提现状态名称', transfer_type_name varchar(20) default '' not null comment '转账方式名称', bank_name varchar(255) default '' not null comment '银行名称', account_number varchar(255) default '' not null comment '收款账号', mobile varchar(255) default '' null comment '手机号', certificate varchar(255) default '' null comment '凭证', certificate_remark varchar(255) default '' null comment '凭证说明', account_name varchar(50) default '' null comment '账号', fail_reason varchar(255) default '' not null comment '失败原因' ) comment '商户提现表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_message ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', keywords varchar(50) default '' not null comment '关键字', sms_is_open tinyint default 0 not null comment '短信消息是否启动', wechat_is_open int default 0 not null comment '微信公众号消息', wechat_template_id varchar(255) default '' not null comment '微信公众号ID', weapp_is_open int default 0 not null comment '微信小程序是否启动', weapp_template_id varchar(1000) default '' not null comment '微信小程序配置参数', aliapp_is_open int default 0 not null comment '支付宝小程序是否启动', aliapp_template_id varchar(1000) default '' not null comment '支付宝小程序配置参数' ) comment '消息管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_message_email_records ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', account varchar(255) default '' not null comment '接收者账号', status int default 0 not null comment '发送状态', title varchar(255) default '' not null comment '标题', content varchar(255) default '' not null comment '内容', keywords varchar(255) default '' not null comment '消息类型关键字', create_time int default 0 not null comment '创建时间', send_time int default 0 not null comment '发送时间', result varchar(255) default '' not null comment '发送结果', keywords_name varchar(50) default '' not null comment '关键字名称' ) comment '邮箱信息发送记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_message_send_log ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', keywords varchar(255) default '' not null comment '关键字', message_type varchar(255) default '' not null comment '消息类型', addon varchar(255) default '' not null comment '执行插件', title varchar(255) default '' not null comment '主题', message_json varchar(1000) default '' not null comment '消息内容json', create_time int default 0 not null comment '创建时间', send_time int default 0 not null comment '发送时间', send_log text null comment '发送结果', is_success int default 0 not null comment '是否发送成功' ) comment '消息发送日志' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_message_sms_records ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', account varchar(255) default '' not null comment '接收人账号', keywords varchar(255) default '' not null comment '消息类型关键字', status int default 0 not null comment '发送状态', result varchar(255) default '' not null comment '结果', content varchar(255) default '' not null comment '短信内容', var_parse varchar(255) default '' not null comment '短信内容变量解析 json', create_time int default 0 not null comment '创建时间', send_time int default 0 not null comment '发送时间', code varchar(255) default '' not null comment '模板编号', addon varchar(50) default '' not null comment '发送插件', addon_name varchar(50) default '' not null comment '发送方式名称', keywords_name varchar(50) default '' not null comment '关键字名称', site_name varchar(255) default '' not null comment '站点名称', sys_uid int default 0 not null comment '用户id' ) comment '短信消息发送记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_message_template ( id int(11) unsigned auto_increment comment '主键' primary key, addon varchar(255) default '' not null comment '插件', keywords varchar(50) default '' not null comment '关键字', title varchar(255) default '' not null comment '主题', message_type int default 1 not null comment '消息类型 1 买家消息 2 卖家消息', message_json varchar(1000) default '' not null comment '配置参数', sms_addon varchar(255) default '' not null comment '发送短信插件', sms_json varchar(1000) default '' not null comment '短信配置参数', sms_content varchar(1000) default '' not null comment '短信内容', wechat_json varchar(1000) default '' not null comment '配置参数', weapp_json varchar(1000) default '' not null comment '微信小程序配置参数', aliapp_json varchar(1000) default '' not null comment '支付宝小程序配置参数', support_type varchar(255) default '' not null comment '支持场景 如小程序 wep端', remark varchar(255) default '' not null comment '说明' ) comment '消息管理' charset = utf8 avg_row_length = 862 row_format = DYNAMIC; create table if not exists lucky_message_variable ( id int auto_increment primary key, title varchar(50) default '' not null comment '变量名', name varchar(50) default '' not null comment '变量', support_message_array varchar(255) default '' not null comment '支持消息' ) comment '消息模板变量' charset = utf8 avg_row_length = 5461 row_format = DYNAMIC; create table if not exists lucky_message_wechat_records ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', open_id varchar(255) default '' not null comment '接收者账号', status int default 0 not null comment '发送状态', keyword_json varchar(255) default '' not null comment '模板消息字段', keywords varchar(255) default '' not null comment '消息类型关键字', create_time int default 0 not null comment '创建时间', send_time int default 0 not null comment '发送时间', result varchar(255) default '' not null comment '发送结果', url varchar(255) default '' not null comment '发送模板消息携带链接', keywords_name varchar(50) default '' not null comment '关键字名称' ) comment '微信公众号消息发送记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_notes ( note_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', note_type varchar(255) default '' not null comment '笔记类型', note_title varchar(255) default '' not null comment '标题', note_abstract varchar(255) default '' not null comment '摘要', group_id int default 0 not null comment '分组id', cover_type tinyint default 0 not null comment '封面图片类型(0单图 1多图)', cover_img varchar(2000) default '' not null comment '封面图片', goods_ids varchar(255) default '' not null comment '商品id(根据类型判断商品是单个还是多个)', goods_highlights varchar(255) default '' not null comment '商品亮点(单品有效)', note_content longtext null comment '内容', status tinyint default 0 not null comment '状态(0草稿箱 1发布)', is_show_release_time tinyint default 0 not null comment '发布时间是否显示', is_show_read_num tinyint default 0 not null comment '阅读数是否显示', is_show_dianzan_num tinyint default 0 not null comment '点赞数是否显示', read_num int default 0 not null comment '阅读数', dianzan_num int default 0 not null comment '点赞数', create_time int default 0 null, update_time int default 0 not null, initial_read_num int default 0 not null comment '初始阅读数', initial_dianzan_num int default 0 not null comment '初始点赞数', sort int default 0 not null comment '排序', release_time int default 0 not null comment '发布时间', note_link varchar(255) default '' not null comment '公众号文章链接', video_path varchar(255) default '' not null comment '视频地址' ) comment '店铺笔记' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_notes_group_id on lucky_notes (group_id); create index IDX_ns_promotion_notes_site_id on lucky_notes (site_id); create table if not exists lucky_notes_dianzan_record ( record_id int(11) unsigned auto_increment primary key, note_id int default 0 not null comment '站点id', member_id int default 0 not null comment '分组名称' ) comment '笔记点赞记录' charset = utf8 row_format = DYNAMIC; create index IDX_ns_notes_dianzan_record_member_id on lucky_notes_dianzan_record (member_id); create index IDX_ns_notes_dianzan_record_note_id on lucky_notes_dianzan_record (note_id); create table if not exists lucky_notes_group ( group_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', group_name varchar(255) default '' not null comment '分组名称', sort int default 0 not null comment '排序', notes_num int default 0 not null comment '笔记数', release_num int default 0 not null comment '发布数', create_time int default 0 not null, update_time int default 0 not null ) comment '笔记分组' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_notice ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', title varchar(255) default '' not null comment '主题', content text null comment '内容', is_top int default 0 not null comment '是否置顶', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', receiving_type varchar(50) default '' not null comment '接受对象', receiving_name varchar(50) default '' not null comment '接受对象名称', sort int default 0 not null comment '公告排序' ) comment '公告' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_order ( order_id int auto_increment primary key, order_no varchar(50) default '' not null comment '订单编号', site_id int default 0 not null comment '商家id', site_name varchar(50) default '' not null comment '店铺名称', website_id int default 0 not null comment '分站id', order_name varchar(1000) default '' not null comment '订单内容', order_from varchar(55) default '' not null comment '订单来源', order_from_name varchar(50) default '' not null comment '订单来源名称', order_type int default 0 not null comment '订单类型 1. 普通订单 2. 门店订单 3. 本地配送订单4. 虚拟订单', order_type_name varchar(50) default '' not null comment '订单类型名称', order_promotion_type int default 0 not null comment '订单营销类型', order_promotion_name varchar(50) default '' not null comment '营销活动类型名称', promotion_id int default 0 not null comment '营销活动id', out_trade_no varchar(50) default '' not null comment '支付流水号', out_trade_no_2 varchar(50) default '' not null comment '支付流水号(多次支付)', delivery_code varchar(50) default '' not null comment '整体提货编码', order_status int default 0 not null comment '订单状态', order_status_name varchar(50) default '' not null comment '订单状态名称', order_status_action varchar(1000) default '' not null comment '订单操作', pay_status int default 0 not null comment '支付状态', delivery_status int default 0 not null comment '配送状态', refund_status int default 0 not null comment '退款状态', pay_type varchar(55) default '' not null comment '支付方式', pay_type_name varchar(50) default '' not null comment '支付类型名称', delivery_type varchar(50) default '' not null comment '配送方式', delivery_type_name varchar(50) default '' not null comment '配送方式名称', member_id int default 0 not null comment '购买人uid', name varchar(50) default '' not null comment '购买人姓名', mobile varchar(255) default '' not null comment '购买人手机', telephone varchar(255) default '' not null comment '购买人固定电话', province_id int default 0 not null comment '购买人省id', city_id int default 0 not null comment '购买人市id', district_id int default 0 not null comment '购买人区县id', community_id int default 0 not null comment '购买人社区id', address varchar(255) default '' not null comment '购买人地址', full_address varchar(255) default '' not null comment '购买人详细地址', longitude varchar(50) default '' not null comment '购买人地址经度', latitude varchar(50) default '' not null comment '购买人地址纬度', buyer_ip varchar(20) default '' not null comment '购买人ip', buyer_ask_delivery_time varchar(50) default '' not null comment '购买人要求配送时间', buyer_message varchar(50) default '' not null comment '购买人留言信息', goods_money decimal(10, 2) default 0.00 not null comment '商品总金额', delivery_money decimal(10, 2) default 0.00 not null comment '配送费用', promotion_money decimal(10, 2) default 0.00 not null comment '订单优惠金额(满减)', coupon_id int default 0 not null comment '优惠券id', coupon_money decimal(10, 2) default 0.00 not null comment '优惠券金额', invoice_money decimal(10, 2) default 0.00 not null comment '发票金额', order_money decimal(10, 2) default 0.00 not null comment '订单合计金额', adjust_money decimal(10, 2) default 0.00 not null comment '订单调整金额', balance_money decimal(10, 2) default 0.00 not null comment '余额支付金额', pay_money decimal(10, 2) default 0.00 not null comment '抵扣之后应付金额', create_time int default 0 not null comment '创建时间', pay_time int default 0 not null comment '订单支付时间', delivery_time int default 0 not null comment '订单配送时间', sign_time int default 0 not null comment '订单签收时间', finish_time int default 0 not null comment '订单完成时间', close_time int default 0 not null comment '订单关闭时间', is_lock int default 0 not null comment '是否锁定订单(针对维权,锁定不可操作)', is_evaluate int default 0 not null comment '是否允许订单评价', is_delete int default 0 not null comment '是否删除(针对后台)', is_enable_refund int default 0 not null comment '是否允许退款', remark varchar(255) default '' not null comment '卖家留言', goods_num decimal(12, 3) default 0.000 not null comment '商品件数', delivery_store_id int default 0 not null comment '门店id', delivery_status_name varchar(50) default '' not null comment '发货状态', is_settlement tinyint default 0 not null comment '是否进行结算', store_settlement_id int default 0 not null comment '门店结算id', delivery_store_name varchar(255) default '' not null comment '门店名称', promotion_type varchar(255) default '' not null comment '营销类型', promotion_type_name varchar(255) default '' not null comment '营销类型名称', promotion_status_name varchar(255) default '' not null comment '营销状态名称', delivery_store_info text null comment '门店信息(json)', virtual_code varchar(255) default '' not null comment '虚拟商品码', evaluate_status int default 0 not null comment '评价状态,0:未评价,1:已评价,2:已追评', evaluate_status_name varchar(20) default '' not null comment '评价状态名称,未评价,已评价,已追评', refund_money decimal(10, 2) default 0.00 not null comment '订单退款金额', commission decimal(10, 2) default 0.00 not null comment '总支出佣金', is_invoice int default 0 not null comment '是否需要发票 0 无发票 1 有发票', invoice_type int default 1 not null comment '发票类型 1 纸质发票 2 电子发票', invoice_title varchar(255) default '' not null comment '发票抬头', taxpayer_number varchar(255) default '' not null comment '纳税人识别号', invoice_rate decimal(10, 2) default 0.00 not null comment '发票税率', invoice_content varchar(255) default '' not null comment '发票内容', invoice_delivery_money decimal(10, 2) default 0.00 not null comment '发票邮寄费用', invoice_full_address varchar(255) default '' not null comment '发票邮寄地址', is_tax_invoice int default 0 not null comment '是否需要增值税专用发票', invoice_email varchar(255) default '' not null comment '发票发送邮件', invoice_title_type int default 0 not null comment '发票抬头类型 1 个人 2 企业', is_fenxiao int default 1 not null comment '是否参与分销 0不参与 1参与', point_money decimal(10, 2) default 0.00 not null comment '积分抵现金额', member_card_money decimal(10, 2) default 0.00 not null comment '会员卡订单金额', member_card_order int default 0 not null comment '会员卡订单id', invoice_status tinyint default 0 not null comment '发票状态(0待开票 1已开票)', invoice_remark text null comment '发票备注', invoice_code varchar(255) default '' not null comment '发票编码', invoice_image varchar(255) default '' not null comment '发票凭证', invoice_time int default 0 not null comment '开票时间', predict_delivery_time int default 0 not null comment '预计发货时间', is_video_number int default 0 not null comment '订单是否同步到视频号', close_cause varchar(255) default '' not null comment '关闭原因', cashier_order_type varchar(50) default '' not null comment '收银台订单类型 goods 商品相关 card 卡项 recharge 充值', cashier_sell_time int default 0 not null comment '销售时间', cashier_operator_id int(11) unsigned default 0 not null comment '收银台操作人', cashier_operator_name varchar(255) default '' not null comment '收银台操作人', balance decimal(10, 2) default 0.00 not null comment '为收银台新创建的字段,切勿随意使用', total_balance decimal(10, 2) default 0.00 not null comment '为收银台新创建的字段,切勿随意使用', store_id int default 0 not null comment '所属门店', reduction decimal(10, 2) default 0.00 not null comment '收银订单减免金额', round_money decimal default 0 not null comment '抹零金额', order_scene varchar(50) default 'online' not null comment '订单场景 online 线上 cashier 收银台', store_commission_rate decimal(10, 2) default 0.00 not null comment '门店比率1', store_commission decimal(10, 2) default 0.00 not null comment '门店佣金', merch_id int default 0 not null comment '商户id', host_order_id int default 0 not null comment '多商户订单主订单id', is_merch_settlement int default 0 not null comment '是否已经给商户结算0未结算1已结算', business varchar(255) null comment '业务员' ) comment '订单表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_order_create_time on lucky_order (create_time); create index IDX_ns_order_finish_time on lucky_order (finish_time); create index IDX_ns_order_is_tax_invoice on lucky_order (is_tax_invoice); create index IDX_ns_order_member_id on lucky_order (member_id); create index IDX_ns_order_order_from on lucky_order (order_from); create index IDX_ns_order_order_status on lucky_order (order_status); create index IDX_ns_order_order_type on lucky_order (order_type); create index IDX_ns_order_pay_status on lucky_order (pay_status); create index IDX_ns_order_promotion_id on lucky_order (promotion_id); create table if not exists lucky_order_export ( export_id int auto_increment primary key, `condition` varchar(2000) default '' not null comment '条件 json', status int default 0 not null comment '导出状态 0 正在导出 1 已导出 2 已删除', create_time int default 0 not null comment '导出时间', type int default 0 not null comment '导出类型', path varchar(255) default '' not null comment '导出文件的物理路径', site_id int default 0 not null comment '站点id' ) comment '订单导出记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_order_goods ( order_goods_id int auto_increment primary key, order_id int default 0 not null comment '订单id', order_no varchar(20) default '' not null comment '订单编号', site_id int default 0 not null comment '商家id', member_id int default 0 not null comment '购买会员id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment '商品skuid', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(2000) default '' not null comment '商品图片', sku_no varchar(255) default '' not null comment '商品编码', is_virtual int default 0 not null comment '是否是虚拟商品', goods_class varchar(50) default '0' not null comment '商品种类(1.实物 2.虚拟3.卡券)', goods_class_name varchar(50) default '' not null comment '商品类型名称', price decimal(10, 2) default 0.00 not null comment '商品卖价', cost_price decimal(10, 2) default 0.00 not null comment '成本价', num decimal(12, 3) default 0.000 not null comment '购买数量', goods_money decimal(10, 2) default 0.00 not null comment '商品总价', cost_money decimal(10, 2) default 0.00 not null comment '成本总价', delivery_status int default 0 not null comment '配送状态', delivery_status_name varchar(50) default '' not null comment '配送状态名称', delivery_no varchar(50) default '' not null comment '配送单号', gift_flag int default 0 not null comment '赠品标识', refund_no varchar(50) default '' not null comment '退款编号(申请产生)', refund_status int default 0 not null comment '退款状态', refund_status_name varchar(50) default '' not null comment '退款状态名称', refund_status_action varchar(1000) default '' not null comment '退款操作', refund_type int default 0 not null comment '退款方式', refund_apply_money decimal(10, 2) default 0.00 not null comment '退款申请金额', refund_reason varchar(255) default '' not null comment '退款原因', refund_real_money decimal(10, 2) default 0.00 not null comment '实际退款金额', refund_delivery_name varchar(50) default '' not null comment '退款公司名称', refund_delivery_no varchar(20) default '' not null comment '退款单号', refund_time int default 0 not null comment '实际退款时间', refund_refuse_reason varchar(255) default '' not null comment '退款拒绝原因', refund_action_time int default 0 not null comment '退款时间', real_goods_money decimal(10, 2) default 0.00 not null comment '实际商品购买价', refund_remark varchar(255) default '' not null comment '退款说明', refund_delivery_remark varchar(255) default '' not null comment '买家退货说明', refund_address varchar(255) default '' not null comment '退货地址', is_refund_stock int default 0 not null comment '是否返还库存', refund_money_type int default 1 not null comment '退款方式 1 原路退款 2线下退款3退款到余额', shop_active_refund tinyint default 0 not null comment '商家主动退款(0否 1是)', shop_refund_remark varchar(255) default '' not null comment '商家退款说明', refund_mode int default 1 not null comment '退款类型 1退款 2售后', promotion_money decimal(10, 2) default 0.00 not null comment '优惠金额', coupon_money decimal(10, 2) default 0.00 not null comment '优惠券金额', adjust_money decimal(10, 2) default 0.00 not null comment '调整金额', goods_name varchar(400) default '' not null comment '商品名称', sku_spec_format varchar(1000) default '' not null comment 'sku规格格式', is_fenxiao int default 1 not null, use_point int default 0 not null comment '积分抵扣所用积分数', point_money decimal(10, 2) default 0.00 not null comment '积分抵扣金额', refund_delivery_money decimal(10, 2) default 0.00 not null, create_time int default 0 not null, out_aftersale_id varchar(255) default '' not null comment '关联视频号订单', refund_address_id int default 0 not null comment '退货地址id', refund_pay_money decimal(10, 2) default 0.00 not null comment '真实退款金额', store_id int default 0 not null comment '所属门店', card_item_id int default 0 not null comment '卡项id', card_promotion_money decimal(10, 2) default 0.00 not null comment '次卡抵扣金额', supplier_id int default 0 not null comment '供应商id', is_adjust_price int default 0 not null comment '是否自定义价格' ) comment '订单商品表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_order_goods_goods_id on lucky_order_goods (goods_id); create index IDX_ns_order_goods_is_fenxiao on lucky_order_goods (is_fenxiao); create index IDX_ns_order_goods_is_virtual on lucky_order_goods (is_virtual); create index IDX_ns_order_goods_member_id on lucky_order_goods (member_id); create index IDX_ns_order_goods_order_id on lucky_order_goods (order_id); create index IDX_ns_order_goods_refund_status on lucky_order_goods (refund_status); create index IDX_ns_order_goods_sku_id on lucky_order_goods (sku_id); create table if not exists lucky_order_import_file ( id int auto_increment primary key, site_id int default 0 not null, filename varchar(255) default '' not null comment '文件名称', path varchar(255) default '' not null comment '地址', order_num int default 0 not null comment '导入的订单数', success_num int default 0 not null comment '成功数', error_num int default 0 not null comment '失败数', create_time int default 0 not null, delivery_time int default 0 not null comment '发货时间', uid int not null, username varchar(255) not null ) comment '订单批量导入发货' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_order_import_file_log ( id int auto_increment primary key, site_id int default 0 not null, file_id int default 0 not null comment '上传文件id', order_no varchar(255) default '' not null comment '订单编号', order_name varchar(255) default '' not null comment '订单内容', status tinyint default 0 not null comment '状态', reason varchar(255) default '' not null comment '原因' ) comment '订单导入明细' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_order_log ( id int auto_increment primary key, order_id int default 0 not null comment '订单id', action varchar(255) default '' not null comment '操作内容', uid int default 0 not null comment '操作人id', nick_name varchar(50) default '' not null comment '操作人名称', order_status int default 0 not null comment '订单状态,操作后', action_way bigint default 2 not null comment '操作类型1买家2卖家 3 系统任务', order_status_name varchar(255) default '' not null comment '订单状态名称,操作后', action_time int default 0 not null comment '操作时间' ) comment '订单操作表(传统表,不用设计)' charset = utf8 row_format = DYNAMIC; create index IDX_ns_order_log_order_id on lucky_order_log (order_id); create table if not exists lucky_order_promotion_detail ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', order_id int default 0 not null comment '订单id', promotion_text varchar(255) default '' not null comment '订单优惠说明', sku_list varchar(255) default '' not null comment '参与的商品项', type int default 0 not null comment '类型 1优惠,2赠送', num int default 0 not null comment '相关数量', money decimal(10, 2) default 0.00 not null comment '相关金额', type_event varchar(255) default '' not null comment '相关执行事件', create_time int default 0 not null comment '创建时间' ) comment '订单满减优惠表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_order_refund_export ( export_id int auto_increment primary key, `condition` varchar(2000) default '' not null comment '条件 json', status int default 0 not null comment '导出状态 0 正在导出 1 已导出 2 已删除', create_time int default 0 not null comment '导出时间', path varchar(255) default '' not null comment '导出文件的物理路径', site_id int default 0 not null comment '站点id' ) comment '订单维权导出记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_order_refund_log ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', order_goods_id int default 0 not null comment '订单项id', refund_status int default 0 not null comment '退款状态', refund_status_name varchar(255) default '' not null comment '退款状态名称', action varchar(255) default '' not null comment '操作内容', action_way int default 2 not null comment '操作类型1买家2卖家', action_userid int default 0 not null comment '操作人id', username varchar(255) default '' not null comment '操作人名称', action_time int default 0 not null comment '操作时间', `desc` text null ) comment '订单退款操作表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_order_refund_log_order_goods_id on lucky_order_refund_log (order_goods_id, site_id); create table if not exists lucky_pay ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', out_trade_no varchar(255) default '' not null comment '支付流水号', pay_type varchar(255) default '' not null comment '支付方式', trade_no varchar(255) default '' not null comment '交易单号', pay_no varchar(255) default '' not null comment '支付账号', pay_body varchar(1000) default '' not null comment '支付主体', pay_detail varchar(1000) default '' not null comment '支付详情', pay_money decimal(10, 2) default 0.00 not null comment '支付金额', pay_addon varchar(255) default '' not null comment '支付插件', pay_voucher varchar(255) default '' not null comment '支付票据', pay_status int default 0 not null comment '支付状态(0.待支付 1. 支付中 2. 已支付 -1已取消)', return_url varchar(255) default '' not null comment '同步回调网址', event varchar(255) default '' not null comment '支付成功后事件(事件,网址)', mch_info varchar(1000) default '' not null comment '商户信息', create_time int default 0 not null comment '创建时间', pay_time int default 0 not null comment '支付时间', balance decimal(10, 2) default 0.00 not null comment '不可提现余额', balance_money decimal(10, 2) default 0.00 not null comment '可提现余额', member_id int default 0 not null comment '支付会员id', pay_json varchar(255) default '' not null comment '支付扩展用支付信息', constraint UK_ns_pay_out_trade_no unique (out_trade_no) ) comment '支付记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_pay_balance ( id int auto_increment primary key, auth_code varchar(18) default '' not null, site_id int default 0 not null, member_id int default 0 not null, create_time int default 0 not null comment '创建时间', expire_time int default 0 not null comment '过期时间', dynamic_code varchar(4) default '' not null comment '动态码', constraint UK_ns_authcode_pay_auth_code unique (auth_code) ) comment '会员付款码' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_pay_refund ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', refund_no varchar(255) default '' not null comment '退款编号', out_trade_no varchar(255) default '' not null comment '对应支付流水号', refund_detail varchar(255) default '' not null comment '退款详情', refund_type varchar(255) default '' not null comment '退款类型', refund_fee decimal(10, 2) default 0.00 not null comment '退款金额', total_money decimal(10, 2) default 0.00 not null comment '实际支付金额', create_time int default 0 not null comment '创建时间' ) comment '退款记录' charset = utf8 row_format = DYNAMIC; create index UK_ns_pay_refund_out_trade_no on lucky_pay_refund (out_trade_no); create table if not exists lucky_pc_floor ( id int auto_increment comment '数据ID' primary key, site_id int default 0 not null comment '所属店铺id', block_id int default 0 not null comment '模板ID', title varchar(100) default '' not null comment '楼层标题', value text null comment '配置', state tinyint default 1 not null comment '状态(0:禁用,1:启用)', create_time int default 0 not null comment '创建时间', sort int default 0 not null comment '排序号' ) comment 'PC端首页楼层' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_pc_floor_block ( id int auto_increment comment '数据ID' primary key, name varchar(50) default '' not null comment '标识', title varchar(50) default '' not null comment '组件名称', value text null comment '配置:json格式', sort int default 0 not null comment '排序号' ) comment 'PC端首页楼层模板' charset = utf8 avg_row_length = 5461 row_format = DYNAMIC; create table if not exists lucky_pc_friendly_link ( id int(11) unsigned auto_increment comment '索引id' primary key, site_id int default 0 not null comment '所属店铺id', link_title varchar(100) default '' not null comment '标题', link_url varchar(100) default '' not null comment '链接', link_pic varchar(100) default '' not null comment '图片', link_sort int null, is_blank int default 1 not null comment '是否新窗口打开 1.是 2.否', is_show int default 1 not null comment '是否显示 1.是 2.否' ) comment 'PC友情链接表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_pc_nav ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '所属店铺id', nav_title varchar(255) default '' not null comment '导航名称', nav_url varchar(255) default '' not null comment '链接地址', sort int default 0 not null comment '排序号', is_blank int default 0 null, create_time int default 0 null comment '创建时间', modify_time int default 0 null comment '修改时间', nav_icon varchar(255) default '' not null comment '导航图标', is_show smallint default 1 not null comment '是否显示 1显示 0不显示' ) comment 'PC导航管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_personnel ( id int auto_increment primary key, site_id int default 0 null, realname varchar(50) default '' null, displayorder int default 0 null, mobile varchar(255) null, address varchar(255) null, landline varchar(255) null comment '座机', position varchar(255) null comment '职位', title_text varchar(255) null, position_text varchar(255) null, mobile_text varchar(255) null, address_text varchar(255) null, email varchar(255) null comment '电子邮箱' ) engine = MyISAM charset = utf8 row_format = DYNAMIC; create index idx_displayorder on lucky_personnel (displayorder); create index idx_uniacid on lucky_personnel (site_id); create table if not exists lucky_personnel_files ( files_id int auto_increment primary key, site_id int null, files_title varchar(255) null, files_url varchar(255) null, createtime int null, imgs longtext null, size decimal(10, 2) default 0.00 null comment '大小' ) engine = MyISAM collate = utf8_unicode_ci; create table if not exists lucky_personnel_message ( id int auto_increment primary key, site_id int not null, member_id int null, username varchar(255) null, mobile varchar(255) null, message varchar(255) null, createtime int null ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_personnel_video ( video_id int auto_increment primary key, site_id int null, video_title varchar(255) null, video_url varchar(255) null, images longtext null, createtime int null ) engine = MyISAM collate = utf8_unicode_ci; create table if not exists lucky_platform ( platformid int(10) default 0 not null primary key, title varchar(255) default '' not null comment '网站主题', logo varchar(255) default '' not null comment '网站logo', `desc` varchar(255) default '' not null comment '网站简介', keywords varchar(255) default '' not null comment '网站关键字', web_address varchar(255) default '' not null comment '网站地址', web_qrcode varchar(255) default '' not null comment '网站二维码', web_email varchar(50) default '' not null comment '网站邮箱', web_phone varchar(255) default '' not null comment '联系电话', web_qq varchar(255) default '' not null comment '网站qq', web_weixin varchar(255) default '' not null comment '联系人微信号', web_status tinyint default 1 not null comment '网站状态', close_reason varchar(255) default '' not null comment '关闭原因', wap_status tinyint default 1 not null comment '手机端状态', account decimal(10, 2) default 0.00 not null comment '账户金额', account_withdraw decimal(10, 2) default 0.00 not null comment '已提现金额', account_shop decimal(10, 2) default 0.00 not null comment '店铺入驻费用', account_order decimal(10, 2) default 0.00 not null comment '订单结算费用', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', wap_domain varchar(255) default '' not null comment 'wap端域名', site_area_id int default 0 not null comment '分站城市id', site_area_name varchar(255) default '全国' not null comment '分站城市名称', username varchar(255) default 'admin' not null comment '分站管理员', shop_rate decimal(10, 2) default 0.00 not null comment '开店分佣比率', order_rate decimal(10, 2) default 0.00 not null comment '订单分佣比率', settlement_bank_account_name varchar(50) default '' not null comment '结算银行开户名', settlement_bank_account_number varchar(50) default '' not null comment '结算公司银行账号', settlement_bank_name varchar(50) default '' not null comment '结算开户银行支行名称', settlement_bank_address varchar(50) default '' not null comment '结算开户银行所在地', status tinyint(1) default 1 not null comment '分站状态(1正常 -1冻结)', web_domain varchar(255) default '' not null comment '电脑端域名' ) comment '系统站点设置(城市分站)' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_platform_shop ( uniacid int auto_increment comment '站点id' primary key, platform_name varchar(50) default '' not null comment '站点名称', telphone varchar(255) default '' null comment '联系电话', store_image varchar(255) default '' null comment '站点LOGO', site_name varchar(255) default '' not null comment '站点名称', status int default 0 not null comment '状态', username varchar(255) default '' not null comment '门店管理员', create_time int default 0 not null comment '创建时间' ) comment '线下门店表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_poster ( poster_id int auto_increment primary key, site_id int default 0 not null, template_id int default 0 not null comment '海报模版id', relation_id int default 0 not null comment '关联id', headimg_is_show int default 0 not null comment '头像是否显示', headimg_shape varchar(255) default '' not null comment '头像形式 circle 圆 square 方形', nickname_is_show int default 0 not null comment '昵称是否显示', nickname_font_size decimal(10, 2) default 0.00 not null comment '昵称字体大小', nickname_color varchar(255) default '' not null comment '昵称文字颜色', background varchar(255) default '' not null comment '海报背景', qrcode_type varchar(255) default '' not null comment '带参二维码,常规二维码', headimg_width decimal(10, 2) default 0.00 not null comment '头像图片长度', headimg_height decimal(10, 2) default 0.00 not null comment '头像图片高度', headimg_top decimal(10, 2) default 0.00 not null comment '头像图片距离顶部高度', headimg_left decimal(10, 2) default 0.00 not null comment '头像图片距离左侧长度', nickname_width decimal(10, 2) default 0.00 not null comment '昵称长度', nickname_height decimal(10, 2) default 0.00 not null comment '昵称高度', nickname_top decimal(10, 2) default 0.00 not null comment '昵称距离顶部高度', nickname_left decimal(10, 2) default 0.00 not null comment '昵称距离左侧长度', qrcode_width decimal(10, 2) default 0.00 not null comment '二维码长度', qrcode_height decimal(10, 2) default 0.00 not null comment '二维码高度', qrcode_top decimal(10, 2) default 0.00 not null comment '二维码距离顶部高度', qrcode_left decimal(10, 2) default 0.00 not null comment '二维码距离左侧长度', visit_num int default 0 not null comment '访客数量', order_num int default 0 not null comment '订单数量', fission_level int default 0 not null comment '裂变等级', pv_num int default 0 not null comment '访问数量', type varchar(255) default 'goods' not null comment '类型,goods:商品,friend_fission:好友裂变', create_time int default 0 not null ) comment '海报表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_poster on lucky_poster (site_id, type); create table if not exists lucky_poster_muban ( muban_id int(11) unsigned auto_increment primary key, qrcode_width decimal default 0 not null, qrcode_height decimal default 0 not null, qrcode_top decimal default 0 not null, qrcode_left decimal default 0 not null, template_json text null, background varchar(255) default '' not null, template_type varchar(255) default '' not null comment '模板类型', qrcode_type varchar(255) default '' not null comment '二维码类型' ) charset = utf8 avg_row_length = 5461 row_format = DYNAMIC; create table if not exists lucky_poster_record ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '会员id', poster_id int default 0 not null comment '海报id', relation_id int default 0 not null comment '关联id', from_type varchar(255) default '' not null comment '来源类型,visit:访客,order:订单', year int default 0 not null comment '年', month int default 0 not null comment '月', day int default 0 not null comment '日', create_time int default 0 not null comment '创建时间' ) comment '海报访问记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_poster_template ( template_id int auto_increment primary key, site_id int default 0 not null comment '站点id', poster_name varchar(50) default '' not null comment '海报名称', background varchar(255) default '' not null comment '海报背景', qrcode_type varchar(255) default 'qrcode' not null comment '带参二维码,常规二维码', qrcode_width decimal(10, 2) default 0.00 not null comment '二维码长度', qrcode_height decimal(10, 2) default 0.00 not null comment '二维码高度', qrcode_top decimal(10, 2) default 0.00 not null comment '二维码距离顶部高度', qrcode_left decimal(10, 2) default 0.00 not null comment '二维码距离左侧长度', template_status int default 1 not null comment '模板状态 0-关闭 1-开启', template_type varchar(25) default '' not null comment '模板类型 goods:商品海报', template_json text null comment '拓展json', create_time int default 0 not null ) comment '海报模板表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_printer ( printer_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', brand varchar(255) default '' not null comment '小票打印机品牌(365 飞鹤 易联云)', printer_name varchar(255) default '' not null comment '打印机名称', printer_code varchar(255) default '' not null comment '打印机编号', printer_key varchar(255) default '' not null comment '打印机秘钥', open_id varchar(255) default '' not null comment '开发者id', apikey varchar(255) default '' not null comment '开发者密钥', print_num tinyint default 1 not null comment '打印张数', template_id int default 0 not null comment '模板id', store_id int default 0 not null comment '门店id', create_time int default 0 not null, update_time int default 0 not null, manual_open int default 1 not null comment '手动打印开启', order_pay_open int default 1 not null comment '订单支付打印开启', order_pay_template_id int default 0 not null comment '订单支付打印模板', order_pay_print_num int default 1 not null comment '订单支付打印张数', order_pay_order_type varchar(255) default '' not null comment '订单支付打印订单类型', take_delivery_open int default 1 not null comment '订单收货打印开启', take_delivery_template_id int default 0 not null comment '订单收货打印模板', take_delivery_print_num int default 1 not null comment '订单收货打印张数', take_delivery_order_type varchar(255) default '' not null comment '订单收货打印订单类型', recharge_open int default 1 not null comment '充值打印开启', recharge_template_id int default 0 not null comment '充值打印模板', recharge_print_num int default 1 not null comment '充值打印张数', change_shifts_open int default 1 not null comment '收银开单打印开启', change_shifts_template_id int default 0 not null comment '收银开单打印模板', change_shifts_print_num int default 1 not null comment '收银开单打印张数', printer_type varchar(10) default 'cloud' not null comment '打印机类型 cloud 云打印机 local 本地打印机 network 网络打印机', host varchar(255) default '' not null, ip varchar(255) default '' not null, port varchar(255) default '' not null, print_width varchar(20) default '58mm' not null comment '打印宽度' ) comment '小票打印机' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_printer_template ( template_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', site_name varchar(255) default '' not null comment '站点名', template_type varchar(255) default '' not null comment '模板类型(预留字段)', template_name varchar(255) default '' not null comment '模板名称', title varchar(255) default '' not null comment '小票名称', head tinyint default 0 not null comment '头部内容', buy_notes tinyint default 0 not null comment '买家留言(0否 1是)', seller_notes tinyint default 0 not null comment '卖家留言(0否 1是)', buy_name tinyint default 0 not null comment '买家姓名', buy_mobile tinyint default 0 not null comment '买家联系电话', buy_address tinyint default 0 not null comment '买家地址', shop_mobile tinyint default 0 not null comment '商家联系电话', shop_address tinyint default 0 not null comment '商家地址', shop_qrcode tinyint default 0 not null comment '商家二维码', qrcode_url varchar(255) default '' not null comment '二维码链接', bottom varchar(255) default '' not null comment '底部内容', create_time int default 0 not null, update_time int default 0 not null, type varchar(50) default '' not null comment '模板类型', type_name varchar(50) default '' not null comment '模板类型名称', goods_price_show int default 0 not null comment '商品金额是否展示', goods_code_show int default 1 not null comment '商品编码是否展示', goods_price_type varchar(50) default 'price' not null comment '商品金额 price-售价,order_price-实付价', form_show int default 1 not null comment '是否显示表单' ) comment '打印机模板' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_bale ( bale_id int auto_increment primary key, site_id int default 0 not null comment '站点id', name varchar(50) default '' not null comment '活动名称', num int default 0 not null comment '数量', price decimal(19, 2) default 0.00 not null comment '一口价', goods_ids varchar(2500) default '' not null, sku_ids varchar(2500) default '' not null comment '参与活动的sku', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', shipping_fee_type tinyint default 0 not null comment '是否包邮(0卖家承担运费 1买家承担运费)', status int default 0 not null comment '状态 0未开始 1进行中 2已关闭', create_time int default 0 not null comment '创建时间' ) comment '打包一口价' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_bargain ( bargain_id int(11) unsigned auto_increment comment '砍价id' primary key, site_id int default 0 not null comment '店铺id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment 'sku_id', bargain_name varchar(50) default '' not null comment '砍价活动名称', is_fenxiao tinyint default 0 not null comment '是否参与分销(0不参与 1参与)', buy_type tinyint default 0 not null comment '购买方式(0任意金额可购买 1砍到指定价格)', bargain_type tinyint default 0 not null comment '砍价金额类型(0固定金额 1随机金额)', bargain_num int default 0 not null comment '帮砍价人数', bargain_time int default 1 not null comment '砍价有效期(小时)', remark text null comment '活动规则说明', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', status tinyint default 0 not null comment '状态(0未开始 1活动进行中 2活动已结束 3失效 4删除)', status_name varchar(20) default '' not null comment '状态名称', is_own tinyint default 0 not null comment '是否自己砍价(0不支持 1支持)', sale_num int default 0 not null comment '销量', join_num int default 0 not null comment '参与人数', bargain_stock int default 0 not null comment '砍价总库存', floor_price decimal(10, 2) default 0.00 not null comment '底价', is_differ_new_user tinyint default 0 not null comment '是否区分新老用户', distinguish tinyint default 1 not null comment '新用户区分标准', new_low decimal(10, 2) default 0.00 not null comment '新用户最低随机金额', aged_tall decimal(10, 2) default 0.00 not null comment '老用户最高随机金额', aged_fixation decimal(10, 2) default 0.00 not null comment '老用户固定砍价金额', bargain_max_num int default 0 not null comment '最大砍价人数', help_bargain_num int default 0 not null comment '帮助砍价人数', browse_num int default 0 not null comment '浏览人数', share_num int default 0 not null comment '分享人数' ) comment '砍价活动表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_bargain_end_time on lucky_promotion_bargain (end_time); create index IDX_ns_promotion_bargain_start_time on lucky_promotion_bargain (start_time); create table if not exists lucky_promotion_bargain_goods ( id int(11) unsigned auto_increment comment 'id' primary key, site_id int default 0 not null comment '店铺id', bargain_id int default 0 not null comment '砍价id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment 'sku商品id', first_bargain_price decimal(10, 2) default 0.00 not null comment '首刀金额', bargain_stock int default 0 not null comment '砍价库存', floor_price decimal(10, 2) default 0.00 not null comment '底价', bargain_name varchar(50) default '' not null comment '砍价活动名称', is_fenxiao tinyint default 0 not null comment '是否参与分销(0不参与 1参与)', buy_type tinyint default 0 not null comment '购买方式(0任意金额可购买 1砍到指定价格)', bargain_type tinyint default 0 not null comment '砍价金额类型(0固定金额 1随机金额)', bargain_num int default 0 not null comment '帮砍价人数', bargain_time int default 1 not null comment '砍价有效期', remark text null comment '活动规则说明', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', status tinyint default 0 not null comment '状态(0未开始 1活动进行中 2活动已结束 3已关闭)', status_name varchar(20) default '' not null comment '状态名称', is_own tinyint default 0 not null comment '是否自己砍价(0不支持 1支持)', sale_num int default 0 not null comment '销量', join_num int default 0 not null comment '参与人数', is_differ_new_user tinyint default 0 not null comment '是否区分新老用户', distinguish tinyint default 1 not null comment '新用户区分标准', new_low decimal(10, 2) default 0.00 not null comment '新用户最低随机金额', aged_tall decimal(10, 2) default 0.00 not null comment '老用户最高随机金额', aged_fixation decimal(10, 2) default 0.00 not null comment '老用户固定砍价金额', bargain_max_num int default 0 not null comment '最大砍价人数', help_bargain_num int default 0 not null comment '帮助砍价人数' ) comment '砍价活动表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_bargain_goods_bargain_id on lucky_promotion_bargain_goods (bargain_id); create index IDX_ns_promotion_bargain_goods_goods_id on lucky_promotion_bargain_goods (goods_id); create index IDX_ns_promotion_bargain_goods_is_own on lucky_promotion_bargain_goods (is_own); create index IDX_ns_promotion_bargain_goods_sku_id on lucky_promotion_bargain_goods (sku_id); create index IDX_ns_promotion_bargain_goods_status on lucky_promotion_bargain_goods (status); create table if not exists lucky_promotion_bargain_launch ( launch_id int auto_increment primary key, bargain_id int default 0 not null comment '砍价活动id', sku_id int default 0 not null comment '商品sku_id', goods_id int default 0 not null comment '商品id', site_id int default 0 not null comment '站点id', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(255) default '' not null comment '商品图', price decimal(10, 2) default 0.00 not null comment '商品原价', floor_price decimal(10, 2) default 0.00 not null comment '底价', buy_type int default 0 not null comment '购买方式(0任意金额可购买 1砍到指定价格)', bargain_type int default 0 not null comment '砍价金额类型(0固定金额 1随机金额)', need_num int default 0 not null comment '帮砍人数需达到数', curr_num int default 0 not null comment '当前已帮砍人数', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', status int default 0 not null comment '0砍价中 1已成功 2未成功', member_id int default 0 not null comment '砍价发起用户', nickname varchar(255) default '' not null comment '昵称', headimg varchar(255) default '' not null comment '头像', is_fenxiao int default 0 not null comment '是否参与分销(0不参与 1参与)', order_id int default 0 not null comment '订单id', first_bargain_price decimal(10, 2) default 0.00 not null comment '首刀金额', curr_price decimal(10, 2) default 0.00 not null comment '当前金额', is_own int default 0 not null comment '是否自己砍价(0不支持 1支持)', is_differ_new_user tinyint default 0 not null comment '是否区分新老用户', distinguish tinyint default 1 not null comment '新用户区分标准', new_low decimal(10, 2) default 0.00 not null comment '新用户最低随机金额', aged_tall decimal(10, 2) default 0.00 not null comment '老用户最高随机金额', aged_fixation decimal(10, 2) default 0.00 not null comment '老用户固定砍价金额', store_id int default 0 not null comment '门店id' ) comment '砍价发起表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_bargain_launch_bargain_id on lucky_promotion_bargain_launch (bargain_id); create index IDX_ns_promotion_bargain_launch_end_time on lucky_promotion_bargain_launch (end_time); create index IDX_ns_promotion_bargain_launch_goods_id on lucky_promotion_bargain_launch (goods_id); create index IDX_ns_promotion_bargain_launch_site_id on lucky_promotion_bargain_launch (site_id); create index IDX_ns_promotion_bargain_launch_sku_id on lucky_promotion_bargain_launch (sku_id); create index IDX_ns_promotion_bargain_launch_start_time on lucky_promotion_bargain_launch (start_time); create table if not exists lucky_promotion_bargain_record ( id int auto_increment primary key, launch_id int default 0 not null comment '砍价发起id', member_id int default 0 not null comment '帮砍会员id', nickname varchar(255) default '' not null comment '昵称', headimg varchar(255) default '' not null comment '头像', money decimal(10, 2) default 0.00 not null comment '帮砍金额', bargain_time int default 0 not null comment '帮砍时间' ) charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_bargain_record_bargain_time on lucky_promotion_bargain_record (bargain_time); create index IDX_ns_promotion_bargain_record_launch_id on lucky_promotion_bargain_record (launch_id); create index IDX_ns_promotion_bargain_record_member_id on lucky_promotion_bargain_record (member_id); create table if not exists lucky_promotion_birthdaygift ( id int auto_increment primary key, activity_name varchar(255) default '' not null comment '活动名称', activity_time_type int default 1 not null comment '活动时间(1生日当天2生日当周3生日当月)', level_id varchar(255) default '' not null comment '参与活动会员等级(0全体会员)', level_name varchar(255) default '' not null comment '等级名称', type varchar(255) default '' not null comment '奖励类型', point int default 0 not null comment '积分', balance decimal(10, 2) default 0.00 not null comment '余额', coupon varchar(255) default '' not null comment '优惠券ID 以逗号隔开', blessing_content varchar(255) default '' not null comment '祝福语', site_id int default 0 not null, create_time int default 0 not null, update_time int default 0 not null, status int default 0 not null comment '1进行中-1已结束', is_delete int default 0 not null comment '是否删除', balance_type int default 0 not null comment '0不可提现 1可提现', balance_money decimal default 0 not null comment '可提现', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_birthdaygift_record ( record_id int auto_increment primary key, member_id int default 0 not null comment '会员id', member_name varchar(255) default '' not null comment '会员名称', activity_id int default 0 not null comment '生日有礼活动id', receive_time int default 0 not null comment '领取时间' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_bundling ( bl_id int auto_increment comment '组合ID' primary key, bl_name varchar(50) default '' not null comment '组合名称', site_id int default 0 not null comment '站点id', site_name varchar(100) default '' not null comment '站点名称', bl_price decimal(10, 2) default 0.00 not null comment '商品组合价格', goods_money decimal(10, 2) default 0.00 not null comment '商品总价', shipping_fee_type tinyint default 1 not null comment '运费承担方式 1卖家承担运费 2买家承担运费', status tinyint default 1 not null comment '组合状态 0-关闭/1-开启', update_time int default 0 not null comment '创建时间' ) comment '组合套餐活动表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_bundling_site_id on lucky_promotion_bundling (site_id); create index IDX_ns_promotion_bundling_status on lucky_promotion_bundling (status); create table if not exists lucky_promotion_bundling_goods ( id int auto_increment comment '主键' primary key, bl_id int default 0 not null comment '组合id', sku_id int default 0 not null comment '商品skuid', sku_name varchar(255) default '' not null comment '商品名称', price decimal(10, 2) default 0.00 not null comment '商品sku原价', sku_image varchar(1000) default '' not null comment 'sku图片', promotion_price decimal(10, 2) default 0.00 not null comment '套餐价格', site_id int default 0 not null ) comment '组合套餐活动商品表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_bundling_goods_bl_id on lucky_promotion_bundling_goods (bl_id); create index IDX_ns_promotion_bundling_goods_site_id on lucky_promotion_bundling_goods (site_id); create index IDX_ns_promotion_bundling_goods_sku_id on lucky_promotion_bundling_goods (sku_id); create table if not exists lucky_promotion_consume_record ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', type varchar(255) default '' not null comment '赠送类型 point-积分 growth-成长值 coupon-优惠券', value int default 0 not null comment '所送内容', order_id int default 0 not null comment '订单id', member_id int default 0 not null, remark varchar(255) default '' not null comment '备注(优惠券)', config varchar(5000) default '' not null comment '配置', create_time int default 0 not null, is_recycled int default 0 not null comment '奖励是否已回收', out_trade_no varchar(255) default '' not null comment '支付流水号' ) comment '消费奖励记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_coupon ( coupon_id int(11) unsigned auto_increment comment '优惠券id' primary key, type varchar(255) default '' not null comment '优惠券类型 reward-满减 discount-折扣 random-随机', coupon_name varchar(50) default '' not null comment '优惠券名称', coupon_type_id int default 0 not null comment '优惠券类型id', site_id int default 0 not null comment '站点Id', coupon_code varchar(255) default '' not null comment '优惠券编码', member_id int default 0 not null comment '领用人', use_order_id int default 0 not null comment '优惠券使用订单id', goods_type tinyint default 0 not null comment '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用', goods_ids varchar(2000) default '' not null comment '适用商品id', at_least decimal(10, 2) default 0.00 not null comment '最小金额', money decimal(10, 2) default 0.00 not null comment '面额', discount decimal(10, 2) default 0.00 not null comment '1 =< 折扣 <= 9.9 当type为discount时需要添加', discount_limit decimal(10, 2) default 0.00 not null comment '最多折扣金额 当type为discount时可选择性添加', is_mark tinyint default 0 not null comment '是否同时给会员打标签 0-否 1-是', member_label_ids varchar(255) default '' not null comment '会员标签id', is_share tinyint default 0 not null comment '分享设置 优惠券允许分享给好友领取', is_handsel tinyint default 0 not null comment '转赠设置 优惠券允许转赠给好友', is_forbid_preference tinyint default 0 not null comment '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用', is_expire_notice tinyint default 0 not null comment '是否开启过期提醒0-不开启 1-开启', expire_notice_fixed_term int default 0 not null comment '过期前N天提醒', is_noticed tinyint default 0 not null comment '是否已提醒', state tinyint default 0 not null comment '优惠券状态 1已领用(未使用) 2已使用 3已过期 4已关闭', get_type tinyint default 0 not null comment '获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取', related_id int default 0 not null comment '获取优惠券的关联id', fetch_time int default 0 not null comment '领取时间', use_time int default 0 not null comment '使用时间', start_time int default 0 not null comment '可使用的开始时间', end_time int default 0 not null comment '有效期结束时间', merch_id int default 0 not null comment '商户id' ) comment '优惠券表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_coupon_coupon_type_id on lucky_promotion_coupon (coupon_type_id); create index IDX_ns_promotion_coupon_end_time on lucky_promotion_coupon (end_time); create index IDX_ns_promotion_coupon_member_id on lucky_promotion_coupon (member_id); create index IDX_ns_promotion_coupon_site_id on lucky_promotion_coupon (site_id); create table if not exists lucky_promotion_coupon_type ( coupon_type_id int auto_increment comment '优惠券类型Id' primary key, type varchar(32) default '' not null comment '优惠券类型 reward-满减 discount-折扣 random-随机', site_id int default 1 not null comment '站点id', coupon_name varchar(50) default '' not null comment '优惠券名称', coupon_name_remark varchar(255) default '' not null comment '名称备注', image varchar(255) default '' not null comment '优惠券图片', count int default 0 not null comment '发放数量', lead_count int default 0 not null comment '已领取数量', used_count int default 0 not null comment '已使用数量', goods_type tinyint(4) unsigned default 1 not null comment '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用', goods_ids varchar(2000) default '' not null comment '适用商品id', is_limit tinyint default 0 not null comment '使用门槛0-无门槛 1-有门槛', at_least decimal(10, 2) default 0.00 not null comment '满多少元使用 0代表无限制', money decimal(10, 2) default 0.00 not null comment '发放面额 当type为reward时需要添加', discount decimal(10, 2) default 0.00 not null comment '1 =< 折扣 <= 9.9 当type为discount时需要添加', discount_limit decimal(10, 2) default 0.00 not null comment '最多折扣金额 当type为discount时可选择性添加', min_money decimal(10, 2) default 0.00 not null comment '最低金额 当type为random时需要添加', max_money decimal(10, 2) default 0.00 not null comment '最大金额 当type为random时需要添加', validity_type tinyint default 0 not null comment '过期类型0-古固定时间范围过期 1-领取之日固定日期后过期 2长期有效', start_use_time int default 0 not null comment '使用开始日期 过期类型0时必填', end_use_time int default 0 not null comment '使用结束日期 过期类型0时必填', fixed_term int default 0 not null comment '当validity_type为1时需要添加 领取之日起或者次日N天内有效', is_limit_member tinyint default 0 not null comment '是否限制会员身份0-不限制 1限制', member_level_ids varchar(255) default '' not null comment '若开启会员身份限制,需要添加会员等级id', sort int default 0 not null comment '排序', is_limitless tinyint default 0 not null comment '是否无限制0-否 1是', max_fetch int default 0 not null comment '每人最大领取个数', is_expire_notice tinyint default 0 not null comment '是否开启过期提醒0-不开启 1-开启', expire_notice_fixed_term int default 0 not null comment '过期前N天提醒', is_mark tinyint default 0 not null comment '是否同时给会员打标签 0-否 1-是', member_label_ids varchar(255) default '' not null comment '会员标签id', is_share tinyint default 0 not null comment '分享设置 优惠券允许分享给好友领取', is_handsel tinyint default 0 not null comment '转赠设置 优惠券允许转赠给好友', is_forbid_preference tinyint default 0 not null comment '优惠叠加 0-不限制 1- 优惠券仅原价购买商品时可用', is_show int default 0 not null comment '是否显示', discount_order_money decimal(10, 2) default 0.00 not null comment '订单的优惠总金额', order_money decimal(10, 2) default 0.00 not null comment '用券总成交额', is_forbidden tinyint default 0 not null comment '是否禁止发放0-否 1-是', old_member_num int default 0 not null comment '使用优惠券的老会员数', new_member_num int default 0 not null comment '平台第一次购买使用优惠券的会员数', order_goods_num int default 0 not null comment '使用优惠券购买的商品数量', status int default 0 not null comment '状态(1进行中2已结束-1已关闭)', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '修改时间', end_time int default 0 not null comment '有效日期结束时间', promotion_type int default 0 not null comment '发布类型 0为普通优惠券 1为瓜分优惠券', promotion_name varchar(64) default '' not null comment '发布插件名称', merch_id int default 0 not null comment '商户id' ) comment '优惠券类型表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_coupon_type_site_id on lucky_promotion_coupon_type (site_id); create table if not exists lucky_promotion_discount ( discount_id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 1 not null comment '站点id', site_name varchar(255) default '' not null comment '站点名称', discount_name varchar(255) default '' not null comment '活动名称', status tinyint default 0 not null comment '活动状态 0未开始 1进行中 2已结束 -1已关闭(手动)', remark varchar(1000) default '' not null comment '备注', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', goods_id int default 0 not null comment '商品id', discount_price decimal(10, 2) default 0.00 not null comment '折扣金额,只做展示' ) comment '限时折扣' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_discount_end_time on lucky_promotion_discount (end_time); create index IDX_ns_promotion_discount_start_time on lucky_promotion_discount (start_time); create index IDX_ns_promotion_discount_status on lucky_promotion_discount (status); create table if not exists lucky_promotion_discount_goods ( id int(11) unsigned auto_increment comment '主键' primary key, discount_id int default 0 not null comment '对应活动Id', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment 'skuId', price decimal(10, 2) default 0.00 not null comment '商品价格', discount_price decimal(10, 2) default 0.00 not null comment '折扣价', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(1000) default '' not null comment '商品图片' ) comment '限时折扣商品列表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_discount_goods_discount_id on lucky_promotion_discount_goods (discount_id); create index IDX_ns_promotion_discount_goods_end_time on lucky_promotion_discount_goods (end_time); create index IDX_ns_promotion_discount_goods_goods_id on lucky_promotion_discount_goods (goods_id); create index IDX_ns_promotion_discount_goods_sku_id on lucky_promotion_discount_goods (sku_id); create index IDX_ns_promotion_discount_goods_start_time on lucky_promotion_discount_goods (start_time); create table if not exists lucky_promotion_exchange ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment ' 站点id', type int default 1 not null comment '兑换形式', type_name varchar(255) default '' not null comment '兑换类型名称', type_id int default 0 not null comment '关联id', name varchar(255) default '' not null comment '兑换名称', image varchar(255) default '' not null comment '图片', stock int default 0 not null comment '当前库存', pay_type tinyint default 0 not null comment '支付类型(0积分 1积分加钱)', point int default 0 not null comment '积分数', market_price decimal(10, 2) default 0.00 not null comment '市场价', price decimal(10, 2) default 0.00 not null comment '兑换价', limit_num int default 0 not null comment '限制兑换数量', balance decimal(10, 2) default 0.00 not null comment '余额红包(余额有效)', state int default 1 not null comment '状态(上下架)', content text null comment '兑换说明', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', sort int default 0 not null comment '排序', exchange_goods_id int default 0 not null, delivery_price decimal(10, 2) default 0.00 not null comment '物流费用(礼品有效)', delivery_type tinyint default 1 not null comment '运费类型( 0 固定运费 1运费模板 2按照商品)', shipping_template int default 0 not null comment '运费模板', is_free_shipping tinyint default 1 not null comment '是否免邮(0不免邮 1免邮)', rule text null comment '商品兑换规则' ) comment '积分兑换' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_exchange_site_id on lucky_promotion_exchange (site_id); create index IDX_ns_promotion_exchange_state on lucky_promotion_exchange (state); create index IDX_ns_promotion_exchange_type on lucky_promotion_exchange (type); create index IDX_ns_promotion_exchange_type_id on lucky_promotion_exchange (type_id); create table if not exists lucky_promotion_exchange_goods ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment ' 站点id', type int default 1 not null comment '兑换形式', type_name varchar(255) default '' not null comment '兑换类型名称', type_id int default 0 not null comment '关联id', name varchar(255) default '' not null comment '兑换名称', image varchar(255) default '' not null comment '图片', point int default 0 not null comment '积分数', price decimal(10, 2) default 0.00 not null comment '兑换价', balance decimal(10, 2) default 0.00 not null comment '余额红包(余额有效)', state int default 1 not null comment '状态(上下架)', content text null comment '兑换说明', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', sort int default 0 not null comment '排序', pay_type int default 0 not null comment '兑换类型 0-积分 1-积分+余额', delivery_price decimal(10, 2) default 0.00 not null comment '物流费用(礼品有效)', rule text null comment '兑换规则' ) comment '积分兑换(主表)' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_exchange_site_id on lucky_promotion_exchange_goods (site_id); create index IDX_ns_promotion_exchange_state on lucky_promotion_exchange_goods (state); create index IDX_ns_promotion_exchange_type on lucky_promotion_exchange_goods (type); create index IDX_ns_promotion_exchange_type_id on lucky_promotion_exchange_goods (type_id); create table if not exists lucky_promotion_exchange_order ( order_id int(11) unsigned auto_increment primary key, order_no varchar(255) default '' not null comment '订单编号', member_id int default 0 not null comment '对应会员', out_trade_no varchar(255) default '' not null comment '支付流水号(线上支付有效)', point int default 0 not null comment '兑换积分数', exchange_price decimal(10, 2) default 0.00 not null comment '兑换价格', delivery_price decimal(10, 2) default 0.00 not null comment '邮费', price decimal(10, 2) default 0.00 not null comment '实际应付金额', express_no varchar(255) default '' not null comment '物流单号(礼品发货)', create_time int default 0 not null comment '创建时间', pay_time int default 0 not null comment '兑换成功时间', exchange_id int default 0 not null comment '兑换商品id', exchange_name varchar(255) default '' not null comment '兑换商品名称', exchange_image varchar(255) default '' not null comment '兑换商品图片', num int default 0 not null comment '兑换数量', order_status int default 0 not null comment '状态', type int default 0 not null comment '类型', type_name varchar(255) default '' not null comment '类型名称', name varchar(255) default '' not null comment '姓名', mobile varchar(255) default '' not null comment '手机号', telephone varchar(255) default '' not null comment '电话', province_id int default 0 not null comment '省id', city_id int default 0 not null comment '市id', district_id int default 0 not null comment '区县id', community_id int default 0 not null comment '社区id', address varchar(255) default '' not null comment '地址信息', full_address varchar(255) default '' not null comment '详细地址信息', longitude varchar(50) default '' not null comment '经度', latitude varchar(50) default '' not null comment '纬度', buyer_message varchar(255) default '' not null comment '买家留言', order_from varchar(255) default '' not null comment '订单来源', order_from_name varchar(255) default '' not null comment '订单来源名称', type_id int default 0 not null comment '关联id', balance decimal(10, 2) default 0.00 not null comment '赠送红包', site_id int default 0 not null, delivery_type varchar(255) default '' not null comment '物流类型', delivery_type_name varchar(255) default '' not null comment '配送方式名称', delivery_status int default 0 not null comment '发货状态', delivery_status_name varchar(255) default '' not null comment '发货状态名称', delivery_code varchar(255) default '' not null comment '配送单号', delivery_store_id int default 0 not null comment '门店id', delivery_store_name varchar(255) default '' not null comment '门店名称', delivery_store_info varchar(2000) default '' not null comment '门店信息', buyer_ask_delivery_time varchar(255) default '' not null comment '到达时间', relate_order_id int default 0 not null comment '关联订单', exchange_goods_id int default 0 not null comment '积分兑换主表', order_money decimal(10, 2) default 0.00 not null comment '订单金额', delivery_start_time int not null comment '配送开始时间', delivery_end_time int not null comment '配送结束时间' ) comment '积分兑换订单' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_exchange_order on lucky_promotion_exchange_order (member_id, order_status); create index IDX_ns_promotion_exchange_order_relate_order_id on lucky_promotion_exchange_order (relate_order_id); create table if not exists lucky_promotion_festival ( festival_id int auto_increment primary key, activity_name varchar(255) default '' not null comment '活动名', site_id int default 0 not null, festival_name varchar(255) default '' not null comment '节日名', festival_type varchar(30) default '1' not null comment '活动类型(插件名称)', festival_type_name varchar(255) default '' not null comment '活动类型名称', level_id varchar(255) default '' not null comment '参与的会员等级0表示全部参与', level_name varchar(255) default '' not null comment '参与活动会员名称', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '结束时间', status int default 0 not null comment '活动状态 0未开始 1已开始 2已结束 3已关闭', push_time int default 0 not null comment '活动推送时间', remark varchar(1000) default '' not null comment '说明', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '更新时间', join_time int default 0 not null comment '0自定义节日 1传统节日', join_type int default 0 not null comment '1活动时间内 0活动开始前', join_frequency int default 0 not null comment '天数' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_festival_award ( award_id int auto_increment primary key, site_id int default 0 not null, festival_id int default 0 not null, award_type varchar(255) default '' not null comment '奖品类型 以逗号分割', coupon varchar(255) default '' not null comment '关联id(根据奖品类型)', point int default 0 not null comment '积分数', balance decimal(10, 2) default 0.00 not null comment '余额', award_num int default 0 not null comment '奖品数量', remaining_num int default 0 not null comment '剩余数量', receive_num int default 0 not null comment '已领取数量', balance_type int default 0 not null comment '0不可提现 1可提现', balance_money decimal(10, 2) default 0.00 not null comment '可提现' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_festival_draw_record ( record_id int auto_increment primary key, site_id int default 0 not null, festival_id int default 0 not null comment '活动id', festival_type varchar(30) default '' not null comment '活动类型(插件名称)', member_id int default 0 not null comment '会员id', member_nick_name varchar(255) default '' not null comment '会员昵称', award_id int default 0 not null comment '奖品id', receive_time int default 0 not null comment '领取时间' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_freeshipping ( freeshipping_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', price decimal(10, 2) default 0.00 not null comment '金额', area_ids text null comment '地区ids', area_names text null comment '地区名称', surplus_area_ids text null, create_time int default 0 not null, update_time int default 0 not null, merch_id int default 0 not null comment '商户id' ) comment '满额包邮' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_friends_coupon ( coupon_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点Id', coupon_type_id int default 0 not null comment '优惠券类型Id', name varchar(64) default '' not null comment '活动名称', goods_type int default 1 not null comment '适用商品类型1-全部商品可用;2-指定商品可用;3-指定商品不可用', goods_ids varchar(2500) default '' not null comment '商品Id', image varchar(255) default '' not null comment '优惠券图片', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', status int default 0 not null comment '状态 0未开始 1进行中 2已结束 -1已关闭', status_name varchar(64) default '' not null comment '状态名称', count int default 0 not null comment '发放总量', inventory int default 0 null comment '优惠券库存', success_count int default 0 not null comment '瓜分成功的优惠券数量', money decimal(10, 2) default 0.00 not null comment '优惠券瓜分金额', divide_num int default 0 not null comment '瓜分人数', validity_type int default 1 not null comment '过期类型0-固定时间1领取之日起', start_use_time int default 0 not null comment '使用开始日期 过期类型1时必填', end_use_time int default 0 not null comment '使用结束日期 过期类型1时必填', fixed_term int default 0 not null comment '当validity_type为2或者3时需要添加 领取之日起或者次日N天内有效', divide_type int default 0 not null comment '瓜分方式(0固定金额 1随机金额)', is_simulation int default 0 not null comment '是否模拟好友 0否 1是', remark varchar(255) default '' not null comment '活动规则说明', divide_time int default 1 not null comment '瓜分有效期(小时)', is_limit int default 0 not null comment '使用门槛 0无门槛 1 有门槛', at_least decimal(10, 2) default 0.00 not null comment '满多少元使用 0代表无限制', is_new int default 0 not null comment '仅新人参与限制 0否 1是', validity_end_time int default 0 not null comment '使用券有效期结束时间', create_time int default 0 not null comment '创建时间' ) comment '好友瓜分券活动表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_friends_coupon_group ( group_id int(11) unsigned auto_increment primary key, promotion_id int default 0 not null comment '活动Id', coupon_type_id int default 0 not null comment '优惠券类型Id', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', header_id int default 0 not null comment '发起人Id', member_ids varchar(255) default '' not null comment '参与人id', coupon_ids varchar(255) default '' not null comment '优惠券组Id', group_member_ids varchar(255) default '' not null comment '组中人id(发放券的人)', num int default 0 not null comment '参与数量', status int default 0 not null comment '状态 0进行中 1瓜分成功 2瓜分失败', is_look int default 0 not null comment '查看区分(瓜分失败后 0是重新组队 1是去查看)', site_id int default 0 not null ) comment '好友瓜分券参与活动组' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_games ( game_id int(11) unsigned auto_increment comment '游戏id' primary key, site_id int default 0 not null comment '站点id', game_name varchar(255) default '' not null comment '游戏活动名称', game_type varchar(30) default '1' not null comment '游戏类型(插件名称)', game_type_name varchar(255) default '' not null comment '游戏类型名称', level_id varchar(255) default '' not null comment '参与的会员等级0表示全部参与', level_name varchar(255) default '' not null comment '参与活动会员名称', points int default 0 not null comment '参与一次扣除积分', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', status int default 0 not null comment '活动状态 0未开始 1已开始 2已结束 3已关闭', remark varchar(1000) default '' not null comment '活动说明', winning_rate decimal(10, 2) default 0.00 not null comment '中奖率', no_winning_img varchar(255) default '' not null, no_winning_desc varchar(255) default '' not null comment '未中奖说明', is_show_winner int default 0 not null comment '中奖名单是否显示 0不显示 1显示', join_type int default 0 not null comment '参加类型 0活动全过程 1每天 (节日礼 0节日前某天 1节日当天)', join_frequency int default 1 not null comment '根据类型计算参加次数(节日礼的天数)', join_num int default 0 not null comment '抽奖人数', winning_num int default 0 not null comment '中奖人数', create_time int default 0 not null, update_time int default 0 not null, push_time int default 0 not null comment '节日有礼活动推送时间戳' ) comment '营销游戏(概率游戏)' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_games_end_time on lucky_promotion_games (end_time); create index IDX_ns_promotion_games_game_type on lucky_promotion_games (game_type); create index IDX_ns_promotion_games_site_id on lucky_promotion_games (site_id); create index IDX_ns_promotion_games_start_time on lucky_promotion_games (start_time); create index IDX_ns_promotion_games_status on lucky_promotion_games (status); create table if not exists lucky_promotion_games_award ( award_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', game_id int default 0 not null comment '游戏id', award_name varchar(255) default '' not null comment '奖品名称', award_img varchar(255) default '' not null comment '图片', award_type tinyint default 0 not null comment '奖品类型(1积分 2余额(不可提现) 3优惠券 4赠品)', relate_id int default 0 not null comment '关联id(根据奖品类型)', relate_name varchar(255) default '' not null comment '关联商品名称(优惠券或者赠品名称)', point int default 0 not null comment '积分数', balance decimal(10, 2) default 0.00 not null comment '余额', award_num int default 0 not null comment '奖品数量', award_winning_rate int default 0 not null comment '奖品中奖概率', remaining_num int default 0 not null comment '剩余数量', receive_num int default 0 not null comment '已领取数量', no_winning_img varchar(255) default '' not null comment '未中奖图片' ) comment '游戏奖品' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_games_draw_record ( record_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', game_id int default 0 not null comment '游戏id', game_type varchar(30) default '' not null comment '游戏类型(插件名称)', member_id int default 0 not null comment '会员id', member_nick_name varchar(255) default '' not null comment '会员昵称', points int default 0 not null comment '参与消耗积分', is_winning tinyint default 0 not null comment '是否中奖(0未中 1中奖)', award_id int default 0 not null comment '奖品id', award_name varchar(255) default '' not null comment '奖品名称', award_type tinyint default 0 not null comment '奖品类型(1积分 2余额(不可提现) 3优惠券 4赠品)', relate_id int default 0 not null comment '关联id(根据奖品类型)', relate_name varchar(255) default '' not null comment '关联商品名称(优惠券或者赠品名称)', is_receive tinyint default 0 not null comment '是否领取(0未领取 1领取)奖品为优惠券 赠品是使用', point int default 0 not null comment '奖励积分数', balance decimal(10, 2) default 0.00 not null comment '奖励余额', remark varchar(255) default '' not null comment '说明', create_time int default 0 not null comment '参与时间' ) comment '抽奖记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_groupbuy ( groupbuy_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '店铺ID', site_name varchar(255) default '' not null comment '店铺名称', goods_id int default 0 not null comment '商品ID', goods_name varchar(255) default '' not null comment '商品名称', goods_image varchar(1000) default '' not null comment '商品图片', is_virtual_goods tinyint default 0 not null comment '是否是虚拟商品(0否 1是)', goods_price decimal(10, 2) default 0.00 not null comment '商品原价', groupbuy_price decimal(10, 2) default 0.00 not null comment '团购价', buy_num int default 0 not null comment '最低购买量', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', sell_num int default 0 not null comment '已出售数量', status tinyint default 1 not null comment '状态(1未开始 2进行中 3已结束)', sku_id int default 0 not null comment '商品sku', rule text null comment '活动规则' ) comment '团购' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_groupbuy_end_time on lucky_promotion_groupbuy (end_time); create index IDX_ns_promotion_groupbuy_goods_id on lucky_promotion_groupbuy (goods_id); create index IDX_ns_promotion_groupbuy_site_id on lucky_promotion_groupbuy (site_id); create index IDX_ns_promotion_groupbuy_start_time on lucky_promotion_groupbuy (start_time); create index IDX_ns_promotion_groupbuy_status on lucky_promotion_groupbuy (status); create table if not exists lucky_promotion_hongbao ( hongbao_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点Id', name varchar(64) default '' not null comment '活动名称', image varchar(255) default '' not null comment '红包图片', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', status int default 0 not null comment '状态 0未开始 1进行中 2已结束 -1已关闭', status_name varchar(64) default '' not null comment '状态名称', count int default 0 not null comment '发放总量', inventory int default 0 null comment '红包库存', success_count int default 0 not null comment '瓜分成功的红包数量', money decimal(10, 2) default 0.00 not null comment '红包瓜分金额', divide_num int default 0 not null comment '瓜分人数', divide_type int default 0 not null comment '瓜分方式(0固定金额 1随机金额)', is_simulation int default 0 not null comment '是否模拟好友 0否 1是', remark varchar(255) default '' not null comment '活动规则说明', divide_time int default 1 not null comment '瓜分有效期(小时)', is_new int default 0 not null comment '仅新人参与限制 0否 1是', balance_set int default 1 not null comment '余额设置 1不可提现余额 2可提现余额', create_time int default 0 not null comment '创建时间' ) comment '红包裂变活动表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_hongbao_group ( group_id int(11) unsigned auto_increment primary key, hongbao_id int default 0 not null comment '活动Id', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '红包Id', header_id int default 0 not null comment '发起人Id', member_ids varchar(255) default '' not null comment '参与人id', balance_data varchar(255) default '' not null comment '瓜分的金额数(值与组Id对应)', group_member_ids varchar(255) default '' not null comment '组中人id(发放券的人)', num int default 0 not null comment '参与数量', status int default 0 not null comment '状态 0进行中 1瓜分成功 2瓜分失败', site_id int default 0 not null, is_look int default 0 not null comment '查看区分(瓜分失败后 0是重新组队 1是去查看)' ) comment '好友瓜分券参与活动组' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_jielong ( jielong_id int auto_increment comment '社群接龙活动ID' primary key, jielong_name varchar(255) default '' not null comment '接龙活动名称', site_id int default 0 not null comment '站点ID', goods_ids text not null comment '商品ID集'',''英文逗号分隔', start_time int default 0 not null comment '活动开始时间', end_time int default 0 not null comment '活动结束时间', status tinyint default 0 not null comment '活动状态 0未开始 1进行中 2已结束 3 手动关闭', status_name varchar(20) default '' not null comment '状态名称', is_delete tinyint default 0 not null comment '是否删除0未删除1已删除', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '更新时间', `desc` varchar(255) null comment '活动描述' ) comment '接龙活动表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_jielong_cart ( cart_id int auto_increment primary key, site_id int default 0 not null comment '站点id', member_id int default 0 not null comment '会员id', sku_id int default 0 not null comment 'sku_id', num int default 0 not null comment '数量', jielong_id int default 0 not null comment '接龙活动id' ) comment ' 购物车' charset = utf8 row_format = DYNAMIC; create index IDX_ns_goods_cart_member_id on lucky_promotion_jielong_cart (member_id); create table if not exists lucky_promotion_jielong_goods ( id int auto_increment comment '接龙活动商品表ID' primary key, jielong_id int default 0 not null comment '接龙活动表ID', site_id int default 0 not null comment '站点ID', goods_id int default 0 not null comment '商品id', sale_num int default 0 not null comment '销量' ) comment '接龙活动商品表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_jielong_order ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', site_name varchar(255) default '' not null comment '站点名称', jielong_id int default 0 not null comment '接龙活动id', order_no varchar(255) default '' not null comment '订单编号', order_from varchar(55) default '' not null comment '订单来源', order_from_name varchar(50) default '' not null comment '订单来源名称', order_type int default 0 not null comment '订单类型 1. 普通订单 2. 门店订单 3. 本地配送订单4. 虚拟订单', order_type_name varchar(50) default '' not null comment '订单类型名称', member_id int default 0 not null comment '购买人uid', name varchar(50) default '' not null comment '购买人姓名', mobile varchar(255) default '' not null comment '购买人手机', telephone varchar(255) default '' not null comment '购买人固定电话', province_id int default 0 not null comment '购买人省id', city_id int default 0 not null comment '购买人市id', district_id int default 0 not null comment '购买人区县id', community_id int default 0 not null comment '购买人社区id', address varchar(255) default '' not null comment '购买人地址', full_address varchar(255) default '' not null comment '购买人详细地址', longitude varchar(50) default '' not null comment '购买人地址经度', latitude varchar(50) default '' not null comment '购买人地址纬度', buyer_ip varchar(20) default '' not null comment '购买人ip', buyer_ask_delivery_time int default 0 not null comment '购买人要求配送时间', buyer_message varchar(50) default '' not null comment '购买人留言信息', num int default 0 not null comment '购买数量', goods_money decimal(10, 2) default 0.00 not null comment '商品总额', delivery_money decimal(10, 2) default 0.00 not null comment '配送金额', promotion_money decimal(10, 2) default 0.00 not null comment '订单优惠金额', coupon_id int default 0 not null comment '优惠券id', coupon_money decimal(10, 2) default 0.00 not null comment '优惠券金额', order_money decimal(10, 2) default 0.00 not null comment '订单金额', pay_time int default 0 not null comment '支付时间', pay_type varchar(55) default '' not null comment '支付方式', pay_type_name varchar(50) default '' not null comment '支付类型名称', order_status tinyint default 0 not null comment '订单状态', order_status_name varchar(255) default '' not null comment '状态名称', order_status_action varchar(1000) default '' not null comment '订单操作', delivery_type varchar(50) default '' not null comment '配送方式', delivery_type_name varchar(50) default '' not null comment '配送方式名称', close_time int default 0 not null comment '订单关闭时间', create_time int default 0 not null comment '订单创建时间', relate_order_id int default 0 not null comment '关联订单id' ) comment '接龙活动订单表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_manjian ( manjian_id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', manjian_name varchar(255) default '' not null comment '名称', manjian_type tinyint default 1 not null comment '1全部商品参与 2指定商品 3指定商品不参与', type int default 0 not null comment '条件类型 0:满N元 1:满N件', goods_ids text null comment '商品id集', status int default 0 not null comment '状态(0未开始1进行中2已结束-1已关闭)', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', rule_json varchar(2000) default '{}' not null comment '规则json', remark varchar(1000) default '' not null comment '备注', merch_id int default 0 not null comment '商户id' ) comment '满减活动' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_manjian_end_time on lucky_promotion_manjian (end_time); create index IDX_ns_promotion_manjian_manjian_type on lucky_promotion_manjian (manjian_type); create index IDX_ns_promotion_manjian_site_id on lucky_promotion_manjian (site_id); create index IDX_ns_promotion_manjian_start_time on lucky_promotion_manjian (start_time); create index IDX_ns_promotion_manjian_status on lucky_promotion_manjian (status); create index IDX_ns_promotion_manjian_type on lucky_promotion_manjian (type); create table if not exists lucky_promotion_manjian_goods ( id int(11) unsigned auto_increment primary key, manjian_id int default 0 not null comment '满减活动id', site_id int default 0 not null comment '站点id', goods_id int default 0 not null comment '商品id', manjian_type tinyint default 1 not null comment '1全部商品参与 2指定商品 3指定商品不参与', status tinyint default 0 not null comment '状态(0未开始1进行中2已结束-1已关闭)', rule_json varchar(2000) default '' not null comment '满减规则json', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间' ) comment '满减商品表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_manjian_goods_end_time on lucky_promotion_manjian_goods (end_time); create index IDX_ns_promotion_manjian_goods_goods_id on lucky_promotion_manjian_goods (goods_id); create index IDX_ns_promotion_manjian_goods_manjian_id on lucky_promotion_manjian_goods (manjian_id); create index IDX_ns_promotion_manjian_goods_manjian_type on lucky_promotion_manjian_goods (manjian_type); create index IDX_ns_promotion_manjian_goods_start_time on lucky_promotion_manjian_goods (start_time); create table if not exists lucky_promotion_mansong_record ( id int auto_increment primary key, manjian_id int default 0 not null comment '满减送活动id', site_id int default 0 not null comment '站点id', manjian_name varchar(255) default '' not null comment '满减送活动名称', point int default 0 not null comment '所送积分数', coupon varchar(255) default '' not null comment '所送优惠券', order_id int default 0 not null comment '订单id', member_id int default 0 not null, order_sku_ids varchar(255) default '' not null comment '满足条件的商品规格id', status int default 0 not null comment '0未发放 1已发放', coupon_num varchar(255) default '' not null comment '优惠券赠送数量' ) comment '满送记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_pinfan ( pintuan_id int(11) unsigned auto_increment comment '拼团id' primary key, site_id int default 0 not null comment '店铺id', site_name varchar(50) default '' not null comment '店铺名称', pintuan_name varchar(30) default '' not null comment '活动名称', goods_id int default 0 not null comment '商品id', is_virtual_goods tinyint default 0 not null comment '是否是虚拟商品(0否 1是)', pintuan_num int default 0 not null comment '参团人数', chengtuan_num int default 0 not null comment '实际成功人数', reward_type tinyint default 0 not null comment '拼团成功但是未发货奖励1消费余额2现金红包3优惠券4.积分', reward_type_num varchar(1000) default '' not null comment '奖励类型数量:余额积分数量,优惠券id组', pintuan_time int default 1 not null comment '拼团有效期', remark text null comment '活动规则', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', is_recommend int default 0 not null comment '是否推荐', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', buy_num int default 0 not null comment '拼团限制购买', pintuan_price decimal(10, 2) default 0.00 not null comment '拼团价', is_single_buy tinyint default 1 not null comment '是否单独购买', is_virtual_buy tinyint default 0 not null comment '是否虚拟成团', is_promotion tinyint default 0 not null comment '是否团长优惠', status tinyint default 0 not null comment '状态(0正常 1活动进行中 2活动已结束 3失效 4删除)', group_num int default 0 not null comment '开团组数', success_group_num int default 0 not null comment '成团组数', order_num int default 0 not null comment '购买人数' ) comment '拼团返现活动表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_pintuan_end_time on lucky_promotion_pinfan (end_time); create index IDX_ns_promotion_pintuan_goods_id on lucky_promotion_pinfan (goods_id); create index IDX_ns_promotion_pintuan_is_recommend on lucky_promotion_pinfan (is_recommend); create index IDX_ns_promotion_pintuan_site_id on lucky_promotion_pinfan (site_id); create index IDX_ns_promotion_pintuan_start_time on lucky_promotion_pinfan (start_time); create index IDX_ns_promotion_pintuan_status on lucky_promotion_pinfan (status); create table if not exists lucky_promotion_pinfan_goods ( id int(11) unsigned auto_increment comment '主键' primary key, pintuan_id int default 0 not null comment '拼团id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment 'skuid', pintuan_price decimal(10, 2) default 0.00 not null comment '拼团价', promotion_price decimal(10, 2) default 0.00 not null comment '团长优惠价', site_id int default 0 not null comment '站点id' ) comment '拼团返现商品表' charset = utf8 row_format = DYNAMIC; create index IDX_promotion_pintuan_goods_goods_id on lucky_promotion_pinfan_goods (goods_id); create index IDX_promotion_pintuan_goods_pintuan_id on lucky_promotion_pinfan_goods (pintuan_id); create index IDX_promotion_pintuan_goods_site_id on lucky_promotion_pinfan_goods (site_id); create index IDX_promotion_pintuan_goods_sku_id on lucky_promotion_pinfan_goods (sku_id); create table if not exists lucky_promotion_pinfan_group ( group_id int auto_increment comment '拼团分组id' primary key, site_id int default 0 not null comment '店铺id', goods_id int default 0 not null comment '商品id', is_virtual_goods tinyint default 0 not null comment '是否虚拟商品', pintuan_id int default 0 not null comment '拼团活动id', head_id int default 0 not null comment '团长id', pintuan_num int default 0 not null comment '拼团数量', pintuan_count int default 1 not null comment '当前数量', create_time int default 0 not null comment '创建时间', end_time int default 0 not null comment '拼团结束时间', status int default 0 not null comment '当前状态 0未支付 1拼团失败 2.组团中3.拼团成功', is_virtual_buy tinyint default 0 not null comment '是否虚拟成团', is_single_buy tinyint default 1 not null comment '是否单独购买', is_promotion tinyint default 0 not null comment '是否团长优惠', buy_num int default 0 not null comment '拼团限制购买', head_member_img varchar(255) default '' not null comment '组长会员头像', head_nickname varchar(255) default '' not null comment '组长会员昵称' ) comment '拼团返现组' charset = utf8 row_format = DYNAMIC; create index IDX_promotion_pintuan_group_end_time on lucky_promotion_pinfan_group (end_time); create index IDX_promotion_pintuan_group_goods_id on lucky_promotion_pinfan_group (goods_id); create index IDX_promotion_pintuan_group_head_id on lucky_promotion_pinfan_group (head_id); create index IDX_promotion_pintuan_group_pintuan_id on lucky_promotion_pinfan_group (pintuan_id); create index IDX_promotion_pintuan_group_site_id on lucky_promotion_pinfan_group (site_id); create index IDX_promotion_pintuan_group_status on lucky_promotion_pinfan_group (status); create table if not exists lucky_promotion_pinfan_order ( id int auto_increment primary key, pintuan_id int default 0 not null comment '拼团id', order_id int default 0 not null comment '订单id', site_id int default 0 not null comment '站点id', order_no varchar(50) default '' not null comment '订单编号', group_id int default 0 not null comment '拼团分组id', pintuan_status int default 0 not null comment '拼团状态(0未支付 1拼团失败 2组团中 3拼团成功)', order_type int default 1 not null comment '订单类型', head_id int default 1 not null comment '团长id', member_id int default 0 not null comment '订单会员id', member_img varchar(255) default '' not null comment '会员头像图', nickname varchar(255) default '' not null comment '会员昵称' ) comment '拼团订单' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_pintuan_order_head_id on lucky_promotion_pinfan_order (head_id); create index IDX_ns_promotion_pintuan_order_member_id on lucky_promotion_pinfan_order (member_id); create index IDX_ns_promotion_pintuan_order_order_id on lucky_promotion_pinfan_order (order_id); create index IDX_ns_promotion_pintuan_order_pintuan_id on lucky_promotion_pinfan_order (pintuan_id); create index IDX_ns_promotion_pintuan_order_site_id on lucky_promotion_pinfan_order (site_id); create table if not exists lucky_promotion_pintuan ( pintuan_id int(11) unsigned auto_increment comment '拼团id' primary key, site_id int default 0 not null comment '店铺id', site_name varchar(50) default '' not null comment '店铺名称', pintuan_name varchar(30) default '' not null comment '活动名称', goods_id int default 0 not null comment '商品id', is_virtual_goods tinyint default 0 not null comment '是否是虚拟商品(0否 1是)', pintuan_num int default 0 not null comment '参团人数', pintuan_time int default 1 not null comment '拼团有效期', remark text null comment '活动规则', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', is_recommend int default 0 not null comment '是否推荐', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', buy_num int default 0 not null comment '拼团限制购买', pintuan_price decimal(10, 2) default 0.00 not null comment '拼团价', is_single_buy tinyint default 1 not null comment '是否单独购买', is_virtual_buy tinyint default 0 not null comment '是否虚拟成团', is_promotion tinyint default 0 not null comment '是否团长优惠', status tinyint default 0 not null comment '状态(0正常 1活动进行中 2活动已结束 3失效 4删除)', group_num int default 0 not null comment '开团组数', success_group_num int default 0 not null comment '成团组数', order_num int default 0 not null comment '购买人数', pintuan_type varchar(50) default 'ordinary' not null comment '拼团类型 ordinary 普通团 ladder 阶梯团', pintuan_num_2 int default 0 not null comment '阶梯二参团人数', pintuan_num_3 int default 0 not null comment '阶梯三参团人数' ) comment '拼团活动表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_pintuan_end_time on lucky_promotion_pintuan (end_time); create index IDX_ns_promotion_pintuan_goods_id on lucky_promotion_pintuan (goods_id); create index IDX_ns_promotion_pintuan_is_recommend on lucky_promotion_pintuan (is_recommend); create index IDX_ns_promotion_pintuan_site_id on lucky_promotion_pintuan (site_id); create index IDX_ns_promotion_pintuan_start_time on lucky_promotion_pintuan (start_time); create index IDX_ns_promotion_pintuan_status on lucky_promotion_pintuan (status); create table if not exists lucky_promotion_pintuan_goods ( id int(11) unsigned auto_increment comment '主键' primary key, pintuan_id int default 0 not null comment '拼团id', goods_id int default 0 not null comment '商品id', sku_id int default 0 not null comment 'skuid', pintuan_price decimal(10, 2) default 0.00 not null comment '拼团价', promotion_price decimal(10, 2) default 0.00 not null comment '团长优惠价', site_id int default 0 not null comment '站点id', pintuan_price_2 decimal(10, 2) default 0.00 not null comment '阶梯二拼团价', pintuan_price_3 decimal(10, 2) default 0.00 not null comment '阶梯三拼团价' ) comment '拼团商品表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_pintuan_goods_goods_id on lucky_promotion_pintuan_goods (goods_id); create index IDX_ns_promotion_pintuan_goods_pintuan_id on lucky_promotion_pintuan_goods (pintuan_id); create index IDX_ns_promotion_pintuan_goods_site_id on lucky_promotion_pintuan_goods (site_id); create index IDX_ns_promotion_pintuan_goods_sku_id on lucky_promotion_pintuan_goods (sku_id); create table if not exists lucky_promotion_pintuan_group ( group_id int auto_increment comment '拼团分组id' primary key, site_id int default 0 not null comment '店铺id', goods_id int default 0 not null comment '商品id', is_virtual_goods tinyint default 0 not null comment '是否虚拟商品', pintuan_id int default 0 not null comment '拼团活动id', head_id int default 0 not null comment '团长id', pintuan_num int default 0 not null comment '拼团数量', pintuan_count int default 1 not null comment '当前数量', create_time int default 0 not null comment '创建时间', end_time int default 0 not null comment '拼团结束时间', status int default 0 not null comment '当前状态 0未支付 1拼团失败 2.组团中3.拼团成功', is_virtual_buy tinyint default 0 not null comment '是否虚拟成团', is_single_buy tinyint default 1 not null comment '是否单独购买', is_promotion tinyint default 0 not null comment '是否团长优惠', buy_num int default 0 not null comment '拼团限制购买', head_member_img varchar(255) default '' not null comment '组长会员头像', head_nickname varchar(255) default '' not null comment '组长会员昵称' ) comment '拼团组' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_pintuan_group_end_time on lucky_promotion_pintuan_group (end_time); create index IDX_ns_promotion_pintuan_group_goods_id on lucky_promotion_pintuan_group (goods_id); create index IDX_ns_promotion_pintuan_group_head_id on lucky_promotion_pintuan_group (head_id); create index IDX_ns_promotion_pintuan_group_pintuan_id on lucky_promotion_pintuan_group (pintuan_id); create index IDX_ns_promotion_pintuan_group_site_id on lucky_promotion_pintuan_group (site_id); create index IDX_ns_promotion_pintuan_group_status on lucky_promotion_pintuan_group (status); create table if not exists lucky_promotion_pintuan_order ( id int auto_increment primary key, pintuan_id int default 0 not null comment '拼团id', order_id int default 0 not null comment '订单id', site_id int default 0 not null comment '站点id', order_no varchar(50) default '' not null comment '订单编号', group_id int default 0 not null comment '拼团分组id', pintuan_status int default 0 not null comment '拼团状态(0未支付 1拼团失败 2组团中 3拼团成功)', order_type int default 1 not null comment '订单类型', head_id int default 1 not null comment '团长id', member_id int default 0 not null comment '订单会员id', member_img varchar(255) default '' not null comment '会员头像图', nickname varchar(255) default '' not null comment '会员昵称', pintuan_num int default 0 not null comment '拼团人数(活动规格)' ) comment '拼团订单' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_pintuan_order_head_id on lucky_promotion_pintuan_order (head_id); create index IDX_ns_promotion_pintuan_order_member_id on lucky_promotion_pintuan_order (member_id); create index IDX_ns_promotion_pintuan_order_order_id on lucky_promotion_pintuan_order (order_id); create index IDX_ns_promotion_pintuan_order_pintuan_id on lucky_promotion_pintuan_order (pintuan_id); create index IDX_ns_promotion_pintuan_order_site_id on lucky_promotion_pintuan_order (site_id); create table if not exists lucky_promotion_presale ( presale_id int(11) unsigned auto_increment primary key, presale_name varchar(255) default '' not null comment '预售活动名称', site_id int default 0 not null comment '站点id', goods_id int default 0 not null comment '商品id', presale_stock int default 0 not null comment '预售总库存', presale_num int default 0 not null comment '限购', start_time int default 0 not null comment '定金开始时间', end_time int default 0 not null comment '定金结束时间', pay_start_time int default 0 not null comment '尾款支付时间', pay_end_time int default 0 not null comment '尾款结束时间', deliver_type tinyint default 0 not null comment '发货方式(0固定时间 1尾款支付后N天)', deliver_time int default 0 not null comment '发货时间', is_fenxiao tinyint default 0 not null comment '是否参与分销(0不参与 1参与)', status tinyint default 0 not null comment '状态(0未开始 1活动进行中 2活动已结束 3失效 4删除)', status_name varchar(20) default '' not null comment '状态名称', sale_num int default 0 not null comment '销量', create_time int default 0 not null, update_time int default 0 not null, presale_deposit decimal(10, 2) default 0.00 not null comment '预售定金', presale_price decimal(10, 2) default 0.00 not null comment '抵扣金额', sku_id int default 0 not null, is_deposit_back tinyint default 0 not null comment '是否退定金是0 否1', deposit_agreement text null comment '定金协议', remark text null comment '活动规则说明' ) comment '商品预售' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_presale_goods ( id int auto_increment primary key, presale_id int default 0 not null, site_id int default 0 not null, goods_id int default 0 not null, sku_id int default 0 not null, presale_stock int default 0 not null comment '预售库存', presale_deposit decimal(10, 2) default 0.00 not null comment '预售定金', presale_price decimal(10, 2) default 0.00 not null comment '抵扣金额' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_presale_order ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', site_name varchar(255) default '' not null comment '站点名称', presale_id int default 0 not null comment '预售id', order_no varchar(255) default '' not null comment '订单编号', deposit_out_trade_no varchar(255) default '' not null comment '定金支付流水号', final_out_trade_no varchar(255) default '' not null comment '尾款支付流水号', order_from varchar(55) default '' not null comment '订单来源', order_from_name varchar(50) default '' not null comment '订单来源名称', order_type int default 0 not null comment '订单类型 1. 普通订单 2. 门店订单 3. 本地配送订单4. 虚拟订单', order_type_name varchar(50) default '' not null comment '订单类型名称', pay_start_time int default 0 not null comment '尾款支付开始时间', pay_end_time int default 0 not null comment '尾款支付结束时间', is_fenxiao int default 0 not null comment '是否参与分销 0不参与 1参与', goods_id int default 0 not null comment '商品id', goods_name varchar(400) default '' not null comment '商品名称', sku_id int default 0 not null comment '商品skuid', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(255) default '' not null comment '商品图片', sku_no varchar(10) default '' not null comment '商品编码', is_virtual int default 0 not null comment '是否是虚拟商品', goods_class int default 0 not null comment '商品种类(1.实物 2.虚拟3.卡券)', goods_class_name varchar(50) default '' not null comment '商品类型名称', cost_price decimal(10, 2) default 0.00 not null comment '成本价', sku_spec_format varchar(1000) default '' not null comment 'sku规格格式', member_id int default 0 not null comment '购买人uid', name varchar(50) default '' not null comment '购买人姓名', mobile varchar(255) default '' not null comment '购买人手机', telephone varchar(255) default '' not null comment '购买人固定电话', province_id int default 0 not null comment '购买人省id', city_id int default 0 not null comment '购买人市id', district_id int default 0 not null comment '购买人区县id', community_id int default 0 not null comment '购买人社区id', address varchar(255) default '' not null comment '购买人地址', full_address varchar(255) default '' not null comment '购买人详细地址', longitude varchar(50) default '' not null comment '购买人地址经度', latitude varchar(50) default '' not null comment '购买人地址纬度', buyer_ip varchar(20) default '' not null comment '购买人ip', buyer_ask_delivery_time int default 0 not null comment '购买人要求配送时间', buyer_message varchar(50) default '' not null comment '购买人留言信息', num int default 0 not null comment '购买数量', presale_deposit decimal(10, 2) default 0.00 not null comment '预售定金单价', presale_deposit_money decimal(10, 2) default 0.00 not null comment '定金总额', presale_price decimal(10, 2) default 0.00 not null comment '抵扣金额单价', presale_money decimal(10, 2) default 0.00 not null comment '抵扣总额', price decimal(10, 2) default 0.00 not null comment '商品单价', goods_money decimal(10, 2) default 0.00 not null comment '商品总额', balance_deposit_money decimal(10, 2) default 0.00 not null comment '余额支付定金金额', pay_deposit_money decimal(10, 2) default 0.00 not null comment '现金支付定金金额', delivery_money decimal(10, 2) default 0.00 not null comment '配送金额', promotion_money decimal(10, 2) default 0.00 not null comment '订单优惠金额', coupon_id int default 0 not null comment '优惠券id', coupon_money decimal(10, 2) default 0.00 not null comment '优惠券金额', invoice_money decimal(10, 2) default 0.00 not null comment '发票金额', order_money decimal(10, 2) default 0.00 not null comment '订单金额', final_money decimal(10, 2) default 0.00 not null comment '尾款总额', balance_final_money decimal(10, 2) default 0.00 not null comment '余额支付尾款金额', pay_final_money decimal(10, 2) default 0.00 not null comment '现金支付尾款金额', pay_deposit_time int default 0 not null comment '定金支付时间', deposit_pay_type varchar(55) default '' not null comment '定金支付方式', deposit_pay_type_name varchar(50) default '' not null comment '定金支付类型名称', pay_final_time int default 0 not null comment '尾款支付时间', final_pay_type varchar(55) default '' not null comment '尾款支付方式', final_pay_type_name varchar(50) default '' not null comment '尾款支付类型名称', order_status tinyint default 0 not null comment '订单状态', order_status_name varchar(255) default '' not null comment '状态名称', order_status_action varchar(1000) default '' not null comment '订单操作', deposit_refund_no varchar(255) default '' not null comment '定金退款流水号', final_refund_no varchar(255) default '' not null comment '尾款退款流水号', refund_money decimal(10, 2) default 0.00 not null comment '退款金额', refund_status tinyint default 0 not null comment '退款状态', refund_status_name varchar(255) default '' not null comment '退款名称', apply_refund_time int default 0 not null comment '申请退款时间', refund_time int default 0 not null comment '审核时间', refuse_reason varchar(255) default '' not null comment '拒绝原因', delivery_type varchar(50) default '' not null comment '配送方式', delivery_type_name varchar(50) default '' not null comment '配送方式名称', delivery_store_id int default 0 not null comment '门店id', delivery_store_name varchar(255) default '' not null comment '门店名称', delivery_store_info varchar(255) default '' not null comment '门店信息(json)', is_invoice int default 0 not null comment '是否需要发票 0 无发票 1 有发票', invoice_type int default 1 not null comment '发票类型 1 纸质发票 2 电子发票', invoice_title varchar(255) default '' not null comment '发票抬头', taxpayer_number varchar(255) default '' not null comment '纳税人识别号', invoice_rate decimal(10, 2) default 0.00 not null comment '发票税率', invoice_content varchar(255) default '' not null comment '发票内容', invoice_delivery_money decimal(10, 2) default 0.00 not null comment '发票邮寄费用', invoice_full_address varchar(255) default '' not null comment '发票邮寄地址', is_tax_invoice int default 0 not null comment '是否需要增值税专用发票', invoice_email varchar(255) default '' not null comment '发票发送邮件', invoice_title_type int default 0 not null comment '发票抬头类型 1 个人 2 企业', close_time int default 0 not null comment '订单关闭时间', create_time int default 0 not null comment '订单创建时间', predict_delivery_time int default 0 not null comment '预计发货时间', is_deposit_back int default 0 not null comment '是否退定金是0 否1', deposit_agreement text null comment '定金协议', relate_order_id int default 0 not null comment '关联订单id' ) comment '预售定金表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_present ( present_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '店铺ID', goods_id int default 0 not null comment '商品ID', sku_name varchar(255) default '' not null comment '商品名称', sku_id int default 0 not null comment '商品sku', sku_image varchar(255) default '' not null comment '商品图片', is_virtual tinyint default 0 not null comment '是否是虚拟商品(0否 1是)', sku_price decimal(10, 2) default 0.00 not null comment '商品原价', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', sale_num int default 0 not null comment '已赠送数量', limit_num int default 0 not null comment '每人限制领取数量', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', status tinyint default 1 not null comment '状态(1未开始 2进行中 3已结束)', stock int default 0 not null comment '赠品库存' ) comment '赠品' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_present_goods_id on lucky_promotion_present (goods_id); create index IDX_ns_promotion_present_site_id on lucky_promotion_present (site_id); create index IDX_ns_promotion_present_sku_id on lucky_promotion_present (sku_id); create index IDX_ns_promotion_present_status on lucky_promotion_present (status); create table if not exists lucky_promotion_seckill ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 1 not null comment '站点id', seckill_name varchar(255) default '' not null comment '活动名称', status tinyint default 0 not null comment '活动状态 0未开始 1进行中 2已结束 -1已关闭(手动)', remark varchar(1000) default '' not null comment '活动规则说明', start_time int default 0 not null comment '活动开始时间', sort int default 0 not null comment '排序', end_time int default 0 not null comment '活动结束时间', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', goods_id int default 0 not null comment '商品id', goods_name varchar(255) default '' not null comment '商品名称', goods_image varchar(255) default '' not null comment '图片', seckill_price decimal(10, 2) default 0.00 not null comment '秒杀金额,只做展示', seckill_time_id varchar(255) default '' not null comment '秒杀时段id', goods_stock int default 0 not null comment '库存', sale_num int default 0 not null comment '销量' ) comment '秒杀活动' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_seckill_goods ( id int(11) unsigned auto_increment primary key, seckill_id int default 0 not null comment '主键', seckill_time_id varchar(255) default '' not null comment '秒杀时间段', sku_id int default 0 not null comment '商品sku_id', goods_id int default 0 not null comment '商品id', sku_name varchar(255) default '' not null comment '商品名称', sku_image varchar(255) default '' not null comment '图片', seckill_price decimal(10, 2) default 0.00 not null comment '秒杀金额', price decimal(10, 2) default 0.00 not null comment '原价', site_id int default 0 not null comment '站点ID', stock int default 0 not null comment '秒杀库存', max_buy int default 0 not null comment '每人限购', status tinyint default 0 not null comment '活动状态 0未开始 1进行中 2已结束 -1已关闭(手动)' ) comment '秒杀参与商品' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_seckill_time ( id int auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', name varchar(255) default '' not null comment '秒杀时段名称', create_time int default 0 not null comment '创建时间', modify_time varchar(255) default '0' not null comment '修改时间', seckill_start_time int default 0 not null comment '开始时间点', seckill_end_time int default 0 not null comment '结束时间点', goods_num int default 0 not null comment '商品数量' ) comment '秒杀时段' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_topic ( topic_id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', topic_name varchar(255) default '' not null comment '专题名称', topic_adv varchar(255) default '' not null comment '专题广告', status tinyint default 1 not null comment '活动状态 1未开始 2进行中 3已结束', remark varchar(255) default '' not null comment '备注', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '结束时间', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', bg_color varchar(255) default '#ffffff' not null comment '背景色' ) comment '专题活动' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_promotion_topic_goods ( id int(11) unsigned auto_increment comment '主键' primary key, topic_id int default 0 not null comment '对应活动Id', start_time int default 0 not null comment '开始时间', end_time int default 0 not null comment '活动结束时间', site_id int default 0 not null comment '站点id', sku_id int default 0 not null comment 'skuId', topic_price decimal(10, 2) default 0.00 not null comment '折扣价', goods_id int default 0 not null comment '商品id', `default` int default 0 not null comment '是否为默认展示规格' ) comment '限时折扣商品列表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_promotion_topic_goods_end_time on lucky_promotion_topic_goods (end_time); create index IDX_ns_promotion_topic_goods_site_id on lucky_promotion_topic_goods (site_id); create index IDX_ns_promotion_topic_goods_sku_id on lucky_promotion_topic_goods (sku_id); create index IDX_ns_promotion_topic_goods_start_time on lucky_promotion_topic_goods (start_time); create index IDX_ns_promotion_topic_goods_topic_id on lucky_promotion_topic_goods (topic_id); create table if not exists lucky_reserve ( reserve_id int auto_increment primary key, site_id int default 0 not null comment '站点', member_id int default 0 not null comment '预约会员', reserve_name varchar(255) default '' not null comment '预约人姓名', reserve_time int default 0 not null comment '预约时间', reserve_state varchar(255) default '' not null comment '预约状态', reserve_state_name varchar(255) default '' not null, remark varchar(255) default '' not null comment '预约备注', store_id int default 0 not null comment '门店id', create_time int default 0 not null comment '创建时间', complete_time int default 0 not null comment '完成时间', to_store_time int default 0 not null comment '到店时间', cancel_time int default 0 not null comment '取消时间', source varchar(255) default '' not null comment '来源 store门店添加 member客户预约', reserve_item varchar(255) default '' not null ) comment '预约主表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_reserve_config ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id(店铺,分站),总平台端为0', store_id int default 0 not null comment '门店id', config_key varchar(255) default '' not null comment '配置项关键字', value text null comment '配置值json', config_desc varchar(1000) default '' not null comment '描述', is_use tinyint default 1 not null comment '是否启用 1启用 0不启用', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '预约配置表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_reserve_item ( reserve_item_id int auto_increment primary key, reserve_id int default 0 not null comment '预约id', site_id int default 0 not null comment '站点', member_id int default 0 not null comment '预约会员', reserve_name varchar(255) default '' not null comment '预约人姓名', reserve_time int default 0 not null comment '预约时间', remark varchar(255) default '' not null comment '预约备注', reserve_user_id int default 0 not null comment '预约服务人员id', reserve_goods_sku_id int default 0 not null comment '预约服务id', reserve_state varchar(255) default '' not null comment '预约状态', store_id int default 0 not null comment '门店id' ) comment '预约细表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_scale ( scale_id int auto_increment primary key, site_id int default 0 not null, store_id int default 0 not null, brand varchar(255) default '' not null comment '电子秤品牌', brand_name varchar(255) default '' not null comment '电子秤品牌名称', model varchar(255) default '' not null comment '电子秤型号', model_name varchar(255) default '' not null comment '型号名称', config text null comment '相关配置', status int default 1 not null comment '状态', create_time int default 0 not null comment '创建时间', name varchar(50) default '' not null comment '电子秤名称', type varchar(255) default 'barcode' not null comment '秤类型 barcode 条码秤 cashier 收银秤', network_type varchar(255) default 'tcp' not null comment '通信方式 serialport 串口 tcp tcp请求' ) comment '电子秤管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_seal_medium ( id int auto_increment primary key, name varchar(255) null comment '介质名', value longtext null comment '介质值', files_url varchar(255) null comment 'pdf', img_url varchar(255) null comment '图片' ) comment '介质材料' engine = MyISAM collate = utf8_unicode_ci row_format = DYNAMIC; create table if not exists lucky_seal_medium_import_record ( id int auto_increment primary key, member_num int default 0 null comment '会员总数', success_num int default 0 null comment '会员导入成功数量', error_num int default 0 null comment '会员导入失败数量', status_name varchar(255) default '' null comment '导入状态', create_time int default 0 null comment '导入时间' ) comment '会员导入记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_seal_structure ( category_id int auto_increment primary key, site_id int default 0 not null comment '站点id', name varchar(50) default '' not null comment '分类名称', pid int default 0 not null comment '分类上级', level int default 0 not null comment '层级', sort int default 0 not null comment '排序', is_answer int default 0 not null, files_url varchar(255) null comment '文件' ) comment ' 商品分类' charset = utf8 row_format = DYNAMIC; create index pid_level on lucky_seal_structure (pid, level); create table if not exists lucky_service_category ( category_id int auto_increment primary key, site_id int default 0 not null comment '站点id', category_name varchar(50) default '' not null comment '分类名称', short_name varchar(50) default '' not null comment '简称', pid int default 0 not null comment '分类上级', level int default 0 not null comment '层级', is_show int default 0 not null comment '是否显示(0显示 -1不显示)', sort int default 0 not null comment '排序', image varchar(255) default '' not null comment '分类图片', keywords varchar(255) default '' not null comment '分类页面关键字', description varchar(255) default '' not null comment '分类介绍', category_id_1 int default 0 not null comment '一级分类id', category_id_2 int default 0 not null comment '二级分类id', category_id_3 int default 0 not null comment '三级分类id', category_full_name varchar(255) default '' not null comment '组装名称', image_adv varchar(255) default '' not null comment '分类广告图', link_url varchar(2000) default '' not null ) comment ' 服务分类' charset = utf8 row_format = DYNAMIC; create index pid_level on lucky_service_category (pid, level); create table if not exists lucky_servicer ( id int auto_increment comment '客服ID' primary key, is_platform tinyint default 1 not null comment '是否平台客服', shop_id int default 0 not null comment '商户ID', user_id int default 0 not null comment '客服账号归属用户ID', nickname varchar(50) default '' not null comment '客服昵称', avatar varchar(500) default '' not null comment '客服头像', create_time int default 0 not null comment '客服创建时间', last_online_time int default 0 not null comment '最近在线时间', delete_time int default 0 not null comment '删除时间', client_id varchar(64) default '' not null comment 'session会话临时ID', online tinyint default 0 not null comment '是否在线' ) comment '客服基础表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_servicer_dialogue ( id int auto_increment comment '数据ID' primary key, member_id int default 0 not null comment '会员ID(匿名聊天则为0)', servicer_id int default 0 not null comment '客服ID', create_day date null comment '聊天创建日', create_time time null comment '聊天创建时间', add_time int default 0 not null comment '创建时间戳', content_type tinyint default 0 not null comment '内容类型(0文本1商品2订单3图片)', `read` tinyint default 0 not null comment '消息是否已读', shop_id int default 0 not null comment '商户ID', goods_sku_id int default 0 not null comment '关联商品ID', order_id int default 0 not null comment '关联订单ID', consumer_say text null comment '顾客说', servicer_say text null comment '客服说', type tinyint default 0 not null comment '0: say,客户咨询,1:answer,客服回答', ralate_data varchar(3000) default '' not null comment '相关数据 json格式', content text null comment '聊天内容', message text null comment '消息内容 纯文本消息' ) comment '客服对话内容' charset = utf8 row_format = DYNAMIC; create index index_create_day on lucky_servicer_dialogue (create_day) comment '聊天日期索引'; create table if not exists lucky_servicer_fast_reply ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点ID', content varchar(255) default '' not null comment '回复内容', create_time int default 0 not null comment '创建时间' ) comment '客服快捷回复表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_servicer_keyword_reply ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点ID', keyword varchar(50) default '' not null comment '关键词', content_type tinyint default 0 not null comment '内容类型', content text null comment '回复内容', is_use tinyint default 1 not null comment '是否使用', create_time int default 0 not null comment '创建时间', sort int default 10 not null comment '排序' ) comment '客服关键词回复表' charset = utf8 row_format = DYNAMIC; create index `INDEX` on lucky_servicer_keyword_reply (keyword); create table if not exists lucky_servicer_member ( id int auto_increment comment '数据ID' primary key, member_id int default 0 not null comment '关联会员ID', servicer_id int default 0 not null comment '关联客服ID', member_name varchar(64) default '' not null comment '会员名称', online tinyint default 0 not null comment '是否在线', create_time int default 0 not null comment '登录时间', last_online_time int default 0 not null comment '上次在线时间', delete_time int default 0 not null comment '删除时间', headimg varchar(255) default '' not null comment '会员头像', client_id varchar(64) default '' not null comment 'session会话临时ID' ) comment '聊天会员在线状态表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_shop ( site_id int not null primary key, shop_status int default 1 not null comment '店铺经营状态(0.关闭,1正常)', close_info varchar(255) default '' not null comment '店铺关闭原因', sort int default 0 not null comment '排序号', start_time int default 0 not null comment '经营时间', end_time int default 0 not null comment '关闭时间', avatar varchar(255) default '' not null comment '店铺头像(大图)', banner varchar(255) default '' not null comment '店铺条幅', qq varchar(20) default '' not null comment '联系人qq', ww varchar(20) default '' not null comment '联系人阿里旺旺', name varchar(255) default '' not null comment '联系人姓名', telephone varchar(255) default '' not null comment '联系电话', mobile varchar(255) default '' not null comment '联系手机号', workingtime int default 0 not null comment '工作时间', province int default 0 not null comment '省id', province_name varchar(50) default '' not null comment '省名称', city int default 0 not null comment '城市id', city_name varchar(50) default '' not null comment '城市名称', district int default 0 not null comment '区县id', district_name varchar(50) default '' not null comment '区县地址', community int default 0 not null comment '乡镇地址id', community_name varchar(50) default '' not null comment '乡镇地址名称', address varchar(255) default '' not null comment '详细地址', full_address varchar(255) default '' not null comment '完整地址', longitude varchar(20) default '' not null comment '经度', latitude varchar(20) default '' not null comment '纬度', email varchar(50) default '' not null, create_time int default 0 not null comment '创建时间', store_settlement_time int default 0 not null comment '门店最后结算时间', work_week varchar(50) default '' not null comment '工作日', ischina int default 0 not null ) comment '店铺表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_shop_accept_message ( id int auto_increment primary key, site_id int default 0 not null, member_id int default 0 not null comment '会员id(接受消息的会员id)', type tinyint default 0 not null comment '类型(0统一设置 1单独设置)', keywords varchar(255) default '' not null comment '消息关键字(针对单独设置有效)', create_time int default 0 not null, update_time int default 0 not null, mobile varchar(50) default '' not null comment '通知人手机号', wx_openid varchar(255) default '' not null comment '通知人微信公众号openid', nickname varchar(255) default '' not null comment '通知人昵称' ) comment '商家接受消息设置' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_shop_address ( id int auto_increment primary key, site_id int default 0 not null, contact_name varchar(50) default '' not null comment '联系人', mobile varchar(255) default '' not null comment '联系人手机号', postcode varchar(255) default '' not null comment '邮政编码', province_id int default 0 not null comment '省', city_id int default 0 not null comment '市', district_id int default 0 not null comment '县', community_id int default 0 not null comment '乡镇', address varchar(255) default '' not null comment '详细地址', full_address varchar(255) default '' not null comment '收票地址', is_return tinyint default 0 not null comment '退货地址', is_return_default tinyint default 0 not null comment '是否是默认退货地址', is_delivery tinyint default 0 not null comment '发货地址', update_time int default 0 not null ) comment '商家地址库' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_shopcompoent_category ( id int(11) unsigned auto_increment primary key, first_cat_id int default 0 not null comment '第一级类目ID', second_cat_id int default 0 not null comment '第二级类目ID', third_cat_id int default 0 not null comment '第三级类目ID', first_cat_name varchar(200) default '' not null comment '一级类目名称', second_cat_name varchar(200) default '' not null comment '二级类目名称', third_cat_name varchar(200) default '' not null comment '三级类目名称', qualification varchar(2000) default '' not null comment '类目资质', qualification_type int default 0 not null comment '类目资质类型,0:不需要,1:必填,2:选填', product_qualification_type int default 0 not null comment '商品资质类型,0:不需要,1:必填,2:选填', product_qualification varchar(2000) default '' not null comment '商品资质', create_time int default 0 not null comment '创建时间' ) comment '小程序交易组件类目表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_shopcompoent_category_audit ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点ID', third_cat_id int default 0 not null comment '第三级类目ID', certificate varchar(5000) default '' not null comment '类目资质材料', qualification_pics varchar(5000) default '' not null comment '商品资质材料', audit_id varchar(2000) default '' not null comment '审核ID', audit_time int default 0 not null comment '审核时间', status int default 0 not null comment '审核状态, 0:审核中,1:审核成功,9:审核拒绝', reject_reason varchar(5000) default '' not null comment '拒绝原因' ) comment '小程序交易组件类目审核表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_shopcompoent_goods ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点ID', out_product_id int default 0 not null comment '商家自定义商品ID', third_cat_id int default 0 not null comment '第三级类目ID', cat_name varchar(1000) default '' not null comment '类目名称', brand_id int default 0 not null comment '品牌id', product_id int default 0 not null comment '交易组件平台内部商品ID', edit_status int default 0 not null comment '商品草稿状态, 0:初始值,1:编辑中,2:审核中,3:审核失败,4:审核成功', status int default 0 not null comment '商品线上状态, 0:初始值,5:上架,11:自主下架,13:违规下架/风控系统下架', info_version varchar(500) default '' not null comment '预留字段,用于版本控制', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '更新时间', audit_time int default 0 not null comment '审核时间', reject_reason varchar(5000) default '' not null comment '失败原因' ) comment '小程序交易组件商品表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_site ( site_id int(11) unsigned auto_increment comment '站点id' primary key, site_type varchar(255) default '' not null comment '站点类型', site_domain varchar(255) default '' not null comment '站点域名', create_time int default 0 not null comment '创建时间', site_name varchar(255) default '' not null comment '站点名称', username varchar(255) default '' not null comment '站点用户', logo varchar(255) default '' not null comment '站点logo', seo_keywords varchar(255) default '' not null comment '站点关键字', seo_description varchar(255) default '' not null comment '站点描述', site_tel varchar(255) default '' not null comment '服务电话', logo_square varchar(255) default '' not null comment '站点方形logo', seo_title varchar(255) default '' not null comment 'seo标题', uniacid int default 0 not null, end_time int null comment '过期时间', site_realname varchar(255) null comment ' 姓名' ) comment '站点基础表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_site_address ( id int auto_increment primary key, site_id int default 0 not null, contact_name varchar(50) default '' not null comment '联系人', mobile varchar(255) default '' not null comment '联系人手机号', postcode varchar(255) default '' not null comment '邮政编码', province_id int default 0 not null comment '省', city_id int default 0 not null comment '市', district_id int default 0 not null comment '县', community_id int default 0 not null comment '乡镇', address varchar(255) default '' not null comment '详细地址', full_address varchar(255) default '' not null comment '完整地址', is_return tinyint default 0 not null comment '退货地址', is_return_default tinyint default 0 not null comment '是否是默认退货地址', is_delivery tinyint default 0 not null comment '发货地址', update_time int default 0 not null ) comment '站点地址库' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_site_diy_template ( id int(11) unsigned auto_increment comment '主键' primary key, name varchar(255) default '' not null comment '模板组名称', site_id int default 0 not null comment '站点id', template_goods_id int default 0 not null comment '模板组id', is_default int default 0 not null comment '是否默认模板', addon_name varchar(255) default '' not null comment '插件标识', create_time int default 0 not null comment '创建时间' ) comment '店铺拥有的模板组' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_site_diy_view ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', name varchar(50) default '' not null comment '模板标识', title varchar(255) default '' not null comment '模板名称', template_id int default 0 not null comment '所属模板id', template_item_id int default 0 not null comment '所属模板页面id,关联diy_template_goods_item表', type varchar(255) default 'DIY_PAGE' not null comment '页面类型', type_name varchar(255) default '自定义页面' not null comment '页面类型名称', is_default int default 0 not null comment '是否默认页面(针对自定义模板设置),1:是,0:否', addon_name varchar(255) default '' not null comment '插件标识', click_num int default 0 not null comment '浏览量', value longtext null comment '配置值', sort int default 0 not null comment '排序', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', is_en_default int default 0 not null comment '英文版默认' ) comment '店铺自定义模板表' charset = utf8 row_format = DYNAMIC; create index IDX_nc_site_diy_view on lucky_site_diy_view (site_id, name); create table if not exists lucky_sms_template ( template_id int auto_increment primary key, site_id int default 0 not null comment '站点id', tem_id int default 0 not null comment '返回的模板id', keywords varchar(255) default '' not null, template_type tinyint default 0 not null comment '模板类型(1验证码 2行业通知 3营销推广 )', template_name varchar(255) default '' not null comment '模板名称', template_content varchar(255) default '' not null comment '模板内容', param_json varchar(255) default '' not null comment '模板变量json', status tinyint default 0 not null comment '启用状态(1 启用,0 禁用)', audit_status tinyint default 0 not null comment '审核状态(0 未审核,1 待审核,2 审核通过, 3 审核不通过)', create_time int default 0 not null, update_time int default 0 not null ) comment '牛云短信模板' charset = utf8 avg_row_length = 862 row_format = DYNAMIC; create table if not exists lucky_stat_shop ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', year int default 0 not null comment '年', month int default 0 not null comment '月', day int default 0 not null comment '日', day_time int default 0 not null comment '当日时间', order_total decimal(10, 2) default 0.00 not null comment '订单金额', shipping_total decimal(10, 2) default 0.00 not null comment '运费金额', refund_total decimal(10, 2) default 0.00 not null comment '退款金额', order_pay_count int default 0 not null comment '订单总数', goods_pay_count int default 0 not null comment '订单商品总数', shop_money decimal(10, 2) default 0.00 not null comment '店铺金额', platform_money decimal(10, 2) default 0.00 not null comment '平台金额', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', collect_shop int default 0 not null comment '店铺收藏量', collect_goods int default 0 not null comment '商品收藏量', visit_count int default 0 not null comment '浏览量', order_count int default 0 not null comment '订单量(总)', goods_count int default 0 not null comment '订单商品量(总)', add_goods_count int default 0 not null comment '添加商品数', member_count int default 0 not null comment '会员统计', order_member_count int default 0 not null comment '下单会员数', order_refund_count int default 0 not null comment '退款订单数', order_refund_grand_count decimal(10, 2) default 0.00 not null comment '退款金额', order_refund_grand_total_money decimal(10, 2) default 0.00 not null comment '累计退款金额', coupon_member_count int default 0 not null comment '领券会员数量', member_level_count int default 0 not null comment '超级会员卡销售量', member_level_total_money decimal(10, 2) default 0.00 not null comment '超级会员卡销售额', member_level_grand_count int default 0 not null comment '累计超级会员卡销售量', member_level_grand_total_money decimal(10, 2) default 0.00 not null comment '累计超级会员卡销售额', member_recharge_count int default 0 not null comment '会员储值总订单量', member_recharge_grand_count decimal(10, 2) default 0.00 not null comment '累计会员储值总量', member_recharge_total_money decimal(10, 2) default 0.00 not null comment '会员充值总额', member_recharge_grand_total_money decimal(10, 2) default 0.00 not null comment '累计会员充值总额', member_recharge_member_count int default 0 not null comment '储值会员数', member_giftcard_count int default 0 not null comment '礼品卡订单总量', member_giftcard_grand_count int default 0 not null comment '累计礼品卡订单总量', member_giftcard_total_money decimal(10, 2) default 0.00 not null comment '礼品卡订单总额', h5_visit_count int default 0 not null comment 'h5访问量', wechat_visit_count int default 0 not null comment 'wechat访问量', weapp_visit_count int default 0 not null comment 'weapp访问量', pc_visit_count int default 0 not null comment 'pc访问量', expected_earnings_total_money decimal(10, 2) default 0.00 not null comment '预计收入', expenditure_total_money decimal(10, 2) default 0.00 not null comment '总支出', earnings_total_money decimal(10, 2) default 0.00 not null comment '总收入', member_withdraw_count int default 0 not null comment '会员提现总量', member_withdraw_total_money decimal(10, 2) default 0.00 not null comment '会员提现总额', coupon_count int default 0 not null comment '领券数', add_coupon_count int default 0 not null comment '新增优惠券', order_pay_money decimal(10, 2) default 0.00 not null comment '订单实际支付', add_fenxiao_member_count int default 0 not null comment '新增分销商', fenxiao_order_total_money decimal(10, 2) default 0.00 not null comment '分销订单总额', fenxiao_order_count int default 0 not null comment '分销订单总数', goods_on_type_count int default 0 not null comment '在架商品数', goods_visited_type_count int default 0 not null comment '被访问商品数(仅详情页浏览数)', goods_order_type_count int default 0 not null comment '动销商品数', goods_exposure_count int default 0 not null comment '商品曝光数', goods_visit_count int default 0 not null comment '商品浏览量', goods_visit_member_count int default 0 not null comment '商品访客数', goods_cart_count int default 0 not null comment '加购件数', goods_order_count decimal(12, 3) default 0.000 not null comment '下单件数', order_create_money decimal(10, 2) default 0.00 not null comment '订单下单总额', order_create_count int default 0 not null comment '订单下单量', balance_deduction decimal(10, 2) unsigned default 0.00 not null comment '余额抵扣总额', cashier_billing_count int default 0 not null comment '开单数量', cashier_billing_money decimal(10, 2) default 0.00 not null comment '开单金额', cashier_buycard_count int default 0 not null comment '办卡数量', cashier_buycard_money decimal(10, 2) default 0.00 not null comment '办卡金额', cashier_recharge_count int default 0 not null comment '收银台充值数量', cashier_recharge_money decimal(10, 2) default 0.00 not null comment '收银台充值金额', cashier_refund_count int default 0 not null comment '收银台退款数量', cashier_refund_money decimal(10, 2) default 0.00 not null comment '收银台退款金额', cashier_order_member_count int default 0 not null comment '收银台下单会员数', cashier_balance_money decimal(10, 2) default 0.00 not null comment '收银台余额消费金额', cashier_online_pay_money decimal(10, 2) default 0.00 not null comment '收银台线上金额', cashier_online_refund_money decimal(10, 2) default 0.00 not null comment '收银台线上退款金额', cashier_balance_deduction decimal(10, 2) default 0.00 not null comment '门店余额总计' ) charset = utf8 row_format = DYNAMIC; create index IDX_ns_stat_shop_day on lucky_stat_shop (day); create index IDX_ns_stat_shop_day_time on lucky_stat_shop (day_time); create index IDX_ns_stat_shop_month on lucky_stat_shop (month); create index IDX_ns_stat_shop_site_id on lucky_stat_shop (site_id); create index IDX_ns_stat_shop_year on lucky_stat_shop (year); create table if not exists lucky_stat_shop_hour ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', year int default 0 not null comment '年', month int default 0 not null comment '月', day int default 0 not null comment '日', hour int default 0 not null comment '时', day_time int default 0 not null comment '当日时间', order_total decimal(10, 2) default 0.00 not null comment '订单金额', shipping_total decimal(10, 2) default 0.00 not null comment '运费金额', refund_total decimal(10, 2) default 0.00 not null comment '退款金额', order_pay_count int default 0 not null comment '订单总数', goods_pay_count int default 0 not null comment '订单商品总数', shop_money decimal(10, 2) default 0.00 not null comment '店铺金额', platform_money decimal(10, 2) default 0.00 not null comment '平台金额', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', collect_shop int default 0 not null comment '店铺收藏量', collect_goods int default 0 not null comment '商品收藏量', visit_count int default 0 not null comment '浏览量', order_count int default 0 not null comment '订单量(总)', goods_count int default 0 not null comment '订单商品量(总)', add_goods_count int default 0 not null comment '添加商品数', member_count int default 0 not null comment '会员统计', order_member_count int default 0 not null comment '下单会员数', order_refund_count int default 0 not null comment '退款订单数', order_refund_grand_count decimal(10, 2) default 0.00 not null comment '退款金额', order_refund_grand_total_money decimal(10, 2) default 0.00 not null comment '累计退款金额', coupon_member_count int default 0 not null comment '领券会员数量', member_level_count int default 0 not null comment '超级会员卡销售量', member_level_total_money decimal(10, 2) default 0.00 not null comment '超级会员卡销售额', member_level_grand_count int default 0 not null comment '累计超级会员卡销售量', member_level_grand_total_money decimal(10, 2) default 0.00 not null comment '累计超级会员卡销售额', member_recharge_count int default 0 not null comment '会员储值总订单量', member_recharge_grand_count decimal(10, 2) default 0.00 not null comment '累计会员储值总量', member_recharge_total_money decimal(10, 2) default 0.00 not null comment '会员充值总额', member_recharge_grand_total_money decimal(10, 2) default 0.00 not null comment '累计会员充值总额', member_recharge_member_count int default 0 not null comment '储值会员数', member_giftcard_count int default 0 not null comment '礼品卡订单总量', member_giftcard_grand_count int default 0 not null comment '累计礼品卡订单总量', member_giftcard_total_money decimal(10, 2) default 0.00 not null comment '礼品卡订单总额', h5_visit_count int default 0 not null comment 'h5访问量', wechat_visit_count int default 0 not null comment 'wechat访问量', weapp_visit_count int default 0 not null comment 'weapp访问量', pc_visit_count int default 0 not null comment 'pc访问量', expected_earnings_total_money decimal(10, 2) default 0.00 not null comment '预计收入', expenditure_total_money decimal(10, 2) default 0.00 not null comment '总支出', earnings_total_money decimal(10, 2) default 0.00 not null comment '总收入', member_withdraw_count int default 0 not null comment '会员提现总量', member_withdraw_total_money decimal(10, 2) default 0.00 not null comment '会员提现总额', coupon_count int default 0 not null comment '领券数', add_coupon_count int default 0 not null comment '新增优惠券', order_pay_money decimal(10, 2) default 0.00 not null comment '订单实际支付', add_fenxiao_member_count int default 0 not null comment '新增分销商', fenxiao_order_total_money decimal(10, 2) default 0.00 not null comment '分销订单总额', fenxiao_order_count int default 0 not null comment '分销订单总数', goods_on_type_count int default 0 not null comment '在架商品数', goods_visited_type_count int default 0 not null comment '被访问商品数(仅详情页浏览数)', goods_order_type_count int default 0 not null comment '动销商品数', goods_exposure_count int default 0 not null comment '商品曝光数', goods_visit_count int default 0 not null comment '商品浏览量', goods_visit_member_count int default 0 not null comment '商品访客数', goods_cart_count int default 0 not null comment '加购件数', goods_order_count decimal(12, 3) default 0.000 not null comment '下单件数', order_create_money decimal(10, 2) default 0.00 not null comment '订单下单总额', order_create_count int default 0 not null comment '订单下单量', balance_deduction decimal(10, 2) default 0.00 not null comment '余额抵扣总额', cashier_billing_count int default 0 not null comment '开单数量', cashier_billing_money decimal(10, 2) default 0.00 not null comment '开单金额', cashier_buycard_count int default 0 not null comment '办卡数量', cashier_buycard_money decimal(10, 2) default 0.00 not null comment '办卡金额', cashier_recharge_count int default 0 not null comment '收银台充值数量', cashier_recharge_money decimal(10, 2) default 0.00 not null comment '收银台充值金额', cashier_refund_count int default 0 not null comment '收银台退款数量', cashier_refund_money decimal(10, 2) default 0.00 not null comment '收银台退款金额', cashier_order_member_count int default 0 not null comment '收银台下单会员数', cashier_balance_money decimal(10, 2) default 0.00 not null comment '收银台余额消费金额', cashier_online_pay_money decimal(10, 2) default 0.00 not null comment '收银台线上金额', cashier_online_refund_money decimal(10, 2) default 0.00 not null comment '收银台线上退款金额', cashier_balance_deduction decimal(10, 2) default 0.00 not null comment '门店余额总计' ) charset = utf8 row_format = DYNAMIC; create index IDX_ns_stat_shop_hour_day on lucky_stat_shop_hour (day); create index IDX_ns_stat_shop_hour_day_time on lucky_stat_shop_hour (day_time); create index IDX_ns_stat_shop_hour_hour on lucky_stat_shop_hour (hour); create index IDX_ns_stat_shop_hour_month on lucky_stat_shop_hour (month); create index IDX_ns_stat_shop_hour_site_id on lucky_stat_shop_hour (site_id); create index IDX_ns_stat_shop_hour_year on lucky_stat_shop_hour (year); create table if not exists lucky_stat_store ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', store_id int default 0 not null comment '门店id', year int default 0 not null comment '年', month int default 0 not null comment '月', day int default 0 not null comment '日', day_time int default 0 not null comment '当日时间', balance_deduction decimal(10, 2) default 0.00 not null comment '余额抵扣总额', billing_count int default 0 not null comment '开单数量', billing_money decimal(10, 2) default 0.00 not null comment '开单金额', buycard_count int default 0 not null comment '办卡数量', buycard_money decimal(10, 2) default 0.00 not null comment '办卡金额', recharge_count int default 0 not null comment '充值数量', recharge_money decimal(10, 2) default 0.00 not null comment '充值金额', refund_count int default 0 not null comment '退款数量', refund_money decimal(10, 2) default 0.00 not null comment '退款金额', order_member_count int default 0 not null comment '下单会员数', balance_money decimal(10, 2) default 0.00 not null comment '余额消费金额', online_pay_money decimal(10, 2) default 0.00 not null comment '在线订单总额', online_refund_money decimal(10, 2) default 0.00 not null comment '在线退款金额' ) charset = utf8 row_format = DYNAMIC; create index IDX_ns_stat_shop_day on lucky_stat_store (day); create index IDX_ns_stat_shop_day_time on lucky_stat_store (day_time); create index IDX_ns_stat_shop_month on lucky_stat_store (month); create index IDX_ns_stat_shop_site_id on lucky_stat_store (site_id); create index IDX_ns_stat_shop_year on lucky_stat_store (year); create table if not exists lucky_stat_store_hour ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', store_id int default 0 not null comment '门店id', year int default 0 not null comment '年', month int default 0 not null comment '月', day int default 0 not null comment '日', hour int default 0 not null comment '时', day_time int default 0 not null comment '当日时间', billing_count int default 0 not null comment '开单数量', billing_money decimal(10, 2) default 0.00 not null comment '开单金额', buycard_count int default 0 not null comment '办卡数量', buycard_money decimal(10, 2) default 0.00 not null comment '办卡金额', recharge_count int default 0 not null comment '充值数量', recharge_money decimal(10, 2) default 0.00 not null comment '充值金额', refund_count int default 0 not null comment '退款数量', refund_money decimal(10, 2) default 0.00 not null comment '退款金额', order_member_count int default 0 not null comment '下单会员数', balance_money decimal(10, 2) default 0.00 not null comment '余额消费金额', online_pay_money decimal(10, 2) default 0.00 not null comment '在线订单总额', online_refund_money decimal(10, 2) default 0.00 not null comment '在线退款金额', balance_deduction decimal(10, 2) default 0.00 not null comment '余额抵扣总额' ) charset = utf8 row_format = DYNAMIC; create index IDX_ns_stat_shop_day on lucky_stat_store_hour (day); create index IDX_ns_stat_shop_day_time on lucky_stat_store_hour (day_time); create index IDX_ns_stat_shop_month on lucky_stat_store_hour (month); create index IDX_ns_stat_shop_site_id on lucky_stat_store_hour (site_id); create index IDX_ns_stat_shop_year on lucky_stat_store_hour (year); create table if not exists lucky_stock_allot ( allot_id int auto_increment primary key, site_id int default 0 not null comment '站点', output_store_id int not null comment '出库门店', output_store_name varchar(255) default '' not null comment '出库门店', input_store_id int not null comment '入库门店', input_store_name varchar(255) default '' not null comment '入库门店', allot_no varchar(255) default '' not null comment '调拨编号', `key` varchar(255) default 'PURCHASE' not null comment '单据关键字', goods_money decimal(10, 2) default 0.00 not null comment '商品金额', remark varchar(255) default '' not null comment '备注', status int default 0 not null comment '审核状态 0草稿1.待审核2.已审核', verifier int default 0 not null comment '审核人uid', verifier_name varchar(255) default '' not null comment '审核人名称', operater int not null comment '操作人id', operater_name varchar(255) default '' not null comment '操作人名称', allot_time int default 0 not null comment '调拨时间', create_time int default 0 not null comment '创建时间', to_verify_time int default 0 not null comment '确认待审时间', verify_time int default 0 not null comment '审核时间' ) comment '调拨管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_allot_goods ( allot_goods_id int(11) unsigned auto_increment primary key, allot_id int not null comment '单据id', goods_id int not null comment '商品id', goods_sku_id int not null comment '商品skuid', goods_sku_no varchar(255) default '' not null comment '商品sku编码', goods_sku_img varchar(255) default '' not null comment '商品图片', goods_sku_name varchar(255) default '' not null comment '商品sku全称', goods_unit varchar(255) default '' not null comment '商品单位', goods_num decimal(12, 3) default 0.000 not null comment '调拨商品数量', goods_price decimal(10, 2) default 0.00 not null comment '商品单价', goods_remark varchar(255) default '' not null comment '商品备注', create_time int default 0 not null, site_id int default 0 not null comment '站点id', output_store_stock decimal(12, 3) default 0.000 not null comment '出库门店原库存', input_store_stock decimal(12, 3) default 0.000 not null comment '入库门店原库存', total_goods_money decimal(10, 2) default 0.00 not null, goods_sku_spec varchar(255) default '' not null comment '商品规格' ) comment '调拨项目表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_content ( id int(11) unsigned auto_increment primary key, stock_id int default 0 not null comment '虚拟评价库id', content varchar(255) default '' not null comment '评价内容', site_id int default 0 not null comment '站点id', create_time int default 0 not null comment '创建时间' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_document ( document_id int auto_increment primary key, site_id int default 0 not null comment '站点', document_no varchar(255) default '' not null comment '单据编号', `key` varchar(255) default 'PURCHASE' not null comment '单据关键字', type varchar(255) default '' not null comment '出入库类型 入库:input,出库:output', goods_money decimal(10, 2) default 0.00 not null comment '商品金额', promotion_money decimal(10, 2) default 0.00 not null comment '优惠金额', invoice_money decimal(10, 2) default 0.00 not null comment '发票金额', document_money decimal(10, 2) default 0.00 not null comment '单据金额', remark varchar(255) default '' not null comment '备注', status int default 0 not null comment '审核状态 1:待审核,2:已审核,-1:已拒绝', create_time int default 0 not null comment '创建时间', store_id int default 0 not null comment '仓库id', store_name varchar(255) default '' not null comment '仓库门店名称', operater int not null comment '经办人id', operater_name varchar(255) default '' not null comment '经办人名称', verifier int default 0 not null comment '审核人id', verifier_name varchar(255) default '' not null comment '审核人名称', inventory_id int default 0 not null comment '盘点单据id', time int default 0 not null comment '出入库时间', is_out_stock int default 0 not null comment '是否需要扣除销售库存', allot_id int default 0 not null comment '调拨id', relate_id int default 0 not null comment '关联业务id', relate_type varchar(255) default '' not null comment '关联业务类型', refuse_reason varchar(255) default '' not null comment '拒绝理由', audit_time int default 0 not null comment '审核时间' ) comment '单据管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_document_goods ( document_goods_id int(11) unsigned auto_increment primary key, document_id int not null comment '单据id', goods_id int not null comment '商品id', goods_sku_id int not null comment '商品skuid', goods_sku_no varchar(255) default '' not null comment '商品sku编码', goods_sku_img varchar(255) default '' not null comment '商品图片', goods_sku_name varchar(255) default '' not null comment '商品sku全称', goods_unit varchar(255) default '' not null comment '商品单位', goods_num decimal(12, 3) default 0.000 not null comment '商品数量', goods_price decimal(10, 2) default 0.00 not null comment '商品单价', goods_remark varchar(255) default '' not null comment '商品备注', create_time int default 0 not null comment '创建时间', site_id int default 0 not null comment '站点id', before_stock decimal(12, 3) default 0.000 not null comment '原库存', after_stock decimal(12, 3) default 0.000 not null comment '现库存', before_goods_price decimal(10, 2) default 0.00 not null comment '原成本价', after_goods_price decimal(10, 2) default 0.00 not null comment '现成本均价', store_id int default 0 not null comment '门店仓库id', operater int default 0 not null comment '经办人id', operater_name varchar(255) default '' not null comment '经办人名称', verifier int default 0 not null comment '审核人id', verifier_name varchar(255) default '' not null comment '审核人名称', before_store_stock decimal(12, 3) default 0.000 not null, before_store_goods_price decimal(10, 2) default 0.00 not null, after_store_stock decimal(12, 3) default 0.000 not null, after_store_goods_price decimal(10, 2) unsigned default 0.00 not null, total_goods_money decimal(10, 2) default 0.00 not null, goods_sku_spec varchar(255) default '' not null comment '商品规格' ) comment '单据项目表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_document_type ( name varchar(50) default '' not null comment '单据名称', type varchar(255) default '' not null comment '单据类型output.出库input.入库', prefix varchar(255) default '' not null comment '单据前缀', `key` varchar(255) default '' not null comment '单据关键字' ) comment '单据类型' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_goods_export ( export_id int auto_increment primary key, `condition` varchar(2000) default '' not null comment '条件 json', status int default 0 not null comment '导出状态 0 正在导出 1 已导出 2 已删除', create_time int default 0 not null comment '导出时间', path varchar(255) default '' not null comment '导出文件的物理路径', site_id int default 0 not null comment '站点id' ) comment '库存商品导出记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_inventory ( inventory_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', remark varchar(1000) default '' not null comment '备注', create_time int default 0 not null comment '操作时间', inventory_no varchar(255) default '' not null comment '盘点单号', store_id int default 0 not null comment '仓库门店id', store_name varchar(255) default '' not null comment '仓库门店名称', kinds_num int default 0 not null comment '总盘点种数', kinds_profit_num int default 0 not null comment '盘盈种数', kinds_loss_num int default 0 not null comment '盘亏种数', kinds_even_num int default 0 not null comment '持平种数', num decimal(12, 3) default 0.000 not null comment '盘点总数', profit_num decimal(12, 3) default 0.000 not null comment '盘盈数', loss_num decimal(12, 3) default 0.000 not null comment '盘亏数', even_num decimal(12, 3) default 0.000 not null comment '盘点持平数', profitloss_num decimal(12, 3) default 0.000 not null comment '盈亏数量', inventory_cost_money decimal(10, 2) default 0.00 not null comment '盘点成本总额', profitloss_sale_money decimal(10, 2) default 0.00 not null comment '盈亏销售额', status int default 0 not null comment '审核状态 1:待审核,2:已审核,-1:已拒绝', operater int default 0 not null comment '经办人id', operater_name varchar(255) default '' not null comment '经办人名称', verifier int default 0 not null comment '审核人id', verifier_name varchar(255) default '' not null comment '审核人名称', audit_time int default 0 not null comment '审核时间', refuse_reason varchar(255) default '' not null comment '拒绝理由' ) comment '库存盘点单' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_stock_inventory_goods ( id int(11) unsigned auto_increment primary key, inventory_id int default 0 not null comment '盘点单', goods_id int default 0 not null comment '商品id', goods_sku_id int default 0 not null comment '商品sku', goods_sku_name varchar(255) default '' not null comment '商品名称', goods_sku_no varchar(255) default '' not null comment '商品编码', goods_img varchar(255) default '' not null comment '商品主图', stock decimal(12, 3) default 0.000 not null comment '产品库数量', inventory_num decimal(12, 3) default 0.000 not null comment '盘点数量', inventory_remark varchar(255) default '' not null comment '盘点备注', site_id int default 0 not null, store_id int default 0 not null comment '门店仓库id', profitloss_num decimal(12, 3) default 0.000 not null comment '盈亏数量', inventory_cost_money decimal(10, 2) default 0.00 not null comment '盘点成本总价', profitloss_sale_money decimal(10, 2) default 0.00 not null comment '盈亏销售总价', goods_unit varchar(255) default '' not null comment '商品单位', goods_sku_spec varchar(255) default '' not null comment '产品规格' ) comment '库存盘点商品表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store ( store_id int auto_increment comment '门店站点id' primary key, store_name varchar(50) default '' not null comment '门店名称', telphone varchar(255) default '' not null comment '联系电话', store_image varchar(255) default '' not null comment '门店图片', site_id int default 0 not null comment '商家id', site_name varchar(255) default '' not null comment '站点名称', status int default 0 not null comment '状态', province_id int default 0 not null comment '省id', city_id int default 0 not null comment '市id', district_id int default 0 not null comment '区县id', community_id int default 0 not null comment '社区id', address varchar(255) default '' not null comment '地址', full_address varchar(255) default '' not null comment '详细地址', longitude varchar(50) default '' not null comment '经度', latitude varchar(50) default '' not null comment '纬度', is_pickup tinyint default 0 not null comment '是否启用自提', is_o2o tinyint default 0 not null comment '是否启用本地配送', open_date varchar(1000) default '' not null comment '营业时间', o2o_fee_json varchar(1000) default '' not null comment '配送费用设置', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', username varchar(255) default '' not null comment '门店管理员', order_money decimal(10, 2) default 0.00 not null comment '付款后订单金额', order_complete_money decimal(10, 2) default 0.00 not null comment '订单完成-订单金额', order_num int default 0 not null comment '订单数', order_complete_num int default 0 not null comment '订单完成数量', is_frozen tinyint default 0 not null comment '是否冻结0-未冻结 1已冻结', uid int default 0 null comment '门店管理员id', time_type int default 0 not null comment '时间选取类型 0 每天 1 自定义', time_week varchar(255) default '' not null comment '营业时间 周一 周二.......', start_time int default 0 not null comment '当日的起始时间', end_time int default 0 not null comment '当日的营业结束时间', stock_type varchar(255) default 'all' not null comment '库存设置 store-门店独立库存 all总部统一库存', is_default int default 0 not null comment '是否是默认门店', store_type varchar(255) default 'directsale' not null comment '门店类型', time_interval int default 30 not null comment '时段设置单位分钟', delivery_time varchar(2000) default '' not null comment '配送时间段', advance_day int default 0 not null comment '时间选择需提前多少天', most_day int default 7 not null comment '最多可预约多少天', account decimal(10, 2) default 0.00 not null comment '当前账户余额', account_apply decimal(10, 2) default 0.00 not null comment '转账申请中金额', account_withdraw decimal(10, 2) default 0.00 not null comment '已结算转账金额', is_settlement tinyint default 0 not null comment '是否需要结算', settlement_rate decimal(10, 2) default 0.00 not null comment '开启结算0代表跟随系统,不为零表示独立设置', bank_type tinyint default 1 not null comment '银行账户类型', bank_type_name varchar(255) default '' not null comment '账户名称', bank_user_name varchar(255) default '' not null comment '账户所属人', bank_type_account varchar(255) default '' not null comment '账户类型对应账号', category_id int default 0 not null comment '门店分类id', category_name varchar(255) default '' not null comment '门店分类名称', label_id varchar(255) default '' not null comment '门店标签,id,id,', label_name varchar(5000) default '' not null comment '门店标签,name,name,', is_express int default 0 not null comment '是否启用快递配送', store_images text null comment '门店图片多图', store_introduce longtext null comment '门店介绍', uniacid int null ) comment '线下门店表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_account ( id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', store_id int default 0 not null comment '门店id', account_data decimal(10, 2) default 0.00 not null comment '账户数据', from_type varchar(255) default '' not null comment '来源类型', type_name varchar(50) default '' not null comment '来源类型名称', remark varchar(255) default '' not null comment '备注信息', create_time int default 0 not null comment '创建时间', related_id int default 0 not null comment '关联Id' ) comment '门店账户流水' charset = utf8 row_format = DYNAMIC; create index IDX_store_account_create_time on lucky_store_account (create_time); create index IDX_store_account_from_type on lucky_store_account (from_type); create index IDX_store_account_store_id on lucky_store_account (store_id); create table if not exists lucky_store_category ( category_id int auto_increment primary key, site_id int default 0 not null, category_name varchar(255) default '' not null, sort int default 0 not null ) comment '门店分类表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_goods ( id int(11) unsigned auto_increment comment '主键' primary key, goods_id int default 0 not null comment '商品id', store_id int default 0 not null comment '门店id', stock decimal(12, 3) default 0.000 not null comment '商品库存', sale_num decimal(12, 3) default 0.000 not null comment '商品销量', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', price decimal(10, 2) default 0.00 not null comment '价格', cost_price decimal(10, 2) default 0.00 not null comment '成本价', status int default 0 not null comment '上下架状态', real_stock decimal(12, 3) default 0.000 not null comment '仓库库存' ) comment '门店商品表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_goods_sku ( id int(11) unsigned auto_increment comment 'id' primary key, sku_id int default 0 not null comment 'sku_id', goods_id int default 0 not null comment '商品id', stock decimal(12, 3) default 0.000 not null comment '商品库存', sale_num decimal(12, 3) default 0.000 not null comment '商品销量', store_id int default 0 not null comment '门店id', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', price decimal(10, 2) default 0.00 not null comment '价格', cost_price decimal(10, 2) default 0.00 not null comment '成本价', status int default 0 not null comment '上下架状态', real_stock decimal(12, 3) default 0.000 not null comment '仓库库存' ) comment '门店sku表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_label ( label_id int auto_increment primary key, site_id int default 0 not null, label_name varchar(255) default '' not null, create_time int default 0 not null, sort int default 0 not null comment '排序号' ) comment '门店标签' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_member ( id int(11) unsigned auto_increment comment '主键' primary key, member_id int default 0 not null comment '会员id', store_id int default 0 not null comment '门店站点id', order_money decimal(10, 2) default 0.00 not null comment '付款后-消费金额', order_complete_money decimal(10, 2) default 0.00 not null comment '订单完成-消费金额', order_num int default 0 not null comment '付款后-消费次数', order_complete_num int default 0 not null comment '订单完成-消费次数', create_time int default 0 not null comment '创建时间' ) comment '门店会员管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_settlement ( id int(11) unsigned auto_increment primary key, settlement_no varchar(255) default '' not null comment '流水号', site_id int default 0 not null comment '站点id', site_name varchar(255) default '' not null comment '站点名称', store_id int default 0 not null comment '门店id', store_name varchar(255) default '' not null comment '门店名称', order_money decimal(10, 2) default 0.00 not null comment '订单总金额', shop_money decimal(10, 2) default 0.00 not null comment '店铺金额', refund_platform_money decimal(10, 2) default 0.00 not null comment '平台退款抽成', platform_money decimal(10, 2) default 0.00 not null comment '平台抽成', refund_shop_money decimal(10, 2) default 0.00 not null comment '店铺退款金额', refund_money decimal(10, 2) default 0.00 not null comment '退款金额', create_time int default 0 not null comment '创建时间', start_time int default 0 not null comment '账期开始时间', end_time int default 0 not null comment '账期结束时间', commission decimal(10, 2) default 0.00 not null comment '佣金支出', is_settlement tinyint default 0 not null comment '是否结算', remark varchar(500) default '' not null comment '备注', offline_order_money decimal(10, 2) default 0.00 not null comment '线下支付的订单金额', offline_refund_money decimal(10, 2) default 0.00 not null comment '线下退款金额', store_commission decimal(10, 2) default 0.00 not null comment '门店抽成金额', withdraw_id int default 0 not null comment '提现id' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_stock_import ( id int auto_increment primary key, site_id int default 0 not null, store_id int default 0 not null comment '门店id', filename varchar(255) default '' not null comment '文件名称', path varchar(255) default '' not null comment '地址', sku_num decimal(12, 3) default 0.000 not null comment '导入的sku商品数', error_num decimal(12, 3) default 0.000 not null comment '失败数量', create_time int default 0 not null ) comment ' 门店库存导入批量修改' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_stock_import_log ( id int auto_increment primary key, store_id int default 0 not null comment '门店id', file_id int default 0 not null comment '文件id', goods_id int default 0 not null comment '商品id', goods_name varchar(255) default '' not null comment '商品名称', sku_id int default 0 not null comment 'skuid', sku_name varchar(255) default '' not null comment 'sku名称', stock decimal(12, 3) default 0.000 not null comment '库存(增/减)', status tinyint default 0 not null comment '状态(0成功 -1失败)', reason varchar(255) default '' not null comment '原因' ) comment '门店导入库存失败记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_store_withdraw ( withdraw_id int auto_increment primary key, site_id int default 0 not null comment '站点id', withdraw_no varchar(50) default '' not null comment '提现交易号', store_name varchar(50) default '' not null comment '门店名称', store_id int default 0 not null comment '门店id', transfer_type varchar(20) default '' not null comment '转账提现类型', transfer_type_name varchar(20) default '' not null comment '转账方式名称', money decimal(10, 2) default 0.00 not null comment '提现到账金额', apply_time int default 0 not null comment '申请时间', audit_time int default 0 not null comment '审核时间', transfer_time int default 0 not null comment '转账时间', status int default 0 not null comment '状态0待审核1.待转账2已转账 -1拒绝 -2转账失败', remark varchar(100) default '' not null comment '备注', refuse_reason varchar(100) default '' not null comment '拒绝理由', status_name varchar(20) default '' not null comment '提现状态名称', bank_name varchar(255) default '' not null comment '银行名称', account_number varchar(255) default '' not null comment '收款账号', realname varchar(50) default '' not null comment '真实姓名', voucher_img varchar(255) default '' not null comment '凭证', voucher_desc varchar(255) default '' not null comment '凭证说明', fail_reason varchar(255) default '' not null comment '失败原因', settlement_type varchar(255) default '' not null comment '结算类型', settlement_type_name varchar(255) default '' not null comment '结算类型' ) comment '门店提现表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_supplier ( supplier_id int(11) unsigned auto_increment primary key, supplier_site_id int default 0 not null comment '供应商站点', title varchar(255) default '' not null comment '供应商名称', logo varchar(255) default '' not null comment '供应商logo', `desc` varchar(255) default '' not null comment '供应商简介', keywords varchar(255) default '' not null comment '供应商关键字', supplier_address varchar(255) default '' not null comment '供应商地址', supplier_email varchar(50) default '' not null comment '供应商邮箱', supplier_phone varchar(255) default '' not null comment '联系电话', supplier_qq varchar(255) default '' not null comment '供应商qq', supplier_weixin varchar(255) default '' not null comment '联系人微信号', account decimal(10, 2) default 0.00 not null comment '账户金额', account_withdraw decimal(10, 2) default 0.00 not null comment '已提现金额', account_withdraw_apply decimal(10, 2) default 0.00 not null comment '提现中金额', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', username varchar(255) default '' not null comment '供应商管理员', settlement_bank_account_name varchar(50) default '' not null comment '结算银行开户名', settlement_bank_account_number varchar(50) default '' not null comment '结算公司银行账号', settlement_bank_name varchar(50) default '' not null comment '结算开户银行支行名称', settlement_bank_address varchar(50) default '' not null comment '结算开户银行所在地' ) comment '供应商' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_syngoods ( id int auto_increment primary key, uniacid int default 0 not null, status int default 0 not null, page int default 1 not null ) charset = utf8mb4; create table if not exists lucky_sys_upgrade_log ( log_id int auto_increment primary key, upgrade_no varchar(255) default '' not null comment '升级编号 每次的编号都不同', upgrade_time int default 0 not null comment '升级时间 记录开始时间', version_info longtext null comment '版本信息 json数据 包含升级前和升级后的基本信息', backup_root varchar(255) default '' not null comment '备份文件和sql的根目录', download_root varchar(255) default '' not null comment '下载文件的根目录', status tinyint default 0 not null comment '升级状态 0 进行中 1 升级成功 2 升级失败', error_message varchar(255) default '' not null comment '升级失败错误信息' ) comment '系统升级日志' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_user ( uid int(11) unsigned auto_increment primary key, sys_uid int default 0 not null comment '系统用户id', app_module varchar(255) default '' not null comment '应用模块', app_group int default 0 not null comment '应用所属组', is_admin tinyint default 0 not null comment '是否是管理员', site_id int default 0 not null comment '站点id', group_id int default 0 not null comment '权限id', group_name varchar(50) default '' not null comment '权限组', username varchar(50) default '' not null comment '账号', password varchar(255) default '' not null comment '密码', member_id int default 0 not null comment '会员id', create_time int default 0 not null comment '创建时间', update_time int default 0 not null, status int default 1 not null comment '状态 1 正常', login_time int default 0 not null comment '最新一次登陆时间', login_ip varchar(255) default '' not null comment '最新登录ip', uniacid int default 0 null comment '平台id=platform_shop表uniacid 如果uniacid相同的为同一个平台', is_main int default 0 null comment '如果=1为主号其他均分分号' ) comment '站点后台用户表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_user on lucky_user (group_id, app_module); create index IDX_ns_user_member_id on lucky_user (member_id); create index IDX_ns_user_site_id on lucky_user (site_id); create index IDX_ns_user_username on lucky_user (username); create table if not exists lucky_user_group ( id int(11) unsigned auto_increment comment '主键' primary key, uid int default 0 not null comment '用户id', site_id int default 0 not null comment '对应站id(门店,供应商)', store_id int default 0 not null comment '管理的门店id', group_id int default 0 not null comment '用户组id', create_time int default 0 not null comment '创建时间', app_module varchar(255) default '' not null ) comment '用户与用户组关联表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_user_log ( id int(11) unsigned auto_increment comment '主键' primary key, uid int default 0 not null comment '操作用户ID', username varchar(255) default '' not null comment '昵称', site_id int default 0 not null comment '站点id', url varchar(255) default '' not null comment '对应url', data text null comment '传输数据', ip varchar(255) default '' not null comment 'ip地址', action_name varchar(255) default '' not null comment '操作行为', create_time int default 0 not null comment '创建时间' ) comment '用户操作日志' charset = utf8 row_format = DYNAMIC; create index IDX_ns_user_log on lucky_user_log (uid, site_id); create table if not exists lucky_v3_upgrade_log ( id int(11) unsigned auto_increment primary key, module varchar(255) default '' not null comment '模块标识', title varchar(255) default '' not null comment '模块名称', create_time int default 0 not null comment '迁移时间', remark varchar(255) default '' not null comment '备注', status int default 0 not null comment '迁移完成状态 1:完成 0 :未完成' ) comment 'v3Tov4迁移数据日志' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_verifier ( verifier_id int(11) unsigned auto_increment comment '核销员id' primary key, verifier_name varchar(255) default '' not null comment '核销员姓名', site_id int default 0 not null comment '商家id', member_id int default 0 not null comment '前台会员id', uid int default 0 not null comment '后台用户id', verifier_type tinyint default 0 not null comment '核销员类型:0平台核销员,1门店核销员', store_id int default 0 not null comment '门店id', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '核销员(商品或订单商品)' charset = utf8 row_format = DYNAMIC; create index IDX_ns_verifier_member_id on lucky_verifier (member_id); create index IDX_ns_verifier_site_id on lucky_verifier (site_id); create table if not exists lucky_verify ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', site_name varchar(255) default '' not null comment '站点名称', verify_code varchar(255) default '' not null comment '核销码', verify_type varchar(255) default '' not null comment '核销类型', verify_type_name varchar(255) default '' not null comment '核销类型名称', verify_content_json varchar(5000) default '' not null comment '核销相关数据', verifier_id int default 0 not null comment '核销员id', verifier_name varchar(255) default '' not null comment '核销员姓名', is_verify int default 0 not null comment '是否已经核销', create_time int default 0 not null comment '创建时间', verify_time int default 0 not null comment '核销时间', expire_time int default 0 not null comment '核销有效期 0永久', verify_from varchar(20) default 'mobile' not null comment '核销来源 shop 商家后台 store 门店后台 mobile 手机端', verify_remark varchar(50) default '' not null comment '核销备注', verify_total_count int default 0 not null comment '核销次数 0为不限核销次数', verify_use_num int default 0 not null comment '已核销次数', store_id int default 0 not null comment '所属门店 0为全部门店可核销', member_id int default 0 not null comment '会员id' ) comment '核销编码管理' charset = utf8 row_format = DYNAMIC; create index IDX_ns_verify_is_verify on lucky_verify (is_verify); create index IDX_ns_verify_site_id on lucky_verify (site_id); create index IDX_ns_verify_verify_code on lucky_verify (verify_code); create index IDX_ns_verify_verify_time on lucky_verify (verify_time); create index IDX_ns_verify_verify_type on lucky_verify (verify_type); create table if not exists lucky_verify_record ( id int(11) unsigned auto_increment comment '主键' primary key, site_id int default 0 not null comment '站点id', verify_code varchar(255) default '' not null comment '核销码', verifier_id int default 0 not null comment '核销员id', verifier_name varchar(255) default '' not null comment '核销员姓名', verify_time int default 0 not null comment '创建时间', verify_num int default 1 not null comment '核销次数', verify_from varchar(255) default 'mobile' not null comment '核销端口', store_id int default 0 not null comment '核销门店' ) comment '核销记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_virtual_stock ( stock_id int(11) unsigned auto_increment primary key, stock_name varchar(255) default '' not null comment '虚拟评价库名称', num int default 0 not null comment '评论条数', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', site_id int default 0 not null comment '站点id' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_weapp_audit_record ( id int auto_increment comment '审核id' primary key, site_id int default 0 not null comment '站点id', auditid varchar(255) default '' not null comment '审核编号', version varchar(255) default '' not null comment '版本号', status varchar(255) default '0' not null comment '审核状态 0审核中 1通过 -1失败 2延后 3已发布 4已撤回', create_time int default 0 not null comment '审核提交时间', audit_time int default 0 not null comment '审核通过时间', release_time int default 0 not null comment '发布时间', reason text null comment '未通过和延后的原因' ) comment '小程序审核记录表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_weapp_experiencer ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', wechatid varchar(255) default '' not null comment '微信号', userstr varchar(255) default '' not null comment '微信用户唯一值', create_time int default 0 not null comment '添加时间' ) comment '微信小程序体验者' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_weapp_goods ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', goods_id int default 0 not null comment '小程序商品库商品id 非商城商品id', name varchar(2000) default '' not null comment '商品名称', cover_img varchar(2000) default '' not null comment '商品图片链接', price decimal(10, 2) default 0.00 not null comment '商品价格', status int default 0 not null comment '商品状态,0:未审核。1:审核中,2:审核通过,3:审核驳回', url varchar(2000) default '' not null comment '商品小程序链接', audit_id int default 0 not null comment '审核单id', sku_id int default 0 not null comment '商品sku_id', third_party_tag int default 1 not null comment '商品来源 0在小程序平台添加的商品 1/2通过api添加的商品' ) charset = utf8 row_format = DYNAMIC; create table if not exists lucky_weapp_live_room ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', roomid int default 0 not null comment '直播间id', name varchar(255) default '' not null comment '房间名称', cover_img varchar(1000) default '' not null comment '房间背景封面', share_img varchar(1000) default '' not null comment '分享卡片图片', start_time int default 0 not null comment '直播计划开始时间', end_time int default 0 not null comment '直播计划结束时间', anchor_name varchar(255) default '' not null comment '主播昵称', goods text null comment '直播间商品', live_status varchar(255) default '' not null comment 'live_status 101: 直播中, 102: 未开始, 103: 已结束, 104: 禁播, 105: 暂停中, 106: 异常, 107: 已过期', anchor_img varchar(1000) default '' not null comment '主播头像', banner varchar(1000) default '' not null comment '直播间横幅' ) comment '小程序直播直播间表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_wechat_fans ( fans_id int auto_increment comment '粉丝ID' primary key, site_id int default 0 not null comment '站点id', nickname varchar(255) default '' not null comment '昵称', nickname_decode varchar(255) default '' not null comment '昵称编码', headimgurl varchar(500) default '' not null comment '头像', sex smallint default 1 not null comment '性别', language varchar(20) default '' not null comment '用户语言', country varchar(60) default '' not null comment '国家', province varchar(255) default '' not null comment '省', city varchar(255) default '' not null comment '城市', district varchar(255) default '' not null comment '行政区/县', openid varchar(255) default '' not null comment '用户的标识,对当前公众号唯一 用户的唯一身份ID', unionid varchar(255) default '' not null comment '粉丝unionid', groupid int default 0 not null comment '粉丝所在组id', is_subscribe bigint default 1 not null comment '是否订阅', remark varchar(255) default '' not null comment '备注', subscribe_time int default 0 not null comment '关注时间', subscribe_scene varchar(100) default '' not null comment '返回用户关注的渠道来源', unsubscribe_time int default 0 not null comment '取消关注时间', update_date int default 0 not null comment '粉丝信息最后更新时间', tagid_list varchar(255) default '' not null comment '用户被打上的标签ID列表', subscribe_scene_name varchar(50) default '' not null comment '返回用户关注的渠道来源名称', qr_scene varchar(255) default '' not null comment 'qr_scene', qr_scene_str varchar(255) default '' not null comment 'qr_scene_str' ) comment '微信粉丝列表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_weixin_fans on lucky_wechat_fans (unionid, openid); create table if not exists lucky_wechat_fans_tag ( id int auto_increment primary key, tags varchar(3000) default '' not null comment '微信拉取到的标签内容 json格式', tag_id int default 0 not null comment '标签id', tag_name varchar(50) default '' not null comment '标签名称' ) comment '微信粉丝标签表' charset = utf8 row_format = DYNAMIC; create index IDX_ns_wechat_fans_tag on lucky_wechat_fans_tag (tag_id); create table if not exists lucky_wechat_mass_recording ( id int(11) unsigned auto_increment primary key, status int default 0 not null comment '发送状态1-成功 0-失败', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间', member_label varchar(255) default '' not null comment '发送群体(会员标签)', media_id varchar(255) default '' not null comment '素材id', err varchar(1000) default '' not null comment '错误信息', content text null comment '内容' ) comment '微信消息记录' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_wechat_media ( id int auto_increment primary key, site_id int default 0 not null comment '站点id', type int default 0 not null comment '类型', value text null comment '值', create_time int default 0 not null comment '创建时间', update_time int default 0 not null comment '修改时间', media_id varchar(70) default '' not null comment '微信端返回的素材id' ) comment '微信素材表' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_wechat_qrcode ( id int auto_increment comment '实例ID' primary key, background varchar(255) default '' not null comment '背景图片', nick_font_color varchar(255) default '#000' not null comment '昵称字体颜色', nick_font_size smallint default 12 not null comment '昵称字体大小', is_logo_show smallint default 1 not null comment 'logo是否显示', header_left varchar(6) default '0px' not null comment '头部左边距', header_top varchar(6) default '0px' not null comment '头部上边距', name_left varchar(6) default '0px' not null comment '昵称左边距', name_top varchar(6) default '0px' not null comment '昵称上边距', logo_left varchar(6) default '0px' not null comment 'logo左边距', logo_top varchar(6) default '0px' not null comment 'logo上边距', code_left varchar(6) default '0px' not null comment '二维码左边距', code_top varchar(6) default '0px' not null comment '二维码上边距', is_default tinyint default 0 not null comment '是否默认', is_remove tinyint default 0 not null comment '是否删除 0未删除 1删除', update_time int default 0 not null ) comment '微信推广二维码模板管理' charset = utf8 row_format = DYNAMIC; create table if not exists lucky_wechat_replay_rule ( rule_id int(11) unsigned auto_increment primary key, site_id int default 0 not null comment '站点id', rule_name varchar(50) default '' not null comment '规则名称', rule_type varchar(255) default 'KEYWORDS' not null comment '规则类型KEYWORDS表示关键字,DEFAULT表示默认,AFTER表示关注后', keywords_json text null comment '关键字json', replay_json text null comment '回复内容json', create_time int default 0 not null comment '创建时间', modify_time int default 0 not null comment '修改时间' ) comment '微信回复规则' charset = utf8 row_format = DYNAMIC;