This commit is contained in:
李子铭 2025-03-03 18:30:05 +08:00
parent 1d61bd84f4
commit 67215ca534
5 changed files with 58 additions and 55 deletions

View File

@ -16,7 +16,7 @@ type OrderBo struct {
Status vo.OrderStatus
AppID string
MerchantNo string
Channel vo.OrderChannel
Channel vo.Channel
CreateTime *time.Time
UpdateTime *time.Time
}
@ -27,7 +27,7 @@ type OrderCreateReqBo struct {
ProductNo string
Account string
AccountType vo.OrderAccountType
Channel vo.OrderChannel
Channel vo.Channel
AppID string
MerchantNo string
}

View File

@ -1,6 +1,9 @@
package bo
import "time"
import (
"time"
"voucher/internal/biz/vo"
)
// ProductBo 领域实体Bo结构字段和模型字段保持一致
type ProductBo struct {
@ -11,7 +14,7 @@ type ProductBo struct {
BatchNo string
AppID string
MerchantNo string
Channel bool
CreateTime time.Time
UpdateTime time.Time
Channel vo.Channel
CreateTime *time.Time
UpdateTime *time.Time
}

View File

@ -0,0 +1,32 @@
package vo
type Channel uint8
const (
OrderChannelWechat Channel = iota + 1
OrderChannelAlipay
)
var OrderChannelMap = map[Channel]string{
OrderChannelWechat: "微信",
OrderChannelAlipay: "支付宝",
}
func (s Channel) GetText() string {
if t, ok := OrderChannelMap[s]; ok {
return t
}
return ""
}
func (s Channel) GetValue() uint8 {
return uint8(s)
}
func (s Channel) IsWeChat() bool {
return s == OrderChannelWechat
}
func (s Channel) IsAlipay() bool {
return s == OrderChannelAlipay
}

View File

@ -1,32 +0,0 @@
package vo
type OrderChannel uint8
const (
OrderChannelWechat OrderChannel = iota + 1
OrderChannelAlipay
)
var OrderChannelMap = map[OrderChannel]string{
OrderChannelWechat: "微信",
OrderChannelAlipay: "支付宝",
}
func (s OrderChannel) GetText() string {
if t, ok := OrderChannelMap[s]; ok {
return t
}
return ""
}
func (s OrderChannel) GetValue() uint8 {
return uint8(s)
}
func (s OrderChannel) IsWeChat() bool {
return s == OrderChannelWechat
}
func (s OrderChannel) IsAlipay() bool {
return s == OrderChannelAlipay
}

View File

@ -19,9 +19,9 @@ type Product struct {
BatchNo string `gorm:"column:batch_no;not null;comment:立减金批次号" json:"batch_no"` // 立减金批次号
AppID string `gorm:"column:app_id;not null;comment:批次所属应用" json:"app_id"` // 批次所属应用
MerchantNo string `gorm:"column:merchant_no;not null;comment:商户号,创建批次的商户号" json:"merchant_no"` // 商户号,创建批次的商户号
Channel bool `gorm:"column:channel;not null;comment:1:微信 2:支付宝" json:"channel"` // 1:微信 2:支付宝
CreateTime time.Time `gorm:"column:create_time;not null" json:"create_time"`
UpdateTime time.Time `gorm:"column:update_time" json:"update_time"`
Channel uint8 `gorm:"column:channel;not null;comment:1:微信 2:支付宝" json:"channel"` // 1:微信 2:支付宝
CreateTime *time.Time `gorm:"column:create_time;not null" json:"create_time"`
UpdateTime *time.Time `gorm:"column:update_time" json:"update_time"`
}
// TableName Product's table name