Commit c85161e6 by mushishixian

精简优化代码

parent ad0068b2
......@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
......@@ -27,17 +26,12 @@ type CustomerQueueMessage struct {
}
}
func init() {
log.Init(nil)
}
func (t *RecvPro) Consumer(dataByte []byte) error {
var (
message CustomerQueueMessage
err error
customer model.Customer
operateType string
)
//先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil {
......
......@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
......@@ -28,17 +27,12 @@ type GoodsQueueMessage struct {
}
}
func init() {
log.Init(nil)
}
func (t *RecvPro) Consumer(dataByte []byte) error {
var (
message GoodsQueueMessage
err error
goods model.Goods
operateType string
)
//先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil {
......
......@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
......@@ -49,10 +48,6 @@ type InStoreFEntrys struct {
FRemark string
}
func init() {
log.Init(nil)
}
func (t *RecvPro) Consumer(dataByte []byte) error {
var (
message InStoreMessage
......
......@@ -3,7 +3,6 @@ package sync_out_store
import (
"encoding/json"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"github.com/pkg/errors"
......@@ -49,10 +48,6 @@ type OutStoreFEntrys struct {
FOriginCountry string
}
func init() {
log.Init(nil)
}
func (t *RecvPro) Consumer(dataByte []byte) error {
var (
message OutStoreMessage
......
......@@ -4,7 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/go-kratos/kratos/pkg/log"
"github.com/ichunt2019/go-rabbitmq/utils/rabbitmq"
"github.com/imroc/req"
"scm_server/cmd/queue/sync_status/product"
......@@ -27,17 +26,12 @@ type SupplierQueueMessage struct {
}
}
func init() {
log.Init(nil)
}
func (t *RecvPro) Consumer(dataByte []byte) error {
var (
message SupplierQueueMessage
err error
supplier model.Supplier
operateType string
)
//先去转换队列消息的json,如果失败,记录起来
if err = json.Unmarshal(dataByte, &message); err != nil {
......
......@@ -9,6 +9,12 @@ import (
"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 (?,?,?,?,?,?)"
//插入错误日志
......
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