diff --git a/app/data/.gitkeep b/app/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/appmodel/app.go b/app/models/appmodel/app.go new file mode 100644 index 0000000..cb5fc87 --- /dev/null +++ b/app/models/appmodel/app.go @@ -0,0 +1,47 @@ +package appmodel + +import ( + "github.com/qit-team/snow-core/db" + "sync" + "time" +) + +var ( + once sync.Once + m *AppModel +) + +// 实体 +type App struct { + Id int64 `xorm:"'Id' bigint(20)"` + MerchantId int64 `xorm:"'merchant_id' bigint(20)"` + AppName string `xorm:"'app_name' varchar(128)"` + AppRemark string `xorm:"'app_remark' varchar(255)"` + Status int `xorm:"'status' int(11)"` + KeyType int `xorm:"'key_type' int(11)"` + PublicKey string `xorm:"'public_key' varchar(1024)"` + PrivateKey string `xorm:"'private_key' varchar(1024)"` + MerchantPublicKey string `xorm:"'merchant_public_key' varchar(1024)"` + CreateTime time.Time `xorm:"'create_time' datetime updated"` + UpdateTime time.Time `xorm:"'update_time' timestamp"` + DeleteTime time.Time `xorm:"'delete_time' timestamp"` +} + +// 表名 +func (m *App) TableName() string { + return "app" +} + +// 私有化,防止被外部new +type AppModel struct { + db.Model //组合基础Model,集成基础Model的属性和方法 +} + +// 单例模式 +func GetInstance() *AppModel { + once.Do(func() { + m = new(AppModel) + //m.DiName = "" //设置数据库实例连接,默认db.SingletonMain + }) + return m +} diff --git a/app/models/merchantmodel/merchant.go b/app/models/merchantmodel/merchant.go new file mode 100644 index 0000000..3df66ce --- /dev/null +++ b/app/models/merchantmodel/merchant.go @@ -0,0 +1,43 @@ +package merchantmodel + +import ( + "github.com/qit-team/snow-core/db" + "sync" + "time" +) + +var ( + once sync.Once + m *MerchantModel +) + +// 实体 +type Merchant struct { + Id int64 `xorm:"'Id' bigint(20)"` + Name string `xorm:"'name' varchar(128)"` + Contact string `xorm:"'contact' varchar(128)"` + Phone string `xorm:"'phone' varchar(11)"` + Remark string `xorm:"'remark' varchar(1024)"` + CreateTime time.Time `xorm:"'create_time' datetime"` + UpdateTime time.Time `xorm:"'update_time' timestamp"` + DeleteTime time.Time `xorm:"'delete_time' timestamp"` +} + +// 表名 +func (m *Merchant) TableName() string { + return "merchant" +} + +// 私有化,防止被外部new +type MerchantModel struct { + db.Model //组合基础Model,集成基础Model的属性和方法 +} + +// 单例模式 +func GetInstance() *MerchantModel { + once.Do(func() { + m = new(MerchantModel) + //m.DiName = "" //设置数据库实例连接,默认db.SingletonMain + }) + return m +} diff --git a/app/models/orderlogmodel/order_log.go b/app/models/orderlogmodel/order_log.go new file mode 100644 index 0000000..70b6543 --- /dev/null +++ b/app/models/orderlogmodel/order_log.go @@ -0,0 +1,42 @@ +package orderlogmodel + +import ( + "github.com/qit-team/snow-core/db" + "sync" + "time" +) + +var ( + once sync.Once + m *OrderLogModel +) + +// 实体 +type OrderLog struct { + Id int64 `xorm:"'Id' bigint(20)"` + OrderId int64 `xorm:"'order_id' bigint(20)"` + PayCallback string `xorm:"'pay_callback' varchar(255)"` + Status int `xorm:"'status' int(11)"` + MerchantParam string `xorm:"'merchant_param' varchar(255)"` + MerchantCallback string `xorm:"'merchant_callback' varchar(255)"` + CreateTime time.Time `xorm:"'create_time' datetime"` +} + +// 表名 +func (m *OrderLog) TableName() string { + return "order_log" +} + +// 私有化,防止被外部new +type OrderLogModel struct { + db.Model //组合基础Model,集成基础Model的属性和方法 +} + +// 单例模式 +func GetInstance() *OrderLogModel { + once.Do(func() { + m = new(OrderLogModel) + //m.DiName = "" //设置数据库实例连接,默认db.SingletonMain + }) + return m +} diff --git a/app/models/ordersmodel/orders.go b/app/models/ordersmodel/orders.go new file mode 100644 index 0000000..6b37bbe --- /dev/null +++ b/app/models/ordersmodel/orders.go @@ -0,0 +1,51 @@ +package ordersmodel + +import ( + "github.com/qit-team/snow-core/db" + "sync" + "time" +) + +var ( + once sync.Once + m *OrdersModel +) + +// 实体 +type Orders struct { + Id int64 `xorm:"'Id' bigint(20)"` + MerchantId int64 `xorm:"'merchant_id' bigint(20)"` + PayId int64 `xorm:"'pay_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)"` + NotifyUrl string `xorm:"'notify_url' varchar(255)"` + 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"` + UpdateTime time.Time `xorm:"'update_time' timestamp"` + DeleteTime time.Time `xorm:"'delete_time' timestamp"` +} + +// 表名 +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 +} diff --git a/app/models/paychannelmodel/pay_channel.go b/app/models/paychannelmodel/pay_channel.go new file mode 100644 index 0000000..5db7b3c --- /dev/null +++ b/app/models/paychannelmodel/pay_channel.go @@ -0,0 +1,46 @@ +package paychannelmodel + +import ( + "github.com/qit-team/snow-core/db" + "sync" + "time" +) + +var ( + once sync.Once + m *PayChannelModel +) + +// 实体 +type PayChannel struct { + Id int64 `xorm:"'Id' bigint(20)"` + PayName string `xorm:"'pay_name' varchar(128)"` + MerchantId int64 `xorm:"'merchant_id' bigint(20)"` + ChannelType int `xorm:"'channel_type' int(11)"` + WhiteIp string `xorm:"'white_ip' varchar(1024)"` + AppId string `xorm:"'app_id' varchar(255)"` + ExtJson string `xorm:"'ext_json' JSON"` + ExpireTime time.Time `xorm:"'expire_time' datetime"` + CreateTime time.Time `xorm:"'create_time' datetime"` + UpdateTime time.Time `xorm:"'update_time' timestamp"` + DeleteTime time.Time `xorm:"'delete_time' timestamp"` +} + +// 表名 +func (m *PayChannel) TableName() string { + return "pay_channel" +} + +// 私有化,防止被外部new +type PayChannelModel struct { + db.Model //组合基础Model,集成基础Model的属性和方法 +} + +// 单例模式 +func GetInstance() *PayChannelModel { + once.Do(func() { + m = new(PayChannelModel) + //m.DiName = "" //设置数据库实例连接,默认db.SingletonMain + }) + return m +}