-
Notifications
You must be signed in to change notification settings - Fork 12
/
SubUserInfo.go
46 lines (41 loc) · 1.2 KB
/
SubUserInfo.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
package subuser
import (
"sync"
)
// SubUserInfo 结构体
type SubUserInfo struct {
// 子账号用户名
Nick string `json:"nick,omitempty" xml:"nick,omitempty"`
// 主账号昵称
SellerNick string `json:"seller_nick,omitempty" xml:"seller_nick,omitempty"`
// 子账号姓名
FullName string `json:"full_name,omitempty" xml:"full_name,omitempty"`
// 是否参与分流 1不参与 2参与
IsOnline int64 `json:"is_online,omitempty" xml:"is_online,omitempty"`
// 子账号Id
SubId int64 `json:"sub_id,omitempty" xml:"sub_id,omitempty"`
// 子账号当前状态 1正常 -1删除 2冻结
Status int64 `json:"status,omitempty" xml:"status,omitempty"`
// 子账号所属的主账号的唯一标识
SellerId int64 `json:"seller_id,omitempty" xml:"seller_id,omitempty"`
}
var poolSubUserInfo = sync.Pool{
New: func() any {
return new(SubUserInfo)
},
}
// GetSubUserInfo() 从对象池中获取SubUserInfo
func GetSubUserInfo() *SubUserInfo {
return poolSubUserInfo.Get().(*SubUserInfo)
}
// ReleaseSubUserInfo 释放SubUserInfo
func ReleaseSubUserInfo(v *SubUserInfo) {
v.Nick = ""
v.SellerNick = ""
v.FullName = ""
v.IsOnline = 0
v.SubId = 0
v.Status = 0
v.SellerId = 0
poolSubUserInfo.Put(v)
}