...
|
...
|
@@ -311,6 +311,134 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance |
|
|
return
|
|
|
}
|
|
|
|
|
|
// 消息中心-互动消息.评论
|
|
|
func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanceCommentRequest) (rsp *protocol.MsgChanceCommentResponse, err error) {
|
|
|
var (
|
|
|
myChances []protocol.ChanceCommentItemOrm
|
|
|
total int
|
|
|
provider *protocol.BaseUserInfo
|
|
|
)
|
|
|
if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeComment, &myChances); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
return
|
|
|
}
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.MsgChanceCommentResponse{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,
|
|
|
}
|
|
|
utils.JsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
item.FormList = protocol.ClearEmptyForm(item.FormList)
|
|
|
utils.JsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
utils.JsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
utils.JsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
commItem.Chance = item
|
|
|
}
|
|
|
}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
}
|
|
|
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 MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanceThumbUpRequest) (rsp *protocol.MsgChanceThumbUpResponse, err error) {
|
|
|
var (
|
|
|
myChances []protocol.ChanceCommentItemOrm
|
|
|
total int
|
|
|
provider *protocol.BaseUserInfo
|
|
|
)
|
|
|
if total, err = models.GetChanceCommentMsg(header.UserId, request.LastId, request.PageSize, protocol.MsgTypeThumbUp, &myChances); err != nil {
|
|
|
if err == orm.ErrNoRows {
|
|
|
err = nil
|
|
|
return
|
|
|
}
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
rsp = &protocol.MsgChanceThumbUpResponse{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,
|
|
|
}
|
|
|
utils.JsonUnmarshal(chance.SourceContent, &item.FormList)
|
|
|
item.FormList = protocol.ClearEmptyForm(item.FormList)
|
|
|
utils.JsonUnmarshal(chance.Images, &item.Pictures)
|
|
|
utils.JsonUnmarshal(chance.Voices, &item.Speechs)
|
|
|
utils.JsonUnmarshal(chance.Videos, &item.Videos)
|
|
|
commItem.Chance = item
|
|
|
}
|
|
|
}
|
|
|
commItem.ReviewStatus = chance.ReviewStatus
|
|
|
}
|
|
|
if chance.SourceType == protocol.SourceTypeComment {
|
|
|
commItem.CommentedData = protocol.CommentData{
|
|
|
Id: chance.SourceId,
|
|
|
Content: chance.CommentedContent,
|
|
|
CommentTime: chance.CommentedTime.Unix() * 1000,
|
|
|
}
|
|
|
}
|
|
|
commItem.ThumbUpData = protocol.ThumbUpData{
|
|
|
Id: chance.CommentId,
|
|
|
ThumbUpTime: chance.CommentTime.Unix() * 1000,
|
|
|
Content: chance.CommentContent,
|
|
|
}
|
|
|
commItem.SourceType = chance.SourceType
|
|
|
rsp.List = append(rsp.List, commItem)
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
|
|
|
//H5公告详情
|
|
|
func H5Announcement(header *protocol.RequestHeader, request *protocol.AnnouncementRequest) (rsp *protocol.AnnouncementResponse, err error) {
|
|
|
var (
|
...
|
...
|
|