优化结构
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user