-
Notifications
You must be signed in to change notification settings - Fork 9
/
CheckInCheckOutPrice.go
46 lines (41 loc) · 1.48 KB
/
CheckInCheckOutPrice.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 hotel
import (
"sync"
)
// CheckInCheckOutPrice 结构体
type CheckInCheckOutPrice struct {
// 飞猪营销优惠列表
Promotions []PromotionPrice `json:"promotions,omitempty" xml:"promotions>promotion_price,omitempty"`
// 入住日期 yyyy-MM-dd
CheckinDate string `json:"checkin_date,omitempty" xml:"checkin_date,omitempty"`
// 离店日期 yyyy-MM-dd
CheckoutDate string `json:"checkout_date,omitempty" xml:"checkout_date,omitempty"`
// 入住天数
StayDays int64 `json:"stay_days,omitempty" xml:"stay_days,omitempty"`
// 商品营销后报价,精度(分)
Price int64 `json:"price,omitempty" xml:"price,omitempty"`
// 早餐数,-1代表早餐数和入住人数一致
BreakfastCount int64 `json:"breakfast_count,omitempty" xml:"breakfast_count,omitempty"`
// 商品营销前报价,精度(分)
OriginalPrice int64 `json:"original_price,omitempty" xml:"original_price,omitempty"`
}
var poolCheckInCheckOutPrice = sync.Pool{
New: func() any {
return new(CheckInCheckOutPrice)
},
}
// GetCheckInCheckOutPrice() 从对象池中获取CheckInCheckOutPrice
func GetCheckInCheckOutPrice() *CheckInCheckOutPrice {
return poolCheckInCheckOutPrice.Get().(*CheckInCheckOutPrice)
}
// ReleaseCheckInCheckOutPrice 释放CheckInCheckOutPrice
func ReleaseCheckInCheckOutPrice(v *CheckInCheckOutPrice) {
v.Promotions = v.Promotions[:0]
v.CheckinDate = ""
v.CheckoutDate = ""
v.StayDays = 0
v.Price = 0
v.BreakfastCount = 0
v.OriginalPrice = 0
poolCheckInCheckOutPrice.Put(v)
}