feat(admin): full integration of order, product, and finance modules with real RPC data streams
This commit is contained in:
32
docs/sql/10_schema/finance/ml_user_recharge_v1.sql
Normal file
32
docs/sql/10_schema/finance/ml_user_recharge_v1.sql
Normal file
@@ -0,0 +1,32 @@
|
||||
-- =====================================================================================
|
||||
-- Schema: 用户充值记录表
|
||||
-- 位置:docs/sql/10_schema/finance/
|
||||
-- 对象类型:Schema (DDL)
|
||||
-- 版本:v1
|
||||
-- 说明:记录用户主动发起的充值申请及支付状态
|
||||
-- =====================================================================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS public.ml_user_recharge (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
uid UUID NOT NULL REFERENCES public.ak_users(id),
|
||||
|
||||
order_no TEXT UNIQUE NOT NULL, -- 充值订单号(cz开头)
|
||||
recharge_type TEXT NOT NULL, -- 充值渠道: wechat, alipay, system (后台补单)
|
||||
|
||||
price DECIMAL(12,2) NOT NULL DEFAULT 0, -- 实际充值金额
|
||||
give_price DECIMAL(12,2) NOT NULL DEFAULT 0, -- 赠送金额
|
||||
|
||||
paid SMALLINT NOT NULL DEFAULT 0, -- 支付状态: 0:未支付, 1:已支付
|
||||
pay_time TIMESTAMPTZ NULL, -- 支付时间
|
||||
|
||||
channel_trade_no TEXT NULL, -- 外部渠道流水号
|
||||
status SMALLINT NOT NULL DEFAULT 1, -- 记录状态: 1:正常, 0:逻辑删除
|
||||
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- 索引
|
||||
CREATE INDEX IF NOT EXISTS ml_user_recharge_uid_idx ON public.ml_user_recharge (uid);
|
||||
CREATE INDEX IF NOT EXISTS ml_user_recharge_order_no_idx ON public.ml_user_recharge (order_no);
|
||||
CREATE INDEX IF NOT EXISTS ml_user_recharge_created_at_idx ON public.ml_user_recharge (created_at DESC);
|
||||
Reference in New Issue
Block a user