feat:完善项目信息
This commit is contained in:
@ -1,26 +0,0 @@
|
||||
package common
|
||||
|
||||
type Model struct {
|
||||
TableName string
|
||||
}
|
||||
|
||||
type Option func(model *Model)
|
||||
|
||||
func withModel(tableName string) Option {
|
||||
return func(model *Model) {
|
||||
model.TableName = tableName
|
||||
}
|
||||
}
|
||||
|
||||
func NewModel(option ...Option) *Model {
|
||||
out := new(Model)
|
||||
|
||||
for _, v := range option {
|
||||
v(out)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func Test() {
|
||||
NewModel(withModel(""))
|
||||
}
|
@ -1,11 +1,37 @@
|
||||
package model
|
||||
|
||||
// BillInstance 账单信息数据模型
|
||||
type BillInstance struct {
|
||||
Model
|
||||
BillInstanceBasic
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
// BillInstanceBasic 账单基本信息
|
||||
type BillInstanceBasic struct {
|
||||
OrderNo string `gorm:"column:order_no;type:varchar(30);default:'';comment:订单号" json:"order_no"`
|
||||
Kind string `gorm:"column:kind;type:varchar(20);default:'';comment:账单类型" json:"kind"`
|
||||
Amount float64 `gorm:"column:amount;type:decimal(10,2);default:0;comment:账单金额" json:"amount"`
|
||||
Number float64 `gorm:"column:number;type:decimal(10,2);default:0;comment:账单数量" json:"number"`
|
||||
Status BillInstanceStatus `gorm:"column:status;type:tinyint(1);default:0;comment:账单状态" json:"status"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:账单备注" json:"remark"`
|
||||
}
|
||||
|
||||
// BillInstanceStatus 账单状态
|
||||
type BillInstanceStatus int
|
||||
|
||||
const (
|
||||
// BillInstanceStatusForInit 初始化
|
||||
BillInstanceStatusForInit BillInstanceStatus = iota
|
||||
// BillInstanceStatusForApply 申请中
|
||||
BillInstanceStatusForApply
|
||||
// BillInstanceStatusForProcessing 处理中
|
||||
BillInstanceStatusForProcessing
|
||||
// BillInstanceStatusForProcessed 已处理
|
||||
BillInstanceStatusForProcessed
|
||||
)
|
||||
|
||||
func (m *BillInstance) TableName() string {
|
||||
return "bill_instance"
|
||||
}
|
||||
|
18
app/common/model/user_bill.go
Normal file
18
app/common/model/user_bill.go
Normal file
@ -0,0 +1,18 @@
|
||||
package model
|
||||
|
||||
// UserBill 用户账单数据模型
|
||||
type UserBill struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
BillID uint64 `gorm:"column:bill_id;type:int(11);default:0;comment:账单ID" json:"bill_id"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
func (m *UserBill) TableName() string {
|
||||
return "user_bill"
|
||||
}
|
||||
|
||||
func NewUserBill() *UserBill {
|
||||
return &UserBill{}
|
||||
}
|
33
app/common/model/user_bill_ticket.go
Normal file
33
app/common/model/user_bill_ticket.go
Normal file
@ -0,0 +1,33 @@
|
||||
package model
|
||||
|
||||
// UserBillTicket 用户账单发票数据模型
|
||||
type UserBillTicket struct {
|
||||
Model
|
||||
UserBillID uint64 `gorm:"column:user_bill_id;type:int(11);default:0;comment:用户账单ID" json:"user_bill_id"`
|
||||
Kind UserBillTicketKind `gorm:"column:kind;type:tinyint(1);default:1;comment:税号" json:"kind"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:税号" json:"name"`
|
||||
DutyParagraph string `gorm:"column:duty_paragraph;type:varchar(30);default:'';comment:税号" json:"duty_paragraph"`
|
||||
Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系电话" json:"mobile"`
|
||||
Email string `gorm:"column:email;type:varchar(50);default:'';comment:邮件地址" json:"email"`
|
||||
Address string `gorm:"column:address;type:varchar(255);default:'';comment:详细地址" json:"address"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
||||
// UserBillTicketKind 用户账单发票类型
|
||||
type UserBillTicketKind int
|
||||
|
||||
const (
|
||||
// UserBillTicketKindForOrdinary 普通发票
|
||||
UserBillTicketKindForOrdinary UserBillTicketKind = iota + 1
|
||||
// UserBillTicketKindForSpecial 专票
|
||||
UserBillTicketKindForSpecial
|
||||
)
|
||||
|
||||
func (m *UserBillTicket) TableName() string {
|
||||
return "user_bill_ticket"
|
||||
}
|
||||
|
||||
func NewUserBillTicket() *UserBillTicket {
|
||||
return &UserBillTicket{}
|
||||
}
|
Reference in New Issue
Block a user