正在显示
3 个修改的文件
包含
12 行增加
和
11 行删除
不能预览此文件类型
@@ -57,7 +57,7 @@ func (service SyncDataPositionService) CreateOrUpdatePosition(positionCommand *c | @@ -57,7 +57,7 @@ func (service SyncDataPositionService) CreateOrUpdatePosition(positionCommand *c | ||
57 | Level: positionCommand.Level, | 57 | Level: positionCommand.Level, |
58 | } | 58 | } |
59 | pdm, _ := positionRepository.FindOne(map[string]interface{}{"id": position.Id}) | 59 | pdm, _ := positionRepository.FindOne(map[string]interface{}{"id": position.Id}) |
60 | - if pdm.Id > 0 { | 60 | + if pdm != nil && pdm.Id > 0 { |
61 | _, err = positionRepository.Update(position) | 61 | _, err = positionRepository.Update(position) |
62 | } else { | 62 | } else { |
63 | _, err = positionRepository.Insert(position) | 63 | _, err = positionRepository.Insert(position) |
@@ -2,6 +2,7 @@ package handle | @@ -2,6 +2,7 @@ package handle | ||
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | "encoding/json" | 4 | "encoding/json" |
5 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/position/service" | ||
5 | "strconv" | 6 | "strconv" |
6 | 7 | ||
7 | "github.com/Shopify/sarama" | 8 | "github.com/Shopify/sarama" |
@@ -88,16 +89,16 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | @@ -88,16 +89,16 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error { | ||
88 | return err | 89 | return err |
89 | } | 90 | } |
90 | case "position": | 91 | case "position": |
91 | - //positionSrv := service.SyncDataPositionService{} | ||
92 | - //err = positionSrv.FromBusinessAdmin(&msgBody) | ||
93 | - //if err != nil { | ||
94 | - // log.Logger.Error("处理position消息失败"+err.Error(), map[string]interface{}{ | ||
95 | - // "module": msgBody.Module, | ||
96 | - // "action": msgBody.Action, | ||
97 | - // "data": string(msgBody.Data), | ||
98 | - // }) | ||
99 | - // return err | ||
100 | - //} | 92 | + positionSrv := service.SyncDataPositionService{} |
93 | + err = positionSrv.FromBusinessAdmin(&msgBody) | ||
94 | + if err != nil { | ||
95 | + log.Logger.Error("处理position消息失败"+err.Error(), map[string]interface{}{ | ||
96 | + "module": msgBody.Module, | ||
97 | + "action": msgBody.Action, | ||
98 | + "data": string(msgBody.Data), | ||
99 | + }) | ||
100 | + return err | ||
101 | + } | ||
101 | } | 102 | } |
102 | err = msgRepo.SaveMessage(&receivedMsg) | 103 | err = msgRepo.SaveMessage(&receivedMsg) |
103 | if err != nil { | 104 | if err != nil { |
-
请 注册 或 登录 后发表评论