Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_scm_wms_sync
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
c85161e6
authored
May 07, 2020
by
mushishixian
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
精简优化代码
parent
ad0068b2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
6 additions
and
28 deletions
cmd/queue/sync_customer/main.go
cmd/queue/sync_goods/main.go
cmd/queue/sync_in_store/main.go
cmd/queue/sync_out_store/main.go
cmd/queue/sync_supplier/main.go
internal/logic/sync_log.go
cmd/queue/sync_customer/main.go
View file @
c85161e6
...
@@ -4,7 +4,6 @@ import (
...
@@ -4,7 +4,6 @@ import (
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
"scm_server/cmd/queue/sync_status/product"
...
@@ -27,17 +26,12 @@ type CustomerQueueMessage struct {
...
@@ -27,17 +26,12 @@ type CustomerQueueMessage struct {
}
}
}
}
func
init
()
{
log
.
Init
(
nil
)
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
var
(
var
(
message
CustomerQueueMessage
message
CustomerQueueMessage
err
error
err
error
customer
model
.
Customer
customer
model
.
Customer
operateType
string
operateType
string
)
)
//先去转换队列消息的json,如果失败,记录起来
//先去转换队列消息的json,如果失败,记录起来
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
...
...
cmd/queue/sync_goods/main.go
View file @
c85161e6
...
@@ -4,7 +4,6 @@ import (
...
@@ -4,7 +4,6 @@ import (
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
"scm_server/cmd/queue/sync_status/product"
...
@@ -28,17 +27,12 @@ type GoodsQueueMessage struct {
...
@@ -28,17 +27,12 @@ type GoodsQueueMessage struct {
}
}
}
}
func
init
()
{
log
.
Init
(
nil
)
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
var
(
var
(
message
GoodsQueueMessage
message
GoodsQueueMessage
err
error
err
error
goods
model
.
Goods
goods
model
.
Goods
operateType
string
operateType
string
)
)
//先去转换队列消息的json,如果失败,记录起来
//先去转换队列消息的json,如果失败,记录起来
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
...
...
cmd/queue/sync_in_store/main.go
View file @
c85161e6
...
@@ -4,7 +4,6 @@ import (
...
@@ -4,7 +4,6 @@ import (
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
"scm_server/cmd/queue/sync_status/product"
...
@@ -49,10 +48,6 @@ type InStoreFEntrys struct {
...
@@ -49,10 +48,6 @@ type InStoreFEntrys struct {
FRemark
string
FRemark
string
}
}
func
init
()
{
log
.
Init
(
nil
)
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
var
(
var
(
message
InStoreMessage
message
InStoreMessage
...
...
cmd/queue/sync_out_store/main.go
View file @
c85161e6
...
@@ -3,7 +3,6 @@ package sync_out_store
...
@@ -3,7 +3,6 @@ package sync_out_store
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"github.com/imroc/req"
"github.com/pkg/errors"
"github.com/pkg/errors"
...
@@ -49,10 +48,6 @@ type OutStoreFEntrys struct {
...
@@ -49,10 +48,6 @@ type OutStoreFEntrys struct {
FOriginCountry
string
FOriginCountry
string
}
}
func
init
()
{
log
.
Init
(
nil
)
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
var
(
var
(
message
OutStoreMessage
message
OutStoreMessage
...
...
cmd/queue/sync_supplier/main.go
View file @
c85161e6
...
@@ -4,7 +4,6 @@ import (
...
@@ -4,7 +4,6 @@ import (
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
"scm_server/cmd/queue/sync_status/product"
...
@@ -27,17 +26,12 @@ type SupplierQueueMessage struct {
...
@@ -27,17 +26,12 @@ type SupplierQueueMessage struct {
}
}
}
}
func
init
()
{
log
.
Init
(
nil
)
}
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
func
(
t
*
RecvPro
)
Consumer
(
dataByte
[]
byte
)
error
{
var
(
var
(
message
SupplierQueueMessage
message
SupplierQueueMessage
err
error
err
error
supplier
model
.
Supplier
supplier
model
.
Supplier
operateType
string
operateType
string
)
)
//先去转换队列消息的json,如果失败,记录起来
//先去转换队列消息的json,如果失败,记录起来
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
if
err
=
json
.
Unmarshal
(
dataByte
,
&
message
);
err
!=
nil
{
...
...
internal/logic/sync_log.go
View file @
c85161e6
...
@@ -9,6 +9,12 @@ import (
...
@@ -9,6 +9,12 @@ import (
"time"
"time"
)
)
func
init
(){
var
config
log
.
Config
config
.
Dir
=
"logs"
log
.
Init
(
&
config
)
}
const
InsertSyncLogSql
=
"INSERT INTO `lie_sync_log` (`sync_name`,`sync_time`,`sync_error`,`unique_id`,`queue_message`,`add_time`) VALUES (?,?,?,?,?,?)"
const
InsertSyncLogSql
=
"INSERT INTO `lie_sync_log` (`sync_name`,`sync_time`,`sync_error`,`unique_id`,`queue_message`,`add_time`) VALUES (?,?,?,?,?,?)"
//插入错误日志
//插入错误日志
...
...
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