Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
scm_server
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
c07ab32e
authored
May 07, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
整合启动
parent
43f08466
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
32 additions
and
14 deletions
cmd/queue/main.go
cmd/queue/sync_customer/main.go
cmd/queue/sync_goods/main.go
cmd/queue/sync_goods/product.go
cmd/queue/sync_in_store/main.go
cmd/queue/sync_in_store/product.go
cmd/queue/sync_out_store/main.go
cmd/queue/sync_out_store/product.go
cmd/queue/sync_status/main.go
cmd/queue/sync_supplier/main.go
cmd/queue/main.go
View file @
c07ab32e
...
...
@@ -3,6 +3,9 @@ package main
import
(
"github.com/imroc/req"
"scm_server/cmd/queue/sync_customer"
"scm_server/cmd/queue/sync_goods"
"scm_server/cmd/queue/sync_in_store"
"scm_server/cmd/queue/sync_out_store"
"scm_server/cmd/queue/sync_supplier"
"scm_server/configs"
"time"
...
...
@@ -38,6 +41,7 @@ func pushAlive() {
}
payload
=
append
(
payload
,
item
)
param
:=
req
.
BodyJSON
(
&
payload
)
req
.
Debug
=
false
url
=
configs
.
OpenFalconPushUrl
_
,
err
=
req
.
Post
(
url
,
param
)
if
err
!=
nil
{
...
...
@@ -48,6 +52,10 @@ func pushAlive() {
func
main
()
{
go
sync_customer
.
Sync
()
go
sync_supplier
.
Sync
()
go
sync_goods
.
Sync
()
go
sync_in_store
.
Sync
()
go
sync_out_store
.
Sync
()
//定时请求open falcon证明自己没挂
for
{
pushAlive
()
time
.
Sleep
(
5
*
time
.
Second
)
...
...
cmd/queue/sync_customer/main.go
View file @
c07ab32e
...
...
@@ -83,7 +83,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
if
err
=
SyncCustomerData
(
operateType
,
customer
);
err
!=
nil
{
goto
ERR
}
fmt
.
Println
(
"同步成功,开始发送金蝶状态同步"
)
if
err
=
product
.
SyncErpStatus
(
"customer"
,
customer
.
ErpId
);
err
!=
nil
{
goto
ERR
}
...
...
@@ -180,6 +179,11 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
}
func
Sync
()
{
defer
func
()
{
if
err
:=
recover
();
err
!=
nil
{
service
.
SendDingTalkRobotToApi
(
fmt
.
Sprintf
(
"%s"
,
err
))
}
}()
t
:=
&
RecvPro
{}
rabbitmq
.
Recv
(
rabbitmq
.
QueueExchange
{
"store_customer"
,
...
...
cmd/queue/sync_goods/main.go
View file @
c07ab32e
package
main
package
sync_goods
import
(
"encoding/json"
...
...
@@ -86,7 +86,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
if
err
=
SyncGoodsData
(
operateType
,
goods
);
err
!=
nil
{
goto
ERR
}
fmt
.
Println
(
"同步成功,开始发送金蝶状态同步"
)
if
err
=
product
.
SyncErpStatus
(
"material"
,
goods
.
ErpId
);
err
!=
nil
{
goto
ERR
}
...
...
@@ -183,7 +182,12 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
return
nil
}
func
main
()
{
func
Sync
()
{
defer
func
()
{
if
err
:=
recover
();
err
!=
nil
{
service
.
SendDingTalkRobotToApi
(
fmt
.
Sprintf
(
"%s"
,
err
))
}
}()
t
:=
&
RecvPro
{}
rabbitmq
.
Recv
(
rabbitmq
.
QueueExchange
{
"store_goods"
,
...
...
cmd/queue/sync_goods/product.go
View file @
c07ab32e
package
main
package
sync_goods
import
(
"encoding/json"
...
...
cmd/queue/sync_in_store/main.go
View file @
c07ab32e
package
main
package
sync_in_store
import
(
"encoding/json"
...
...
@@ -107,7 +107,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
goto
ERR
}
}
fmt
.
Println
(
"同步成功,开始发送金蝶状态同步"
)
if
err
=
product
.
SyncErpStatus
(
"inStore"
,
inStore
.
BillId
);
err
!=
nil
{
goto
ERR
}
...
...
@@ -250,7 +249,7 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
return
nil
}
func
main
()
{
func
Sync
()
{
t
:=
&
RecvPro
{}
rabbitmq
.
Recv
(
rabbitmq
.
QueueExchange
{
"store_in"
,
...
...
cmd/queue/sync_in_store/product.go
View file @
c07ab32e
package
main
package
sync_in_store
import
(
"encoding/json"
...
...
cmd/queue/sync_out_store/main.go
View file @
c07ab32e
package
main
package
sync_out_store
import
(
"encoding/json"
...
...
@@ -108,7 +108,6 @@ func (t *RecvPro) Consumer(dataByte []byte) error {
goto
ERR
}
}
fmt
.
Println
(
"同步成功,开始发送金蝶状态同步"
)
if
err
=
product
.
SyncErpStatus
(
"outStore"
,
outStore
.
BillId
);
err
!=
nil
{
goto
ERR
}
...
...
@@ -224,7 +223,7 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
return
nil
}
func
main
()
{
func
Sync
()
{
t
:=
&
RecvPro
{}
rabbitmq
.
Recv
(
rabbitmq
.
QueueExchange
{
"store_out"
,
...
...
cmd/queue/sync_out_store/product.go
View file @
c07ab32e
package
main
package
sync_out_store
import
(
"encoding/json"
...
...
cmd/queue/sync_status/main.go
View file @
c07ab32e
...
...
@@ -39,7 +39,6 @@ func (t *RecvPro) Consumer(dataByte []byte) (err error) {
goto
ERR
}
//得到message以后,去请求金蝶的接口
fmt
.
Println
(
"请求金蝶接口"
)
if
err
=
SyncErpDataStatus
(
message
.
SyncName
,
message
.
ErpId
);
err
!=
nil
{
goto
ERR
}
...
...
cmd/queue/sync_supplier/main.go
View file @
c07ab32e
...
...
@@ -180,6 +180,11 @@ func (t *RecvPro) FailAction(dataByte []byte) error {
}
func
Sync
()
{
defer
func
()
{
if
err
:=
recover
();
err
!=
nil
{
service
.
SendDingTalkRobotToApi
(
fmt
.
Sprintf
(
"%s"
,
err
))
}
}()
t
:=
&
RecvPro
{}
rabbitmq
.
Recv
(
rabbitmq
.
QueueExchange
{
"store_supplier"
,
...
...
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