Files
liche/sql/app/liche.sql
T
2022-07-25 15:12:13 +08:00

128 lines
8.2 KiB
SQL

-- ----------------------------
-- Title:狸车小程序用户表
-- Author:lcc
-- Table:lc_app_liche_users
-- ---------------------------
drop table if exists lc_app_liche_users;
create table lc_app_liche_users (
id int(10) unsigned not null auto_increment comment '自增id',
mobile varchar(11) not null default '' comment '手机号码',
nickname varchar(32) not null default '' comment '用户名/微信昵称',
headimg varchar(200) not null default '' comment '用户头像',
signature varchar(256) not null comment '用户签名',
unionid varchar(32) not null default '' comment 'unionid',
openid varchar(32) not null default '' comment 'openid',
jsondata json default null comment '其他信息',
status tinyint(1) not null default '1' comment '状态:-1删除,0禁用,1正常',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车小程序用户表';
alter table lc_app_liche_users add dealer tinyint(1) not null default '0' comment '是否分销' after jsondata;
alter table lc_app_liche_users add up_uid int(10) not null default '0' comment '上级uid' after dealer;
alter table lc_app_liche_users add manage tinyint(1) not null default 0 comment '是否分销管理' after dealer;
alter table lc_app_liche_users add deal_uid int(10) not null default 0 comment '审核分销uid' after dealer;
alter table lc_app_liche_users add credits int(10) unsigned not null default '0' COMMENT '当前可用积分' after nickname;
alter table lc_app_liche_users add freeze_credits int(10) unsigned not null default '0' COMMENT '冻结积分' after credits;
alter table lc_app_liche_users add expire_time int(10) unsigned not null default '0' COMMENT '积分过期时间' after freeze_credits
-- ----------------------------
-- Title:狸车小程序cms
-- Author:lcc
-- Table:lc_app_liche_cms
-- ---------------------------
drop table if exists lc_app_liche_cms;
create table lc_app_liche_cms (
id int(10) unsigned not null auto_increment comment '自增id',
title varchar(128) not null default '' comment '标题',
url varchar(128) not null default '' comment '链接',
cover varchar(128) not null default '' comment '图片',
content text comment '详情',
s_time int(10) unsigned not null default '0' comment '开始时间',
e_time int(10) unsigned not null default '0' comment '结束时间 0表示长期有效',
type tinyint(1) not null default '1' comment '类型 1购车 ',
target_id int(10) unsigned not null default '0' comment '对象id',
position tinyint(1) not null default '0' comment '默认0首页',
jsondata json default null comment '其他信息',
sort int(11) not null default '0' comment '排序',
status tinyint(1) not null default '1' comment '状态 -1.删除,0.禁用,1.启用',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车小程序cms';
-- ----------------------------
-- Title:狸车用户数据表
-- Author:lcc
-- Table:lc_app_liche_udata
-- ---------------------------
drop table if exists lc_app_liche_udata;
create table lc_app_liche_udata (
id int(10) unsigned not null auto_increment comment '自增id',
cf_id int(10) unsigned not null default '0' comment '来源id',
type int(10) unsigned not null default '0' comment '类型(0推广素材二维码)',
datatype char(10) not null default '0' comment '数据类型 img video',
dataurl char(200) not null default '' comment '资源地址',
jsondata json default null comment '附加字段',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车用户数据表';
alter table lc_app_liche_udata add app_uid int(10) unsigned not null default 0 comment '用户id' after cf_id;
-- ----------------------------
-- Title:用户购车订单
-- Author:lcc
-- Table:lc_app_liche_orders
-- ---------------------------
drop table if exists lc_app_liche_orders;
create table lc_app_liche_orders (
id int(10) unsigned not null auto_increment comment '自增id',
o_id int(10) unsigned not null default '0' comment '订单表id',
uid int(10) unsigned not null default '0' comment '用户id',
entrust_uid int(10) not null default '0' comment '委托人用户id',
pay_uid int(10) not null default '0' comment '付款人用户id',
sid varchar(32) not null default '' comment '订单号',
mch_id varchar(30) not null default '' comment '支付商户号',
pid int(10) unsigned not null default '0' comment '父订单id',
brand_id int(10) not null default '0' comment '品牌id',
s_id int(10) unsigned not null default '0' comment '车系id',
v_id int(10) unsigned not null default '0' comment '车型号',
cor_id int(10) not null default '0' comment '车身颜色id',
incor_id int(10) unsigned not null default '0' comment '内饰颜色id',
company_id int(11) not null default '0' comment '公司id',
total_price decimal(12,2) not null default '0.00' comment '订单价格',
pay_price decimal(12,2) not null default '0.00' comment '实付金额',
descrip varchar(255) not null default '' comment '备注/描述',
type tinyint(2) unsigned not null default '0' comment '订单类型 1定金 2服务费 3尾款 4意向金 5后台添加',
status tinyint(1) not null default '0' comment '支付状态 0未支付 1已支付',
pay_time timestamp not null default '0000-00-00 00:00:00' comment '付款时间',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户购车订单'
alter table lc_app_liche_orders add img varchar(100) not null default '' comment '支付截图' after descrip;
alter table lc_app_liche_orders add admin_id int(10) not null default 0 comment '管理员id' after uid;
-- ----------------------------
-- Title:狸车小程序用户积分日志表
-- Author:lcc
-- Table:lc_app_liche_credits_log
-- ---------------------------
drop table if exists lc_app_liche_credits_log;
create table lc_app_liche_credits_log (
id int(10) unsigned not null auto_increment comment '自增id',
uid int(10) unsigned not null comment '用户id',
credit_in int(11) not null comment '积分入账',
credit_out int(11) not null comment '积分出账',
credit_left int(11) not null comment '剩余积分',
type tinyint(1) not null default '1' comment '类型 0活动 1派单成功 2完成试驾 3开票 4后台录入 5兑换商品',
target_id int(10) not null default '0' comment '来源id',
remark text comment '备注更多信息',
jsondata json default null comment '其他信息',
c_time int(10) unsigned not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp,
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='狸车小程序用户积分日志表'