...
|
...
|
@@ -15,9 +15,43 @@ import ( |
|
|
)
|
|
|
|
|
|
func MessageCenter(header *protocol.RequestHeader, request *protocol.MessageCenterRequest) (rsp *protocol.MessageCenterResponse, err error) {
|
|
|
var ()
|
|
|
var (
|
|
|
list []*protocol.MessageTotal
|
|
|
interactionCount int
|
|
|
)
|
|
|
rsp = &protocol.MessageCenterResponse{}
|
|
|
if request.MsgType&protocol.MsgTypeInteraction > 0 {
|
|
|
if request.MsgType&protocol.MsgTypeThumbUp == 0 {
|
|
|
request.MsgType |= protocol.MsgTypeThumbUp
|
|
|
}
|
|
|
if request.MsgType&protocol.MsgTypeComment == 0 {
|
|
|
request.MsgType |= protocol.MsgTypeComment
|
|
|
}
|
|
|
if request.MsgType&protocol.MsgTypeAuditBy == 0 {
|
|
|
request.MsgType |= protocol.MsgTypeAuditBy
|
|
|
}
|
|
|
}
|
|
|
err = models.GetUserMsgTotals(header.UserId, header.CompanyId, request.MsgType, &rsp.Totals)
|
|
|
for i := range rsp.Totals {
|
|
|
item := rsp.Totals[i]
|
|
|
if item.MsgType == protocol.MsgTypeThumbUp {
|
|
|
interactionCount += item.MsgTotal
|
|
|
continue
|
|
|
}
|
|
|
if item.MsgType == protocol.MsgTypeComment {
|
|
|
interactionCount += item.MsgTotal
|
|
|
continue
|
|
|
}
|
|
|
if item.MsgType == protocol.MsgTypeAuditBy {
|
|
|
interactionCount += item.MsgTotal
|
|
|
continue
|
|
|
}
|
|
|
list = append(list, item)
|
|
|
}
|
|
|
if interactionCount > 0 {
|
|
|
list = append(list, &protocol.MessageTotal{MsgType: protocol.MsgTypeInteraction, MsgTotal: interactionCount})
|
|
|
}
|
|
|
rsp.Totals = list
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
|