dongfeng-pay/merchant/models/init.go

39 lines
1.2 KiB
Go
Raw Normal View History

2019-12-19 14:47:58 +08:00
/***************************************************
** @Desc : This file for ...
** @Time : 2019/8/9 13:48
** @Author : yuebin
** @File : init
** @Last Modified by : yuebin
** @Last Modified time: 2019/8/9 13:48
** @Software: GoLand
****************************************************/
package models
import (
"fmt"
2021-04-27 15:33:49 +08:00
"github.com/beego/beego/v2/adapter/orm"
"github.com/beego/beego/v2/core/logs"
"merchant/conf"
2019-12-19 14:47:58 +08:00
)
func Init() {
dbHost := conf.DB_HOST
dbUser := conf.DB_USER
dbPassword := conf.DB_PASSWORD
dbBase := conf.DB_BASE
dbPort := conf.DB_PORT
link := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8", dbUser, dbPassword, dbHost, dbPort, dbBase)
2021-04-27 15:33:49 +08:00
logs.Info("mysql init.....", link)
2019-12-19 14:47:58 +08:00
orm.RegisterDriver("mysql", orm.DRMySQL)
orm.RegisterDataBase("default", "mysql", link, 30, 30)
orm.RegisterModel(new(UserInfo), new(MenuInfo), new(SecondMenuInfo),
new(PowerInfo), new(RoleInfo), new(BankCardInfo), new(RoadInfo),
new(RoadPoolInfo), new(AgentInfo), new(MerchantInfo), new(MerchantDeployInfo),
new(AccountInfo), new(AccountHistoryInfo), new(OrderInfo), new(OrderProfitInfo),
new(OrderSettleInfo), new(NotifyInfo), new(MerchantLoadInfo),
new(PayforInfo))
}