Commit ab9c0272 by wang

修改测试脚本

parent ded1f7f1
......@@ -3,6 +3,7 @@ package boot
import (
"go_supplier_task/pkg/config"
"go_supplier_task/pkg/gredis"
"go_supplier_task/pkg/mongo"
"go_supplier_task/pkg/mysql"
)
......@@ -18,10 +19,10 @@ func Boot(configPath string) (err error) {
panic(err)
return
}
/*if err = mongo.SetUp(); err != nil {
if err = mongo.SetUp(); err != nil {
panic(err)
return
}*/
}
//logger.Loginit()
return
}
......@@ -6,6 +6,7 @@ import (
"go_supplier_task/boot"
"go_supplier_task/pkg/common"
"go_supplier_task/pkg/gredis"
"go_supplier_task/pkg/mongo"
"go_supplier_task/pkg/mq"
"go_supplier_task/pkg/mysql"
"go_supplier_task/service"
......@@ -26,14 +27,8 @@ func main() {
if err := boot.Boot(path); err != nil {
panic(err)
}
//service.NewServiceSupplier().MappingHandle(4)
//service.NewServiceSupplier().MappingHandle(3)
//return
//return
//service.NewServiceSupplier().MappingHandle(3)
//service.NewErpService().SyncErp()
//return
testConfig()
return
switch taskName {
case "supplierMerge":
fmt.Println("供应商合并")
......@@ -78,7 +73,11 @@ func testConfig() {
common.PrintStdout().Println("mysql配置连接测试")
for _,table:=range testMysqlConn{
mysql.Conn(table) //spu实例化链接
//spu实例化链接
err:=mysql.Conn(table).Ping()
if(err!=nil){
panic("连接:"+table+"出错:"+err.Error())
}
}
common.PrintStdout().Println("mysql配置连接测试成功")
common.PrintStdout().Println("redis配置连接测试")
......@@ -100,6 +99,11 @@ func testConfig() {
mq.PushMsg("go_supplier_task_test_conn","1")
common.PrintStdout().Println("rabbmit 配置连接成功")
mongodb := mongo.Conn("default")
defer func() {
mongodb.Close()
}()
}
func back() {
......
;存放mongodb连接信息
[mongo]
host = 192.168.1.237:27017
username = "ichunt"
password = "huntmon6699"
database = ichunt
maxPoolSize=8000
\ No newline at end of file
......@@ -46,10 +46,7 @@ func Setup() error {
func Conn(conName string) *xorm.Engine {
if value,ok:=DatabaseConMap[conName];ok{
if(value!=nil){
err:=value.Ping()
if(err!=nil){
panic("连接:"+conName+"出错:"+err.Error())
}
return value
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment