PaymentCenter/app/models/ordersmodel/orders.go

52 lines
1.5 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)"`
PayId int64 `xorm:"'pay_id' bigint(20)"`
AppId int64 `xorm:"'app_id' bigint(20)"`
MerchantOrderId string `xorm:"'merchant_order_id' varchar(128)"`
Status int `xorm:"'status' int(11)"`
OrderType int `xorm:"'order_type' int(11)"`
Amount int `xorm:"'amount' int(11)"`
IpAddress string `xorm:"'ip_address' varchar(128)"`
MerchantRequest string `xorm:"'merchant_request' varchar(2048)"`
MerchantResponse string `xorm:"'merchant_response' varchar(255)"`
OrderResponse string `xorm:"'order_response' varchar(255)"`
ExtJson string `xorm:"'ext_json' varchar(1024)"`
CreateTime time.Time `xorm:"'create_time' datetime created"`
UpdateTime time.Time `xorm:"'update_time' timestamp updated"`
DeleteTime time.Time `xorm:"'delete_time' timestamp deleted"`
}
// 表名
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
}