package audit import ( "strconv" "github.com/break/junhong_cmp_fiber/internal/model" "github.com/break/junhong_cmp_fiber/pkg/constants" ) // CommissionWithdrawalResource 构造佣金提现单审计资源,不记录收款账户信息。 func CommissionWithdrawalResource(withdrawal *model.CommissionWithdrawalRequest, relation, role string, beforeData, afterData map[string]any) ResourceInput { id := strconv.FormatUint(uint64(withdrawal.ID), 10) key := withdrawal.WithdrawalNo if key == "" { key = id } return ResourceInput{ Type: constants.AuditResourceCommissionWithdrawal, ID: optionalResourceID(withdrawal.ID), Key: key, DisplayName: "佣金提现单 " + key, Relation: relation, Role: role, IdentitySnapshot: map[string]any{ "id": withdrawal.ID, "withdrawal_no": withdrawal.WithdrawalNo, "shop_id": withdrawal.ShopID, "applicant_id": withdrawal.ApplicantID, "amount": withdrawal.Amount, "fee": withdrawal.Fee, "fee_rate": withdrawal.FeeRate, "actual_amount": withdrawal.ActualAmount, "withdrawal_method": withdrawal.WithdrawalMethod, "payment_type": withdrawal.PaymentType, "status": withdrawal.Status, "processor_id": withdrawal.ProcessorID, "processed_at": withdrawal.ProcessedAt, "paid_at": withdrawal.PaidAt, }, BeforeData: beforeData, AfterData: afterData, } } // AgentWalletResource 构造代理钱包审计资源及余额前后值。 func AgentWalletResource(wallet *model.AgentWallet, relation, role string, beforeData, afterData map[string]any) ResourceInput { resource := agentWalletAuditResource(wallet, relation, role) resource.BeforeData = beforeData resource.AfterData = afterData return resource } // AgentWalletTransactionResource 构造代理钱包流水审计资源。 func AgentWalletTransactionResource(transaction *model.AgentWalletTransaction, relation, role string) ResourceInput { resource := agentWalletTransactionResource(transaction) resource.Relation = relation resource.Role = role return resource }