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 Status vo.OrderStatus
AppID string AppID string
MerchantNo string MerchantNo string
Channel vo.OrderChannel Channel vo.Channel
CreateTime *time.Time CreateTime *time.Time
UpdateTime *time.Time UpdateTime *time.Time
} }
@ -27,7 +27,7 @@ type OrderCreateReqBo struct {
ProductNo string ProductNo string
Account string Account string
AccountType vo.OrderAccountType AccountType vo.OrderAccountType
Channel vo.OrderChannel Channel vo.Channel
AppID string AppID string
MerchantNo string MerchantNo string
} }

View File

@ -1,17 +1,20 @@
package bo package bo
import "time" import (
"time"
"voucher/internal/biz/vo"
)
// ProductBo 领域实体Bo结构字段和模型字段保持一致 // ProductBo 领域实体Bo结构字段和模型字段保持一致
type ProductBo struct { type ProductBo struct {
ID int32 ID int32
Name string Name string
ProductNo string ProductNo string
BatchName string BatchName string
BatchNo string BatchNo string
AppID string AppID string
MerchantNo string MerchantNo string
Channel bool Channel vo.Channel
CreateTime time.Time CreateTime *time.Time
UpdateTime 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

@ -12,16 +12,16 @@ const TableNameProduct = "product"
// Product mapped from table <product> // Product mapped from table <product>
type Product struct { type Product struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"` ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
Name string `gorm:"column:name;not null;comment:商品名称" json:"name"` // 商品名称 Name string `gorm:"column:name;not null;comment:商品名称" json:"name"` // 商品名称
ProductNo string `gorm:"column:product_no;not null;comment:商品编号" json:"product_no"` // 商品编号 ProductNo string `gorm:"column:product_no;not null;comment:商品编号" json:"product_no"` // 商品编号
BatchName string `gorm:"column:batch_name;not null;comment:批次名称" json:"batch_name"` // 批次名称 BatchName string `gorm:"column:batch_name;not null;comment:批次名称" json:"batch_name"` // 批次名称
BatchNo string `gorm:"column:batch_no;not null;comment:立减金批次号" json:"batch_no"` // 立减金批次号 BatchNo string `gorm:"column:batch_no;not null;comment:立减金批次号" json:"batch_no"` // 立减金批次号
AppID string `gorm:"column:app_id;not null;comment:批次所属应用" json:"app_id"` // 批次所属应用 AppID string `gorm:"column:app_id;not null;comment:批次所属应用" json:"app_id"` // 批次所属应用
MerchantNo string `gorm:"column:merchant_no;not null;comment:商户号,创建批次的商户号" json:"merchant_no"` // 商户号,创建批次的商户号 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:支付宝 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"` CreateTime *time.Time `gorm:"column:create_time;not null" json:"create_time"`
UpdateTime time.Time `gorm:"column:update_time" json:"update_time"` UpdateTime *time.Time `gorm:"column:update_time" json:"update_time"`
} }
// TableName Product's table name // TableName Product's table name