-
Notifications
You must be signed in to change notification settings - Fork 9
/
Lines.go
49 lines (44 loc) · 1.43 KB
/
Lines.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package aliexpresssumaitong
import (
"sync"
)
// Lines 结构体
type Lines struct {
// 商品税率
TaxRates []string `json:"tax_rates,omitempty" xml:"tax_rates>string,omitempty"`
// 运费税率
DeliveryTaxRates []string `json:"delivery_tax_rates,omitempty" xml:"delivery_tax_rates>string,omitempty"`
// 商品数量
Quantity string `json:"quantity,omitempty" xml:"quantity,omitempty"`
// 商品未含税总价
OrderTaxExcludedAmount string `json:"order_tax_excluded_amount,omitempty" xml:"order_tax_excluded_amount,omitempty"`
// 运费未含税总价
DeliveryAmount string `json:"delivery_amount,omitempty" xml:"delivery_amount,omitempty"`
// 商品税金总价
OrderTaxAmount string `json:"order_tax_amount,omitempty" xml:"order_tax_amount,omitempty"`
// 运费税金总价
DeliveryTaxAmount string `json:"delivery_tax_amount,omitempty" xml:"delivery_tax_amount,omitempty"`
// 子订单号id
SubOrderId string `json:"sub_order_id,omitempty" xml:"sub_order_id,omitempty"`
}
var poolLines = sync.Pool{
New: func() any {
return new(Lines)
},
}
// GetLines() 从对象池中获取Lines
func GetLines() *Lines {
return poolLines.Get().(*Lines)
}
// ReleaseLines 释放Lines
func ReleaseLines(v *Lines) {
v.TaxRates = v.TaxRates[:0]
v.DeliveryTaxRates = v.DeliveryTaxRates[:0]
v.Quantity = ""
v.OrderTaxExcludedAmount = ""
v.DeliveryAmount = ""
v.OrderTaxAmount = ""
v.DeliveryTaxAmount = ""
v.SubOrderId = ""
poolLines.Put(v)
}