收口审计治理与套餐任务进展
Constraint: 在线热修前必须保存当前迭代分支全部有效代码进展 Confidence: medium Scope-risk: broad Directive: 后续修改需保持审计事件与业务事务边界一致 Tested: git diff --cached --check Not-tested: 未运行全量测试,提交用于切换分支前保存既有工作
This commit is contained in:
46
internal/infrastructure/audit/commission.go
Normal file
46
internal/infrastructure/audit/commission.go
Normal file
@@ -0,0 +1,46 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user