Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
wang
/
go_supplier_task
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ab9c0272
authored
Mar 23, 2021
by
wang
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修改测试脚本
parent
ded1f7f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
15 deletions
boot/app.go
cmd/cron/merge/cron.go
conf/dev/mongo.ini
pkg/mysql/mysql.go
boot/app.go
View file @
ab9c0272
...
...
@@ -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
}
cmd/cron/merge/cron.go
View file @
ab9c0272
...
...
@@ -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
()
{
...
...
conf/dev/mongo.ini
0 → 100644
View file @
ab9c0272
;存放mongodb连接信息
[mongo]
host
=
192.168.1.237:27017
username
=
"ichunt"
password
=
"huntmon6699"
database
=
ichunt
maxPoolSize
=
8000
\ No newline at end of file
pkg/mysql/mysql.go
View file @
ab9c0272
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment