作者 唐旭辉

修复 bug

... ... @@ -44,16 +44,16 @@ func (command CreatePartnerInfoCommand) ValidateCommand() error {
if command.RegionInfo == nil {
return lib.ThrowError(lib.ARG_ERROR, "区域必填")
}
if len(command.Salesman) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "关联业务员必填")
}
for i := range command.Salesman {
if len(command.Salesman[i].Name) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "关联业务员名称必填")
}
if len(command.Salesman[i].Telephone) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "关联业务员电话必填")
}
}
// if len(command.Salesman) == 0 {
// return lib.ThrowError(lib.ARG_ERROR, "关联业务员必填")
// }
// for i := range command.Salesman {
// if len(command.Salesman[i].Name) == 0 {
// return lib.ThrowError(lib.ARG_ERROR, "关联业务员名称必填")
// }
// if len(command.Salesman[i].Telephone) == 0 {
// return lib.ThrowError(lib.ARG_ERROR, "关联业务员电话必填")
// }
// }
return nil
}
... ...
... ... @@ -31,19 +31,20 @@ func (command *UpdatePartnerInfoCommand) ValidateCommand() error {
if command.RegionInfo == nil {
return lib.ThrowError(lib.ARG_ERROR, "区域必填")
}
if len(command.Salesman) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "关联业务员必填")
}
if command.Id == 0 {
return lib.ThrowError(lib.ARG_ERROR, "合伙人id错误")
}
for i := range command.Salesman {
if len(command.Salesman[i].Name) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "关联业务员名称必填")
}
if len(command.Salesman[i].Telephone) == 0 {
return lib.ThrowError(lib.ARG_ERROR, "关联业务员电话必填")
}
}
// if len(command.Salesman) == 0 {
// return lib.ThrowError(lib.ARG_ERROR, "关联业务员必填")
// }
// for i := range command.Salesman {
// if len(command.Salesman[i].Name) == 0 {
// return lib.ThrowError(lib.ARG_ERROR, "关联业务员名称必填")
// }
// if len(command.Salesman[i].Telephone) == 0 {
// return lib.ThrowError(lib.ARG_ERROR, "关联业务员电话必填")
// }
// }
return nil
}
... ...
... ... @@ -55,14 +55,14 @@ func (c *MessageConsumer) ConsumeClaim(groupSession sarama.ConsumerGroupSession,
for message := range groupClaim.Messages() {
logs.Debug("Done Message claimed: timestamp = %v, topic = %s offset = %v value = %v \n",
message.Timestamp, message.Topic, message.Offset, string(message.Value))
groupSession.MarkMessage(message, "")
if topicHandle, err = c.FindTopichandle(groupClaim.Topic()); err != nil {
logs.Error("FindTopichandle err:%s \n", err)
continue
}
if err = topicHandle(message); err != nil {
logs.Error("Message claimed: kafka消息处理错误 topic =", message.Topic, message.Offset, err)
} else {
groupSession.MarkMessage(message, "")
}
}
return nil
... ...