-
Notifications
You must be signed in to change notification settings - Fork 10
/
Consignee.go
49 lines (44 loc) · 1.21 KB
/
Consignee.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 wdk
import (
"sync"
)
// Consignee 结构体
type Consignee struct {
// 收件人名称
Name string `json:"name,omitempty" xml:"name,omitempty"`
// 收件人电话
Phone string `json:"phone,omitempty" xml:"phone,omitempty"`
// 配送地址
Address string `json:"address,omitempty" xml:"address,omitempty"`
// 配送坐标
Geo string `json:"geo,omitempty" xml:"geo,omitempty"`
// 配送开始时间
StartTime string `json:"start_time,omitempty" xml:"start_time,omitempty"`
// 配送结束时间
EndTime string `json:"end_time,omitempty" xml:"end_time,omitempty"`
// 城市名称,仅在type不为0的情况下传入
City string `json:"city,omitempty" xml:"city,omitempty"`
// 0:高德坐标系,1:其他坐标系(需要坐标修正)
Type int64 `json:"type,omitempty" xml:"type,omitempty"`
}
var poolConsignee = sync.Pool{
New: func() any {
return new(Consignee)
},
}
// GetConsignee() 从对象池中获取Consignee
func GetConsignee() *Consignee {
return poolConsignee.Get().(*Consignee)
}
// ReleaseConsignee 释放Consignee
func ReleaseConsignee(v *Consignee) {
v.Name = ""
v.Phone = ""
v.Address = ""
v.Geo = ""
v.StartTime = ""
v.EndTime = ""
v.City = ""
v.Type = 0
poolConsignee.Put(v)
}