合并一些变量

This commit is contained in:
kongyuebin 2021-11-11 22:00:24 +08:00
parent ba02a72f55
commit 0bb777213b
3 changed files with 8 additions and 29 deletions

View File

@ -13,6 +13,3 @@ dbbase = juhe_pay
[gateway]
host = http://localhost:12309/
#orderUrl = http://localhost:12309/gateway/supplier/order/query
#updateOrderUrl = http://localhost:12309/gateway/update/order
#payforUrl = http://localhost:12309/gateway/update/order

View File

@ -1,18 +0,0 @@
/***************************************************
** @Desc : This file for ...
** @Time : 2019/10/26 15:30
** @Author : yuebin
** @File : conf_pro
** @Last Modified by : yuebin
** @Last Modified time: 2019/10/26 15:30
** @Software: GoLand
****************************************************/
package conf
const (
DB_HOST = "localhost"
DB_PORT = "3306"
DB_USER = "root"
DB_PASSWORD = "Kyb^15273031604"
DB_BASE = "juhe_pay"
)

View File

@ -10,7 +10,6 @@
package models
import (
"boss/conf"
"boss/models/accounts"
"boss/models/agent"
"boss/models/merchant"
@ -23,22 +22,23 @@ import (
"fmt"
"github.com/beego/beego/v2/client/orm"
"github.com/beego/beego/v2/core/logs"
"github.com/beego/beego/v2/server/web"
_ "github.com/go-sql-driver/mysql"
)
func init() {
dbHost := conf.DB_HOST
dbUser := conf.DB_USER
dbPassword := conf.DB_PASSWORD
dbBase := conf.DB_BASE
dbPort := conf.DB_PORT
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", dbUser, dbPassword, dbHost, dbPort, dbBase)
logs.Info("mysql init.....", link)
orm.RegisterDriver("mysql", orm.DRMySQL)
orm.RegisterDataBase("default", "mysql", link)
_ = 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.MerchantDeployInfo),