PaymentCenter/app/models/ordersmodel/orders.go

64 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package ordersmodel
import (
"github.com/qit-team/snow-core/db"
"sync"
"time"
)
var (
once sync.Once
m *OrdersModel
)
// 实体
type Orders struct {
Id int64
MerchantId int64 `xorm:"'merchant_id' bigint(20)"`
PayChannelId int64 `xorm:"'pay_channel_id' bigint(20)"`
AppId int64 `xorm:"'app_id' bigint(20)"`
OutTreadNo string `xorm:"'out_tread_no' varchar(50)"`
OrderType int `xorm:"'order_type' TINYINT"`
RefundOrderId int64 `xorm:"'refund_order_id' bigint(20)"`
Amount int `xorm:"'amount' int(11)"`
PayerTotal int `xorm:"'payer_total' int(11)"`
ExtJson string `xorm:"'ext_json' varchar(1024)"`
Desc string `xorm:"'desc' varchar(100)"`
CreateTime time.Time `xorm:"'create_time' datetime created"`
UpdateTime time.Time `xorm:"'update_time' timestamp updated"`
Status int `xorm:"'status' TINYINT"`
DeleteTime time.Time `xorm:"'delete_time' timestamp deleted"`
}
type OrdersBackendList struct {
Orders `xorm:"extends"`
MerchantName string `xorm:"'merchant_name' varchar(128)"`
PayName string `xorm:"'pay_name' varchar(128)"`
AppName string `xorm:"'app_name' varchar(128)"`
}
type OrdersLeftPayChannelList struct {
Orders `xorm:"extends"`
ChannelType int `xorm:"'channel_type' int(11)"`
AppId string `xorm:"'app_id' varchar(255)"`
ExtJson string `xorm:"'ext_json' JSON"`
}
// 表名
func (m *Orders) TableName() string {
return "orders"
}
// 私有化防止被外部new
type OrdersModel struct {
db.Model //组合基础Model集成基础Model的属性和方法
}
// 单例模式
func GetInstance() *OrdersModel {
once.Do(func() {
m = new(OrdersModel)
//m.DiName = "" //设置数据库实例连接默认db.SingletonMain
})
return m
}