Files
liche/sql/app/app.sql
T
2021-08-20 17:53:47 +08:00

138 lines
7.8 KiB
SQL

-- ----------------------------
-- Title:小程序表
-- Author:laa
-- Table:lc_app
-- ---------------------------
drop table if exists lc_app;
create table lc_app (
id int(11) not null auto_increment,
name char(30) not null default '' comment '名称', logo varchar(128) not null default '' comment 'logo', jsondata text comment '更多数据',
c_time int(10) not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp comment '更新时间',
primary key (id)
) engine=innodb default CHARSET=utf8mb4 comment='小程序表';
-- ----------------------------
-- Title:app配置表
-- Author:xxb
-- Table:lc_app_config
-- ---------------------------
drop table if exists lc_app_config;
create table lc_app_config (
id int(10) unsigned not null auto_increment comment '自增id',
app_id int unsigned not null default 0 comment '小程序id',
title varchar(128) not null default '' comment '标题',
k varchar(32) not null comment '配置key',
v json default null comment '配置数据',
admin_id int unsigned not null default 0 comment '操作员ID',
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 comment='app配置表';
-- ----------------------------
-- Title:支付回调日志
-- Author:lcc
-- Table:lc_app_wxpaylog
-- ---------------------------
drop table if exists lc_app_wxpaylog;
create table lc_app_wxpaylog (
id int(11) unsigned not null auto_increment comment '自增id',
app_id int(10) unsigned not null default '1' comment '小程序id',
sid varchar(32) not null comment '订单号',
trade_no varchar(32) not null comment '支付流水号',
notify_param text comment '回调参数',
u_time timestamp not null default current_timestamp comment '更新时间',
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='支付回调日志';
-- ----------------------------
-- Title:用户资金账户表
-- Author:lcc
-- Table:lc_app_user_account
-- ---------------------------
drop table if exists lc_app_user_account;
create table lc_app_user_account (
id int(10) unsigned not null auto_increment comment 'id',
app_id int(10) unsigned not null comment '小程序id',
app_uid int(10) unsigned not null comment '小程序用户id',
biz_id int(11) not null default '0' comment '商家id',
type tinyint(1) not null default '1' comment '账户类型 0.系统账户, 1.用户账户, 2.商家账户',
money_total decimal(12,2) not null default '0.00' comment '资金总额',
money_freeze decimal(12,2) not null default '0.00' comment '冻结资金',
money_left decimal(12,2) not null default '0.00' comment '余额',
jsondata json default null comment '其他',
status tinyint(1) not null default '1' comment '账户状态-1销户 0冻结 1正常',
c_time int(11) 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='用户资金账户表';
-- ----------------------------
-- Title:账户资金流水表
-- Author:lcc
-- Table:lc_app_user_accountlog
-- ---------------------------
drop table if exists lc_app_user_accountlog;
create table lc_app_user_accountlog (
id int(10) unsigned not null auto_increment comment 'id',
account_id int(10) unsigned not null default '0' comment '账户id',
sid varchar(32) not null default '' comment '订单号',
trade_type tinyint(4) not null default '0' comment '交易类型 1入账 2提现 3冲正 4转账',
money_type varchar(32) not null default '' comment '金额类型',
cfrom varchar(32) not null default '' comment '金额类型',
money_in decimal(12,2) not null default '0.00' comment '收入金额',
money_out decimal(12,2) not null default '0.00' comment '支出金额',
money_left decimal(12,2) not null default '0.00' comment '当前余额',
descrip varchar(255) not null default '' comment '流水说明',
jsondata json default null comment '更多数据',
status tinyint(1) not null default '0' comment ' -1失败 0进行中 1已完成',
ck varchar(32) not null default '' comment '同一批校验码',
c_time int(11) 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='账户资金流水表';
-- ----------------------------
-- Title:分销-记录表
-- Author:lcc
-- Table:lc_app_deal_log
-- ---------------------------
drop table if exists lc_app_deal_log;
create table lc_app_deal_log (
id int(10) unsigned not null auto_increment comment '自增id',
app_id int(10) unsigned not null comment '小程序id',
app_uid int(10) unsigned not null comment '小程序用户id',
cf_sid varchar(32) not null comment '来源订单号',
type tinyint(1) not null default '0' comment '类型(0自己购买1团员购买2粉丝购买3团员粉丝购买)',
t_uid int(10) unsigned not null default '0' comment '根据type加id',
ex_id int(10) unsigned not null default '0' comment '核销码id',
money decimal(12,2) not null default '0.00' comment '佣金',
remark varchar(256) not null default '' comment '备注',
status tinyint(1) not null default '0' comment '状态(-1无效 0待确认 1已入账)',
c_time int(11) not null default '0' comment '创建时间',
u_time timestamp not null default current_timestamp on update current_timestamp comment '更新时间',
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='分销-记录表';
-- ----------------------------
-- Title:分销-申请表
-- Author:lcc
-- Table:lc_app_deal_apply
-- ---------------------------
drop table if exists lc_app_deal_apply;
create table lc_app_deal_apply (
id int(10) unsigned not null auto_increment comment '自增id',
app_id int(10) unsigned not null default '0' comment '小程序id',
app_uid int(10) unsigned not null default '0' comment '用户id',
opt_uid int(10) unsigned not null default '0' comment '审核用户uid',
remark varchar(255) not null default '' comment '备注',
status tinyint(1) not null default '0' 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 comment '更新时间',
primary key (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='分销-申请表';