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:
yml2213
2026-09-07 18:11:27 +08:00
parent 72b805c499
commit e024319860
35 changed files with 1109 additions and 298 deletions
@@ -69,29 +69,35 @@ func appendCheckoutOwnerIncome(tx *gorm.DB, order *model.RentalOrder, settlement
return nil
}
orderID := order.ID
var siteID uint64
if order.DistributionSiteID != nil {
siteID = *order.DistributionSiteID
}
var ownerEntries []wallet.Entry
if settlement.OwnerRentIncomeCent > 0 {
ownerEntries = append(ownerEntries, wallet.Entry{
UserID: order.OwnerID,
OrderID: &orderID,
Direction: "in",
AmountCent: settlement.OwnerRentIncomeCent,
BalanceType: "available",
BizType: walletBizOwnerIncome,
BizNo: order.OrderNo,
Remark: "订单结账租金收入",
UserID: order.OwnerID,
DistributionSiteID: siteID,
OrderID: &orderID,
Direction: "in",
AmountCent: settlement.OwnerRentIncomeCent,
BalanceType: "available",
BizType: walletBizOwnerIncome,
BizNo: order.OrderNo,
Remark: "订单结账租金收入",
})
}
if settlement.DepositCompensationCent > 0 {
ownerEntries = append(ownerEntries, wallet.Entry{
UserID: order.OwnerID,
OrderID: &orderID,
Direction: "in",
AmountCent: settlement.DepositCompensationCent,
BalanceType: "available",
BizType: walletBizDepositCompensation,
BizNo: order.OrderNo,
Remark: "订单结账押金赔付",
UserID: order.OwnerID,
DistributionSiteID: siteID,
OrderID: &orderID,
Direction: "in",
AmountCent: settlement.DepositCompensationCent,
BalanceType: "available",
BizType: walletBizDepositCompensation,
BizNo: order.OrderNo,
Remark: "订单结账押金赔付",
})
}
if len(ownerEntries) == 0 {