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 (
|
2021-04-27 15:33:49 +08:00
|
|
|
"boss/conf"
|
2021-11-11 10:30:43 +08:00
|
|
|
"boss/models/accounts"
|
|
|
|
"boss/models/agent"
|
|
|
|
"boss/models/merchant"
|
|
|
|
"boss/models/notify"
|
|
|
|
"boss/models/order"
|
|
|
|
"boss/models/payfor"
|
|
|
|
"boss/models/road"
|
|
|
|
"boss/models/system"
|
|
|
|
"boss/models/user"
|
2019-12-19 14:47:58 +08:00
|
|
|
"fmt"
|
2021-04-27 15:33:49 +08:00
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
|
"github.com/beego/beego/v2/core/logs"
|
2019-12-19 14:47:58 +08:00
|
|
|
_ "github.com/go-sql-driver/mysql"
|
|
|
|
)
|
|
|
|
|
2021-04-27 15:33:49 +08:00
|
|
|
func init() {
|
2019-12-19 14:47:58 +08:00
|
|
|
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)
|
2021-04-27 15:33:49 +08:00
|
|
|
orm.RegisterDataBase("default", "mysql", link)
|
2021-11-11 10:30:43 +08:00
|
|
|
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.MerchantDeployInfo),
|
|
|
|
new(accounts.AccountInfo), new(accounts.AccountHistoryInfo), new(order.OrderInfo), new(order.OrderProfitInfo),
|
|
|
|
new(order.OrderSettleInfo), new(notify.NotifyInfo), new(merchant.MerchantLoadInfo),
|
|
|
|
new(payfor.PayforInfo))
|
2019-12-19 14:47:58 +08:00
|
|
|
}
|