-
Notifications
You must be signed in to change notification settings - Fork 9
/
Buyer.go
67 lines (62 loc) · 1.8 KB
/
Buyer.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package tmallservice
import (
"sync"
)
// Buyer 结构体
type Buyer struct {
// 座机
Phone string `json:"phone,omitempty" xml:"phone,omitempty"`
// 二级地址
AddressCity string `json:"address_city,omitempty" xml:"address_city,omitempty"`
// 三级地址
AddressDistrict string `json:"address_district,omitempty" xml:"address_district,omitempty"`
// 详细地址
AddressDetail string `json:"address_detail,omitempty" xml:"address_detail,omitempty"`
// 姓名
BuyerName string `json:"buyer_name,omitempty" xml:"buyer_name,omitempty"`
// 邮箱
Email string `json:"email,omitempty" xml:"email,omitempty"`
// 拼装好的地址
Address string `json:"address,omitempty" xml:"address,omitempty"`
// 邮编
ZipCode string `json:"zip_code,omitempty" xml:"zip_code,omitempty"`
// 买家昵称
BuyerNick string `json:"buyer_nick,omitempty" xml:"buyer_nick,omitempty"`
// 四级地址
AddressTown string `json:"address_town,omitempty" xml:"address_town,omitempty"`
// 一级地址
AddressProvince string `json:"address_province,omitempty" xml:"address_province,omitempty"`
// 手机号
Mobile string `json:"mobile,omitempty" xml:"mobile,omitempty"`
// open_uid
OpenUid string `json:"open_uid,omitempty" xml:"open_uid,omitempty"`
// 地址编码
Location int64 `json:"location,omitempty" xml:"location,omitempty"`
}
var poolBuyer = sync.Pool{
New: func() any {
return new(Buyer)
},
}
// GetBuyer() 从对象池中获取Buyer
func GetBuyer() *Buyer {
return poolBuyer.Get().(*Buyer)
}
// ReleaseBuyer 释放Buyer
func ReleaseBuyer(v *Buyer) {
v.Phone = ""
v.AddressCity = ""
v.AddressDistrict = ""
v.AddressDetail = ""
v.BuyerName = ""
v.Email = ""
v.Address = ""
v.ZipCode = ""
v.BuyerNick = ""
v.AddressTown = ""
v.AddressProvince = ""
v.Mobile = ""
v.OpenUid = ""
v.Location = 0
poolBuyer.Put(v)
}