优化结构

This commit is contained in:
Yvan
2026-08-29 08:40:15 +08:00
parent b6d25c1a0f
commit 509df03d61
17 changed files with 234 additions and 40 deletions
+4 -4
View File
@@ -152,8 +152,7 @@ func (r *paymentOrderRepo) CreatePaymentOrder(ctx context.Context, order *bizpay
}
return appendPaymentEvent(ctx, tx, po, &bizpayment.PaymentEvent{
Type: bizpayment.PaymentEventOrderCreated, Source: "client", Status: po.PaymentStatus,
Amount: po.Amount, Currency: po.Currency, ClientIP: order.ClientIP,
UserAgent: order.UserAgent, DeviceID: order.DeviceID,
Amount: po.Amount, Currency: po.Currency,
})
})
if err == nil {
@@ -637,8 +636,9 @@ func defaultVersion(value uint64) uint64 {
func trimTo(value string, max int) string {
value = strings.TrimSpace(value)
if len(value) > max {
return value[:max]
runes := []rune(value)
if len(runes) > max {
return string(runes[:max])
}
return value
}