feat(distribution): 分销站点消息中心与钱包提现多租户独立分支隔离
- 新增 000070 数据库迁移:支持 chat_conversations、wallet_accounts、wallet_ledger、withdrawal_requests 按 distribution_site_id 隔离 - 消息中心:会话列表、未读数统计、站点专属客服及订单群聊与主站实现双向完全隔离 - 资金账户与提现:独立按 (user_id, distribution_site_id) 建账,分销订单自动结算至对应分站钱包,提现与流水相互独立 - 前台界面:Axios 自动透传 X-Distribution-Site-Code,钱包、提现与消息页面呈现分站专属标牌与独立说明
This commit is contained in:
@@ -106,21 +106,23 @@ func (r *Repository) Review(ctx context.Context, adminID, id uint64, req ReviewW
|
||||
// 如果拒绝,解冻余额
|
||||
if !approved {
|
||||
if err := wallet.AppendEntries(tx, wallet.Entry{
|
||||
UserID: withdrawal.UserID,
|
||||
Direction: "out",
|
||||
AmountCent: withdrawal.AmountCent,
|
||||
BalanceType: "frozen",
|
||||
BizType: "withdraw_reject",
|
||||
BizNo: withdrawal.WithdrawNo,
|
||||
Remark: fmt.Sprintf("提现被拒绝: %s", req.Remark),
|
||||
UserID: withdrawal.UserID,
|
||||
DistributionSiteID: withdrawal.DistributionSiteID,
|
||||
Direction: "out",
|
||||
AmountCent: withdrawal.AmountCent,
|
||||
BalanceType: "frozen",
|
||||
BizType: "withdraw_reject",
|
||||
BizNo: withdrawal.WithdrawNo,
|
||||
Remark: fmt.Sprintf("提现被拒绝: %s", req.Remark),
|
||||
}, wallet.Entry{
|
||||
UserID: withdrawal.UserID,
|
||||
Direction: "in",
|
||||
AmountCent: withdrawal.AmountCent,
|
||||
BalanceType: "available",
|
||||
BizType: "withdraw_reject",
|
||||
BizNo: withdrawal.WithdrawNo,
|
||||
Remark: fmt.Sprintf("提现被拒绝: %s", req.Remark),
|
||||
UserID: withdrawal.UserID,
|
||||
DistributionSiteID: withdrawal.DistributionSiteID,
|
||||
Direction: "in",
|
||||
AmountCent: withdrawal.AmountCent,
|
||||
BalanceType: "available",
|
||||
BizType: "withdraw_reject",
|
||||
BizNo: withdrawal.WithdrawNo,
|
||||
Remark: fmt.Sprintf("提现被拒绝: %s", req.Remark),
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -166,13 +168,14 @@ func (r *Repository) ConfirmPayment(ctx context.Context, adminID, id uint64, req
|
||||
|
||||
// 扣除冻结余额
|
||||
if err := wallet.AppendEntries(tx, wallet.Entry{
|
||||
UserID: withdrawal.UserID,
|
||||
Direction: "out",
|
||||
AmountCent: withdrawal.AmountCent,
|
||||
BalanceType: "frozen",
|
||||
BizType: "withdraw_complete",
|
||||
BizNo: withdrawal.WithdrawNo,
|
||||
Remark: "提现完成",
|
||||
UserID: withdrawal.UserID,
|
||||
DistributionSiteID: withdrawal.DistributionSiteID,
|
||||
Direction: "out",
|
||||
AmountCent: withdrawal.AmountCent,
|
||||
BalanceType: "frozen",
|
||||
BizType: "withdraw_complete",
|
||||
BizNo: withdrawal.WithdrawNo,
|
||||
Remark: "提现完成",
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user