53 lines
1.5 KiB
Go
53 lines
1.5 KiB
Go
package models
|
|
|
|
import (
|
|
"fmt"
|
|
"gateway/internal/models/accounts"
|
|
"gateway/internal/models/agent"
|
|
"gateway/internal/models/merchant"
|
|
"gateway/internal/models/merchant_deploy"
|
|
"gateway/internal/models/notify"
|
|
"gateway/internal/models/order"
|
|
"gateway/internal/models/payfor"
|
|
"gateway/internal/models/road"
|
|
"gateway/internal/models/system"
|
|
"gateway/internal/models/user"
|
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
"github.com/beego/beego/v2/server/web"
|
|
_ "github.com/go-sql-driver/mysql"
|
|
)
|
|
|
|
func init() {
|
|
dbHost, _ := web.AppConfig.String("mysql::dbhost")
|
|
dbUser, _ := web.AppConfig.String("mysql::dbuser")
|
|
dbPassword, _ := web.AppConfig.String("mysql::dbpasswd")
|
|
dbBase, _ := web.AppConfig.String("mysql::dbbase")
|
|
dbPort, _ := web.AppConfig.String("mysql::dbport")
|
|
|
|
link := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local&parseTime=true", dbUser, dbPassword, dbHost, dbPort, dbBase)
|
|
|
|
_ = orm.RegisterDriver("mysql", orm.DRMySQL)
|
|
_ = orm.RegisterDataBase("default", "mysql", link)
|
|
orm.RegisterModel(new(user.UserInfo),
|
|
new(system.MenuInfo),
|
|
new(system.SecondMenuInfo),
|
|
new(system.PowerInfo),
|
|
new(system.RoleInfo),
|
|
new(system.BankCardInfo),
|
|
new(road.RoadInfo),
|
|
new(road.RoadPoolInfo),
|
|
new(agent.AgentInfo),
|
|
new(merchant.MerchantInfo),
|
|
new(merchant_deploy.MerchantDeployInfo),
|
|
new(accounts.AccountInfo),
|
|
new(accounts.AccountHistoryInfoModel),
|
|
new(order.OrderInfo),
|
|
new(order.OrderProfitInfo),
|
|
new(order.OrderSettleInfo),
|
|
new(notify.NotifyInfo),
|
|
new(merchant.MerchantLoadInfo),
|
|
new(payfor.PayforInfo),
|
|
)
|
|
}
|