-
Notifications
You must be signed in to change notification settings - Fork 10
/
ItemCat.go
49 lines (44 loc) · 1.57 KB
/
ItemCat.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 category
import (
"sync"
)
// ItemCat 结构体
type ItemCat struct {
// Feature对象列表<br/>目前已有的属性:<br/>若Attr_key为 udsaleprop,attr_value为1 则允许卖家在改类目新增自定义销售属性,不然为不允许
Features []Feature `json:"features,omitempty" xml:"features>feature,omitempty"`
// 类目名称
Name string `json:"name,omitempty" xml:"name,omitempty"`
// 状态。可选值:normal(正常),deleted(删除)
Status string `json:"status,omitempty" xml:"status,omitempty"`
// 商品所属类目ID
Cid int64 `json:"cid,omitempty" xml:"cid,omitempty"`
// 父类目ID=0时,代表的是一级的类目
ParentCid int64 `json:"parent_cid,omitempty" xml:"parent_cid,omitempty"`
// 排列序号,表示同级类目的展现次序,如数值相等则按名称次序排列。取值范围:大于零的整数
SortOrder int64 `json:"sort_order,omitempty" xml:"sort_order,omitempty"`
// 该类目是否为父类目(即:该类目是否还有子类目)
IsParent bool `json:"is_parent,omitempty" xml:"is_parent,omitempty"`
// 是否度量衡类目
TaosirCat bool `json:"taosir_cat,omitempty" xml:"taosir_cat,omitempty"`
}
var poolItemCat = sync.Pool{
New: func() any {
return new(ItemCat)
},
}
// GetItemCat() 从对象池中获取ItemCat
func GetItemCat() *ItemCat {
return poolItemCat.Get().(*ItemCat)
}
// ReleaseItemCat 释放ItemCat
func ReleaseItemCat(v *ItemCat) {
v.Features = v.Features[:0]
v.Name = ""
v.Status = ""
v.Cid = 0
v.ParentCid = 0
v.SortOrder = 0
v.IsParent = false
v.TaosirCat = false
poolItemCat.Put(v)
}