...
|
...
|
@@ -1120,6 +1120,84 @@ func MyThumbUpChance(header *protocol.RequestHeader, request *protocol.MyThumbUp |
|
|
return
|
|
|
}
|
|
|
|
|
|
//我的评论
|
|
|
func MyComment(header *protocol.RequestHeader, request *protocol.MyCommentRequest) (rsp *protocol.MyCommentResponse, err error) {
|
|
|
var (
|
|
|
myChances []protocol.ChanceCommentItemOrm
|
|
|
total int
|
|
|
provider *protocol.BaseUserInfo
|
|
|
)
|
|
|
if total, err = models.GetChanceComment(header.UserId, request.LastId, request.PageSize, &myChances); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
return
|
|
|
}
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.MyCommentResponse{Total: total}
|
|
|
for i := 0; i < len(myChances); i++ {
|
|
|
chance := myChances[i]
|
|
|
commItem := protocol.CommonListItem{}
|
|
|
if chance.SourceType == protocol.SourceTypeChance {
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
if len(chance.SourceContent) == 0 { //机会删除
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
} else if chance.ChanceEnableStatus == 0 { //机会关闭
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusClose
|
|
|
} else {
|
|
|
if provider, err = agg.GetUserBaseInfo(header.UserId, header.CompanyId); err != nil {
|
|
|
commItem.ChanceStatus = protocol.ChanceStatusDelete
|
|
|
log.Error(err)
|
|
|
//return
|
|
|
} else {
|
|
|
item := protocol.ChanceItem{
|
|
|
Id: chance.SourceId,
|
|
|
Provider: provider,
|
|
|
CreateTime: chance.CreateTime.Unix() * 1000,
|
|
|
}
|
|
|
jsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
item.FormList = clearEmptyForm(item.FormList)
|
|
|
jsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
jsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
jsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
commItem.Chance = item
|
|
|
}
|
|
|
}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
//{
|
|
|
// var chanceData = protocol.ChanceData{
|
|
|
// ThumbsUpTotal: chance.ZanTotal,
|
|
|
// CommentTotal: chance.CommentTotal,
|
|
|
// PageViewTotal: chance.ViewTotal,
|
|
|
// }
|
|
|
// chanceData.IsThumbsUp, chanceData.IsCollect, _ = getChanceMarkFlag(header, chance.SourceType)
|
|
|
// commItem.ChanceData = chanceData
|
|
|
//}
|
|
|
//{
|
|
|
// //做一次查询 查回所有的模板数据
|
|
|
// commItem.ChanceTemplate = getTemplate(chance.TemplateId)
|
|
|
// commItem.ChanceType = getChanceType(chance.ChanceTypeId)
|
|
|
//}
|
|
|
}
|
|
|
if chance.SourceType == protocol.SourceTypeComment {
|
|
|
commItem.CommentedData = protocol.CommentData{
|
|
|
Id: chance.SourceId,
|
|
|
Content: chance.CommentedContent,
|
|
|
CommentTime: chance.CommentedTime.Unix() * 1000,
|
|
|
}
|
|
|
}
|
|
|
commItem.CommentData = protocol.CommentData{
|
|
|
Id: chance.CommentId,
|
|
|
CommentTime: chance.CommentTime.Unix() * 1000,
|
|
|
Content: chance.CommentContent,
|
|
|
}
|
|
|
commItem.SourceType = chance.SourceType
|
|
|
rsp.List = append(rsp.List, commItem)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//获取机会点赞/收藏状态
|
|
|
func getChanceMarkFlag(header *protocol.RequestHeader, chanceId int64) (isThumbsUp, isCollect bool, err error) {
|
|
|
var flag int
|
...
|
...
|
|