31 lines
675 B
Go
31 lines
675 B
Go
package stock
|
|
|
|
import "github.com/gogf/gf/v2/util/gconv"
|
|
|
|
// BatchStatus 批次状态枚举
|
|
|
|
var (
|
|
BatchStatusActive = newBatchStatus(gconv.PtrInt8(1), "活跃")
|
|
BatchStatusExpiring = newBatchStatus(gconv.PtrInt8(2), "临期")
|
|
BatchStatusExpired = newBatchStatus(gconv.PtrInt8(3), "过期")
|
|
BatchStatusSoldOut = newBatchStatus(gconv.PtrInt8(4), "售罄")
|
|
)
|
|
|
|
type BatchStatus *int8
|
|
|
|
type batchStatus struct {
|
|
code BatchStatus
|
|
desc string
|
|
}
|
|
|
|
func (s batchStatus) Code() BatchStatus {
|
|
return s.code
|
|
}
|
|
func (s batchStatus) Desc() string {
|
|
return s.desc
|
|
}
|
|
|
|
func newBatchStatus(code BatchStatus, desc string) batchStatus {
|
|
return batchStatus{code: code, desc: desc}
|
|
}
|