重构交易处理逻辑,合并充值与购买流程,优化交易状态管理;更新相关数据结构和接口
This commit is contained in:
@@ -68,14 +68,14 @@ comment on column logs_login.time is '登录时间';
|
||||
drop table if exists logs_user_usage cascade;
|
||||
create table logs_user_usage (
|
||||
id serial primary key,
|
||||
user_id int not null,
|
||||
resource_id int not null,
|
||||
count int not null,
|
||||
user_id int not null,
|
||||
resource_id int not null,
|
||||
count int not null,
|
||||
prov varchar(255),
|
||||
city varchar(255),
|
||||
isp varchar(255),
|
||||
ip varchar(45) not null,
|
||||
time timestamp not null
|
||||
ip varchar(45) not null,
|
||||
time timestamp not null
|
||||
);
|
||||
create index logs_user_usage_user_id_index on logs_user_usage (user_id);
|
||||
create index logs_user_usage_resource_id_index on logs_user_usage (resource_id);
|
||||
@@ -868,27 +868,28 @@ comment on column resource_long.daily_last is '今日最后使用时间';
|
||||
-- trade
|
||||
drop table if exists trade cascade;
|
||||
create table trade (
|
||||
id serial primary key,
|
||||
user_id int not null references "user" (id)
|
||||
id serial primary key,
|
||||
user_id int not null references "user" (id)
|
||||
on update cascade
|
||||
on delete cascade,
|
||||
inner_no varchar(255) not null unique,
|
||||
outer_no varchar(255),
|
||||
type int not null,
|
||||
subject varchar(255) not null,
|
||||
remark varchar(255),
|
||||
amount decimal(12, 2) not null default 0,
|
||||
payment decimal(12, 2) not null default 0,
|
||||
method int not null,
|
||||
platform int not null,
|
||||
acquirer int,
|
||||
status int not null default 0,
|
||||
pay_url text,
|
||||
paid_at timestamp,
|
||||
cancel_at timestamp,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
inner_no varchar(255) not null unique,
|
||||
outer_no varchar(255),
|
||||
type int not null,
|
||||
subject varchar(255) not null,
|
||||
remark varchar(255),
|
||||
amount decimal(12, 2) not null default 0,
|
||||
payment decimal(12, 2) not null default 0,
|
||||
method int not null,
|
||||
platform int not null,
|
||||
acquirer int,
|
||||
status int not null default 0,
|
||||
refunded bool not null default false,
|
||||
payment_url text,
|
||||
completed_at timestamp,
|
||||
canceled_at timestamp,
|
||||
created_at timestamp default current_timestamp,
|
||||
updated_at timestamp default current_timestamp,
|
||||
deleted_at timestamp
|
||||
);
|
||||
create index trade_user_id_index on trade (user_id);
|
||||
create index trade_outer_no_index on trade (outer_no);
|
||||
@@ -906,14 +907,14 @@ comment on column trade.type is '订单类型:1-购买产品,2-充值余额'
|
||||
comment on column trade.subject is '订单主题';
|
||||
comment on column trade.remark is '订单备注';
|
||||
comment on column trade.amount is '订单总金额';
|
||||
comment on column trade.payment is '支付金额';
|
||||
comment on column trade.payment is '实际支付金额';
|
||||
comment on column trade.method is '支付方式:1-支付宝,2-微信,3-商福通渠道支付宝,4-商福通渠道微信';
|
||||
comment on column trade.platform is '支付平台:1-电脑网站,2-手机网站';
|
||||
comment on column trade.acquirer is '收单机构:1-支付宝,2-微信,3-银联';
|
||||
comment on column trade.status is '订单状态:0-待支付,1-已支付,2-已取消';
|
||||
comment on column trade.pay_url is '支付链接';
|
||||
comment on column trade.paid_at is '支付时间';
|
||||
comment on column trade.cancel_at is '取消时间';
|
||||
comment on column trade.payment_url is '支付链接';
|
||||
comment on column trade.completed_at is '支付时间';
|
||||
comment on column trade.canceled_at is '取消时间';
|
||||
comment on column trade.created_at is '创建时间';
|
||||
comment on column trade.updated_at is '更新时间';
|
||||
comment on column trade.deleted_at is '删除时间';
|
||||
|
||||
Reference in New Issue
Block a user