实现余额购买接口 & 实现全局 id 生成器
This commit is contained in:
@@ -496,27 +496,27 @@ comment on column whitelist.deleted_at is '删除时间';
|
||||
drop table if exists channel cascade;
|
||||
create table channel (
|
||||
id serial primary key,
|
||||
user_id int not null references "user" (id)
|
||||
user_id int not null references "user" (id)
|
||||
on update cascade
|
||||
on delete cascade,
|
||||
proxy_id int not null references proxy (id) --
|
||||
on update cascade --
|
||||
proxy_id int not null references proxy (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
node_id int references node (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
node_id int references node (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
proxy_host varchar(255) not null default '',
|
||||
proxy_port int not null,
|
||||
proxy_port int not null,
|
||||
node_host varchar(255),
|
||||
protocol varchar(255),
|
||||
auth_ip bool not null default false,
|
||||
auth_ip bool not null default false,
|
||||
user_host varchar(255),
|
||||
auth_pass bool not null default false,
|
||||
auth_pass bool not null default false,
|
||||
username varchar(255) unique,
|
||||
password varchar(255),
|
||||
expiration timestamp not null,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
expiration timestamp not null,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
);
|
||||
create index channel_user_id_index on channel (user_id);
|
||||
@@ -718,7 +718,7 @@ create table trade (
|
||||
remark varchar(255),
|
||||
amount decimal(12, 2) not null default 0,
|
||||
payment decimal(12, 2) not null default 0,
|
||||
method int not null default 0,
|
||||
method int not null,
|
||||
status int not null default 0,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
@@ -747,27 +747,29 @@ comment on column trade.deleted_at is '删除时间';
|
||||
-- bill
|
||||
drop table if exists bill cascade;
|
||||
create table bill (
|
||||
id serial primary key,
|
||||
trade_id int not null references trade (id)
|
||||
id serial primary key,
|
||||
user_id int not null references "user" (id)
|
||||
on update cascade
|
||||
on delete cascade,
|
||||
user_id int not null references "user" (id)
|
||||
on update cascade
|
||||
on delete cascade,
|
||||
product_id int references product (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
info varchar(255),
|
||||
count int default 0,
|
||||
price decimal(12, 2) not null default 0,
|
||||
amount decimal(12, 2) not null default 0,
|
||||
payment decimal(12, 2) not null default 0,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
trade_id int references trade (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
resource_id int references resource (id) --
|
||||
on update cascade --
|
||||
on delete set null,
|
||||
bill_no varchar(255) not null unique,
|
||||
type int not null,
|
||||
info varchar(255),
|
||||
amount decimal(12, 2) not null default 0,
|
||||
payment decimal(12, 2) not null default 0,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
);
|
||||
create index bill_user_id_index on bill (user_id);
|
||||
create index bill_trade_id_index on bill (trade_id);
|
||||
create index bill_product_id_index on bill (product_id);
|
||||
create index bill_resource_id_index on bill (resource_id);
|
||||
create index bill_type_index on bill (type);
|
||||
create index bill_deleted_at_index on bill (deleted_at);
|
||||
|
||||
-- bill表字段注释
|
||||
@@ -775,10 +777,10 @@ comment on table bill is '账单表';
|
||||
comment on column bill.id is '账单ID';
|
||||
comment on column bill.trade_id is '订单ID';
|
||||
comment on column bill.user_id is '用户ID';
|
||||
comment on column bill.product_id is '产品ID';
|
||||
comment on column bill.resource_id is '套餐ID';
|
||||
comment on column bill.bill_no is '易读账单号';
|
||||
comment on column bill.info is '产品可读信息';
|
||||
comment on column bill.count is '购买数量';
|
||||
comment on column bill.price is '单价';
|
||||
comment on column bill.type is '账单类型:0-充值,1-消费,2-退款';
|
||||
comment on column bill.amount is '总金额';
|
||||
comment on column bill.payment is '支付金额';
|
||||
comment on column bill.created_at is '创建时间';
|
||||
|
||||
Reference in New Issue
Block a user