```[sql]
CREATE TABLE ns_member (
uid INT(11) NOT NULL COMMENT '用户ID',
member_name VARCHAR(50) NOT NULL DEFAULT '' COMMENT '前台用户名',
member_level INT(11) NOT NULL DEFAULT 0 COMMENT '会员等级',
member_label VARCHAR(255) NOT NULL DEFAULT '' COMMENT '会员标签',
memo VARCHAR(1000) DEFAULT NULL COMMENT '备注',
reg_time INT(11) DEFAULT 0 COMMENT '注册时间',
PRIMARY KEY (uid)
)
ENGINE = INNODB
AVG_ROW_LENGTH = 147
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '前台用户表';
CREATE TABLE ns_member_account (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
uid INT(11) NOT NULL COMMENT '会员uid',
shop_id INT(11) NOT NULL COMMENT '店铺ID',
point INT(11) NOT NULL DEFAULT 0 COMMENT '会员积分',
balance DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '余额',
coin INT(11) NOT NULL DEFAULT 0 COMMENT '购物币',
member_cunsum DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '会员消费',
member_sum_point INT(11) NOT NULL DEFAULT 0 COMMENT '会员累计积分',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 3276
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员账户统计表';
CREATE TABLE ns_member_account_records (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
uid INT(11) NOT NULL DEFAULT 0 COMMENT '用户ID',
shop_id INT(11) NOT NULL DEFAULT 0 COMMENT '店铺ID',
account_type INT(11) NOT NULL DEFAULT 1 COMMENT '账户类型1.积分2.余额3.购物币',
sign SMALLINT(6) NOT NULL DEFAULT 1 COMMENT '正负号',
number DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '数量',
from_type SMALLINT(6) NOT NULL DEFAULT 0 COMMENT '产生方式1.商城订单 2.订单退还 3.兑换 4.充值 5.签到 6.分享 7.注册 8.提现 9提现退还 10.商家调整 11.营销游戏 12.充值赠送',
data_id INT(11) NOT NULL DEFAULT 0 COMMENT '相关表的数据ID',
text VARCHAR(255) NOT NULL DEFAULT '' COMMENT '数据相关内容描述文本',
create_time INT(11) DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 108
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员流水账表';
CREATE TABLE ns_member_balance_withdraw (
id INT(11) NOT NULL AUTO_INCREMENT,
shop_id INT(11) NOT NULL COMMENT '店铺编号',
withdraw_no VARCHAR(255) NOT NULL DEFAULT '' COMMENT '提现流水号',
uid INT(11) NOT NULL COMMENT '会员id',
bank_name VARCHAR(50) NOT NULL COMMENT '提现银行名称',
account_number VARCHAR(50) NOT NULL COMMENT '提现银行账号',
realname VARCHAR(10) NOT NULL COMMENT '提现账户姓名',
mobile VARCHAR(20) NOT NULL COMMENT '手机',
cash DECIMAL(10, 2) NOT NULL COMMENT '提现金额',
status SMALLINT(6) NOT NULL DEFAULT 0 COMMENT '当前状态 0已申请(等待处理) 1已同意 -1 已拒绝',
memo VARCHAR(255) NOT NULL DEFAULT '' COMMENT '备注',
ask_for_date INT(11) DEFAULT 0 COMMENT '提现日期',
payment_date INT(11) DEFAULT 0 COMMENT '到账日期',
modify_date INT(11) DEFAULT 0 COMMENT '修改日期',
transfer_type INT(11) NOT NULL DEFAULT 1 COMMENT '转账方式 1 线下转账 2线上转账',
transfer_name VARCHAR(50) NOT NULL DEFAULT '' COMMENT '转账银行名称',
transfer_money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '转账金额',
transfer_status INT(11) DEFAULT 0 COMMENT '转账状态 0未转账 1已转账 -1转账失败',
transfer_remark VARCHAR(255) DEFAULT '' COMMENT '转账备注',
transfer_result VARCHAR(255) DEFAULT '' COMMENT '转账结果',
transfer_no VARCHAR(255) DEFAULT '' COMMENT '转账流水号',
transfer_account_no VARCHAR(255) DEFAULT '' COMMENT '转账银行账号',
wx_withd_type INT(11) DEFAULT 0 COMMENT '1、公众号 2、小程序',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 4096
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员余额提现记录表';
CREATE TABLE ns_member_bank_account (
id INT(11) NOT NULL AUTO_INCREMENT,
uid INT(11) NOT NULL COMMENT '会员id',
branch_bank_name VARCHAR(50) DEFAULT NULL COMMENT '支行信息',
realname VARCHAR(50) NOT NULL DEFAULT '' COMMENT '真实姓名',
account_number VARCHAR(50) NOT NULL DEFAULT '' COMMENT '银行账号',
mobile VARCHAR(20) NOT NULL DEFAULT '' COMMENT '手机号',
is_default INT(11) NOT NULL DEFAULT 0 COMMENT '是否默认账号',
create_date INT(11) DEFAULT 0 COMMENT '创建日期',
modify_date INT(11) DEFAULT 0 COMMENT '修改日期',
account_type INT(11) DEFAULT 1 COMMENT '账户类型,1:银行卡,2:微信,3:支付宝',
account_type_name VARCHAR(30) DEFAULT '银行卡' COMMENT '账户类型名称:银行卡,微信,支付宝',
wx_account_type INT(11) DEFAULT 1 COMMENT '1、公众号 2、小程序',
PRIMARY KEY (id),
INDEX IDX_member_bank_account_uid (uid)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 16384
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员提现账号';
CREATE TABLE ns_member_behavior_records (
id INT(11) NOT NULL AUTO_INCREMENT,
uid INT(11) NOT NULL COMMENT '会员id',
type VARCHAR(255) DEFAULT NULL COMMENT '行为操作:1 签到 2 点赞 3 分享 4 评论',
create_time INT(11) NOT NULL COMMENT '创建时间',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 2048
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员行为记录表';
CREATE TABLE ns_member_express_address (
id INT(11) NOT NULL AUTO_INCREMENT,
uid INT(11) NOT NULL COMMENT '会员基本资料表ID',
consigner VARCHAR(255) NOT NULL DEFAULT '' COMMENT '收件人',
mobile VARCHAR(11) NOT NULL DEFAULT '' COMMENT '手机',
phone VARCHAR(20) NOT NULL DEFAULT '' COMMENT '固定电话',
province INT(11) NOT NULL DEFAULT 0 COMMENT '省',
city INT(11) NOT NULL DEFAULT 0 COMMENT '市',
district INT(11) NOT NULL DEFAULT 0 COMMENT '区县',
address VARCHAR(255) NOT NULL DEFAULT '' COMMENT '详细地址',
zip_code VARCHAR(6) NOT NULL DEFAULT '' COMMENT '邮编',
alias VARCHAR(50) NOT NULL DEFAULT '' COMMENT '地址别名',
is_default INT(11) NOT NULL DEFAULT 0 COMMENT '默认收货地址',
PRIMARY KEY (id),
INDEX IDX_member_express_address_uid (uid)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 2340
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员收货地址管理';
CREATE TABLE ns_member_favorites (
log_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '记录ID',
uid INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员ID',
fav_id INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品或店铺ID',
fav_type VARCHAR(20) NOT NULL DEFAULT 'goods' COMMENT '类型:goods为商品,shop为店铺,默认为商品',
shop_id INT(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '店铺ID',
shop_name VARCHAR(20) NOT NULL DEFAULT '' COMMENT '店铺名称',
shop_logo VARCHAR(255) NOT NULL DEFAULT '' COMMENT '店铺logo',
goods_name VARCHAR(255) NOT NULL DEFAULT '' COMMENT '商品名称',
goods_image VARCHAR(300) DEFAULT NULL,
log_price DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '商品收藏时价格',
log_msg VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '收藏备注',
fav_time INT(11) DEFAULT 0 COMMENT '收藏时间',
PRIMARY KEY (log_id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 8192
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '收藏表';
CREATE TABLE ns_member_gift (
gift_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
uid INT(11) NOT NULL COMMENT '会员ID',
promotion_gift_id INT(11) NOT NULL COMMENT '赠品活动ID',
goods_id INT(11) NOT NULL COMMENT '赠品ID',
goods_name VARCHAR(255) NOT NULL DEFAULT '' COMMENT '赠品名称',
goods_picture INT(11) NOT NULL DEFAULT 0 COMMENT '赠品图片',
num INT(11) NOT NULL DEFAULT 1 COMMENT '赠品数量',
get_type INT(11) NOT NULL DEFAULT 1 COMMENT '获取方式',
get_type_id INT(11) NOT NULL COMMENT '获取方式对应ID',
`desc` TEXT NOT NULL COMMENT '说明',
create_time INT(11) DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (gift_id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员赠品表';
CREATE TABLE ns_member_label (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标签id',
shop_id INT(11) NOT NULL DEFAULT 0 COMMENT '店铺id',
label_name VARCHAR(50) NOT NULL DEFAULT '' COMMENT '标签名称',
`desc` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '标签描述',
create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 8192
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员标签';
CREATE TABLE ns_member_level (
level_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '等级ID',
shop_id INT(11) NOT NULL DEFAULT 0 COMMENT '店铺ID',
level_name VARCHAR(50) NOT NULL DEFAULT '' COMMENT '等级名称',
min_integral INT(11) NOT NULL DEFAULT 0 COMMENT '累计积分',
goods_discount DECIMAL(3, 2) NOT NULL DEFAULT 1.00 COMMENT '折扣率',
`desc` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '等级描述',
is_default INT(11) NOT NULL DEFAULT 0 COMMENT '是否是默认',
quota INT(11) NOT NULL DEFAULT 0 COMMENT '消费额度',
`upgrade` INT(11) NOT NULL DEFAULT 1 COMMENT '升级条件 1.累计积分 2.消费额度 3.同时满足',
relation INT(11) NOT NULL DEFAULT 1 COMMENT '1.或 2. 且',
buy_goods_id INT(11) NOT NULL DEFAULT 0 COMMENT '购买商品id',
order_num INT(11) NOT NULL DEFAULT 0 COMMENT '购买量',
give_coupon VARCHAR(255) NOT NULL DEFAULT '' COMMENT '赠送优惠券 优惠券id:数量,优惠券id:数量',
give_point INT(11) NOT NULL DEFAULT 0 COMMENT '赠送积分',
give_money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '赠送余额',
level INT(11) NOT NULL DEFAULT 0 COMMENT '等级排序',
PRIMARY KEY (level_id)
)
ENGINE = INNODB
AUTO_INCREMENT = 3
AVG_ROW_LENGTH = 16384
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员等级';
CREATE TABLE ns_member_level_records (
records_id INT(11) NOT NULL AUTO_INCREMENT,
level_id INT(11) NOT NULL COMMENT '升级等级id',
level INT(11) NOT NULL COMMENT '升级级别',
level_name VARCHAR(50) NOT NULL DEFAULT '' COMMENT '等级名称',
create_time INT(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
PRIMARY KEY (records_id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 2048
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员升级记录表';
CREATE TABLE ns_member_recharge (
id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
recharge_money DECIMAL(10, 2) NOT NULL DEFAULT 0.00 COMMENT '支付金额',
uid VARCHAR(255) NOT NULL COMMENT '用户uid',
out_trade_no VARCHAR(255) NOT NULL DEFAULT '' COMMENT '支付流水号',
create_time VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '创建时间',
is_pay VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '是否支付',
status VARCHAR(255) NOT NULL DEFAULT '0' COMMENT '状态',
is_grant INT(1) NOT NULL DEFAULT 0 COMMENT '充值礼品是否发放 0未发放 1已发放',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 16384
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员充值余额记录';
CREATE TABLE ns_member_withdraw_setting (
id INT(10) NOT NULL AUTO_INCREMENT COMMENT '主键',
shop_id INT(11) NOT NULL COMMENT '店铺id(单店版为0)',
withdraw_cash_min DECIMAL(10, 2) NOT NULL COMMENT '最低提现金额',
withdraw_multiple INT(11) NOT NULL DEFAULT 0 COMMENT '提现倍数',
withdraw_poundage INT(100) DEFAULT 0 COMMENT '提现手续费比率',
withdraw_message VARCHAR(255) DEFAULT '' COMMENT '提现提示信息',
withdraw_account_type VARCHAR(255) DEFAULT NULL COMMENT '提现支持账号(目前只有银联卡)',
create_time DATETIME DEFAULT NULL COMMENT '创建时间',
modify_time DATETIME DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
AVG_ROW_LENGTH = 16384
CHARACTER SET utf8
COLLATE utf8_general_ci
COMMENT = '会员提现设置';
```