作者 庄敏学

修复职位消息报错

不能预览此文件类型
... ... @@ -57,7 +57,7 @@ func (service SyncDataPositionService) CreateOrUpdatePosition(positionCommand *c
Level: positionCommand.Level,
}
pdm, _ := positionRepository.FindOne(map[string]interface{}{"id": position.Id})
if pdm.Id > 0 {
if pdm != nil && pdm.Id > 0 {
_, err = positionRepository.Update(position)
} else {
_, err = positionRepository.Insert(position)
... ...
... ... @@ -2,6 +2,7 @@ package handle
import (
"encoding/json"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/position/service"
"strconv"
"github.com/Shopify/sarama"
... ... @@ -88,16 +89,16 @@ func SyncDataBusinessAdmin(msgData *sarama.ConsumerMessage) error {
return err
}
case "position":
//positionSrv := service.SyncDataPositionService{}
//err = positionSrv.FromBusinessAdmin(&msgBody)
//if err != nil {
// log.Logger.Error("处理position消息失败"+err.Error(), map[string]interface{}{
// "module": msgBody.Module,
// "action": msgBody.Action,
// "data": string(msgBody.Data),
// })
// return err
//}
positionSrv := service.SyncDataPositionService{}
err = positionSrv.FromBusinessAdmin(&msgBody)
if err != nil {
log.Logger.Error("处理position消息失败"+err.Error(), map[string]interface{}{
"module": msgBody.Module,
"action": msgBody.Action,
"data": string(msgBody.Data),
})
return err
}
}
err = msgRepo.SaveMessage(&receivedMsg)
if err != nil {
... ...