重命名资源套餐相关结构体和数据库表,新增长效套餐类型

This commit is contained in:
2025-05-17 15:54:42 +08:00
parent 9043dd779b
commit d9613a19fb
22 changed files with 859 additions and 1196 deletions

View File

@@ -733,14 +733,14 @@ comment on column resource.id is '套餐ID';
comment on column resource.user_id is '用户ID';
comment on column resource.resource_no is '套餐编号';
comment on column resource.active is '套餐状态';
comment on column resource.type is '套餐类型1-动态2-隧道3-独享';
comment on column resource.type is '套餐类型1-短效动态2-长效动态';
comment on column resource.created_at is '创建时间';
comment on column resource.updated_at is '更新时间';
comment on column resource.deleted_at is '删除时间';
-- resource_pss
drop table if exists resource_pss cascade;
create table resource_pss (
-- resource_short
drop table if exists resource_short cascade;
create table resource_short (
id serial primary key,
resource_id int not null references resource (id)
on update cascade
@@ -754,58 +754,51 @@ create table resource_pss (
daily_used int not null default 0,
daily_last timestamp
);
create index resource_pss_resource_id_index on resource_pss (resource_id);
create index resource_short_resource_id_index on resource_short (resource_id);
-- resource_pss表字段注释
comment on table resource_pss is '动态代理套餐表';
comment on column resource_pss.id is 'ID';
comment on column resource_pss.resource_id is '套餐ID';
comment on column resource_pss.type is '套餐类型1-包时2-包量';
comment on column resource_pss.live is '可用时长(秒)';
comment on column resource_pss.quota is '配额数量';
comment on column resource_pss.used is '已用数量';
comment on column resource_pss.expire is '过期时间';
comment on column resource_pss.daily_limit is '每日限制';
comment on column resource_pss.daily_used is '今日已用数量';
comment on column resource_pss.daily_last is '今日最后使用时间';
-- resource_short表字段注释
comment on table resource_short is '短效动态套餐表';
comment on column resource_short.id is 'ID';
comment on column resource_short.resource_id is '套餐ID';
comment on column resource_short.type is '套餐类型1-包时2-包量';
comment on column resource_short.live is '可用时长(秒)';
comment on column resource_short.quota is '配额数量';
comment on column resource_short.used is '已用数量';
comment on column resource_short.expire is '过期时间';
comment on column resource_short.daily_limit is '每日限制';
comment on column resource_short.daily_used is '今日已用数量';
comment on column resource_short.daily_last is '今日最后使用时间';
-- resource_psr
drop table if exists resource_psr cascade;
create table resource_psr (
-- resource_long
drop table if exists resource_long cascade;
create table resource_long (
id serial primary key,
resource_id int not null references resource (id)
on update cascade
on delete cascade,
type int,
live int,
conn int,
expire timestamp,
used bool
quota int,
used int not null default 0,
daily_limit int not null default 0,
daily_used int not null default 0,
daily_last timestamp
);
create index resource_psr_resource_id_index on resource_psr (resource_id);
create index resource_long_resource_id_index on resource_long (resource_id);
-- resource_psr表字段注释
comment on table resource_psr is '隧道代理套餐表';
comment on column resource_psr.id is 'ID';
comment on column resource_psr.resource_id is '套餐ID';
comment on column resource_psr.live is '轮换周期(秒)';
comment on column resource_psr.conn is '最大连接数';
comment on column resource_psr.expire is '过期时间';
comment on column resource_psr.used is '是否已使用';
-- resource_pps
drop table if exists resource_pps cascade;
create table resource_pps (
id serial primary key,
resource_id int not null references resource (id)
on update cascade
on delete cascade
);
create index resource_pps_resource_id_index on resource_pps (resource_id);
-- resource_pps表字段注释
comment on table resource_pps is '独享代理套餐表';
comment on column resource_pps.id is 'ID';
comment on column resource_pps.resource_id is '套餐ID';
-- resource_long表字段注释
comment on table resource_long is '长效动态套餐表';
comment on column resource_long.id is 'ID';
comment on column resource_long.resource_id is '套餐ID';
comment on column resource_long.type is '套餐类型1-包时2-包量';
comment on column resource_long.live is '可用时长(秒)';
comment on column resource_long.quota is '配额数量';
comment on column resource_long.used is '已用数量';
comment on column resource_long.expire is '过期时间';
comment on column resource_long.daily_limit is '每日限制';
comment on column resource_long.daily_used is '今日已用数量';
comment on column resource_long.daily_last is '今日最后使用时间';
-- endregion