作者 yangfu

机会详情 点赞数据

... ... @@ -332,7 +332,7 @@ type ChanceDetailRequest struct {
}
type ChanceDetailResponse struct {
ChanceDetail ChanceItem `json:"chance"`
ChanceData interface{} `json:"chanceData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData
StatisticData interface{} `json:"statisticData"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData
ApproveData *ApproveData `json:"approveData"`
ApproveProcess []*ProcessItem `json:"approveProcess"`
ApproveAccess *ApproveAccess `json:"approveAccess"` //
... ...
... ... @@ -185,7 +185,7 @@ func GetChanceMarkData(userId, companyId int64, sourceId int64) (flag int, err e
)
if v, err = models.GetChanceFavorite(userId, companyId, sourceId, protocol.SourceTypeChance); err != nil {
if err == orm.ErrNoRows {
log.Error(userId, companyId, sourceId, err)
//log.Error(userId, companyId, sourceId, err)
return 0, nil
}
return
... ...
... ... @@ -1388,6 +1388,22 @@ func ChanceDetail(header *protocol.RequestHeader, request *protocol.ChanceDetail
rsp.ApproveProcess = approveProcess.ApproveProcess
rsp.ApproveAccess = approveProcess.ApproveAccess
}
{
var flag int
var chanceData = protocol.ChanceData{
ThumbsUpTotal: chance.ZanTotal,
CommentTotal: chance.CommentTotal,
PageViewTotal: chance.ViewTotal,
}
if flag, err = agg.GetChanceMarkData(header.UserId, header.CompanyId, chance.Id); err != nil {
log.Error(err)
return
}
chanceData.IsThumbsUp = (flag & protocol.MarkFlagZan) == protocol.MarkFlagZan
chanceData.IsCollect = (flag & protocol.MarkFlagCollect) == protocol.MarkFlagCollect
rsp.StatisticData = chanceData
}
return
}
... ...