作者 yangfu

点赞人

... ... @@ -92,7 +92,7 @@ func GetUserCompanyByUserId(uid int64, companyId int64) (v *UserCompany, err err
//获取公司信息
func GetUserCompanyBy(id int64, companyId int64) (v *UserCompany, err error) {
o := orm.NewOrm()
sql := "select * from user_company where id=? and company_id=? and enable=1" //
sql := "select * from user_company where id=? and company_id=? " //and enable=1
if err = o.Raw(sql, id, companyId).QueryRow(&v); err == nil {
return v, nil
}
... ...
... ... @@ -525,6 +525,32 @@ type CommonListItem struct {
ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭
ReviewStatus int `json:"reviewStatus"` //审核状态
}
type MsgCommonListItem struct {
Chance ChanceItem `json:"chance,omitempty"` //机会详情
//ChanceData interface{} `json:"statisticData,omitempty"` //机会数据(是否收藏/点赞 浏览数 点赞总数 评论数)ChanceData
//Approve interface{} `json:"approve,omitempty"` //审核人 审核信息(时间) Approve
//ApproveData interface{} `json:"approveData,omitempty"` //审核数据(公开状态 评分) ApproveData
Message interface{} `json:"message,omitempty"` //消息
CommentData interface{} `json:"commentData,omitempty"` //评论
CollectData interface{} `json:"collectData,omitempty"` //收藏数据
ThumbUpData interface{} `json:"thumbUpData,omitempty"` //点赞数据
//我审核的-通过
Score interface{} `json:"score,omitempty"`
//模板
//ChanceType interface{} `json:"chanceType,omitempty"` //机会类型
//ChanceTemplate interface{} `json:"template,omitempty"` //机会模板
//我评论的 评论数据
CommentedData interface{} `json:"commentedData,omitempty"`
SourceType int `json:"sourceType,omitempty"` //类型 1:机会 2:评论
ChanceStatus int `json:"chanceStatus"` //0:正常 1.删除 2.关闭
ReviewStatus int `json:"reviewStatus"` //审核状态
IsRead bool `json:"isRead"`
}
type ChanceItem struct {
Id int64 `json:"id"`
CreateTime int64 `json:"createTime"`
... ... @@ -557,7 +583,7 @@ type ThumbUpData struct {
Id int64 `json:"id"`
Content string `json:"content"` //点赞内容
ThumbUpTime int64 `json:"thumbUpTime"` //收藏时间
IsRead bool `json:"is_read"` //是否已读
//IsRead bool `json:"is_read"` //是否已读
}
//评论内容
... ... @@ -565,5 +591,6 @@ type CommentData struct {
Id int64 `json:"id"` //评论编号
Content string `json:"content"` //评论内容
CommentTime int64 `json:"commentTime"` //评论时间
IsRead bool `json:"isRead"` //是否已读
//IsRead bool `json:"isRead"` //是否已读
Provider interface{} `json:"provider,omitempty"`
}
... ...
... ... @@ -126,7 +126,7 @@ type UserMsg struct {
MsgId int64 `json:"msgId"`
BulletinId int64 `json:"-"`
SourceType int `json:"msgType"`
Content string `json:"content"`
Content string `json:"title"`
CreateAt int64 `json:"msgTime"`
IsRead int `json:"isRead"`
//机会 //评论
... ... @@ -223,8 +223,8 @@ type MsgChanceApproveRequest struct {
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceApproveResponse struct {
List []CommonListItem `json:"list"`
Total int `json:"total"`
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
/*MsgChanceSubmit 我提交的*/
... ... @@ -233,8 +233,8 @@ type MsgChanceSubmitRequest struct {
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceSubmitResponse struct {
List []CommonListItem `json:"list"`
Total int `json:"total"`
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
/*MsgChanceComment 消息中心-互动消息.评论*/
... ... @@ -243,8 +243,8 @@ type MsgChanceCommentRequest struct {
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceCommentResponse struct {
List []CommonListItem `json:"list"`
Total int `json:"total"`
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
/*MsgChanceThumbUp 息中心-互动消息.点赞*/
... ... @@ -253,8 +253,8 @@ type MsgChanceThumbUpRequest struct {
PageSize int `json:"pageSize" valid:"Required"`
}
type MsgChanceThumbUpResponse struct {
List []CommonListItem `json:"list"`
Total int `json:"total"`
List []MsgCommonListItem `json:"list"`
Total int `json:"total"`
}
//我的审核机会列表
... ...
... ... @@ -215,7 +215,7 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc
rsp = &protocol.MsgChanceApproveResponse{Total: total}
for i := 0; i < len(myChances); i++ {
chance := myChances[i]
commItem := protocol.CommonListItem{}
commItem := protocol.MsgCommonListItem{}
commItem.ReviewStatus = chance.ReviewStatus
if len(chance.SourceContent) == 0 { //机会删除
commItem.ChanceStatus = protocol.ChanceStatusDelete
... ... @@ -250,6 +250,7 @@ func MsgChanceApprove(header *protocol.RequestHeader, request *protocol.MsgChanc
}
//审核完有审核数据
commItem.Message = chance.Message
commItem.IsRead = chance.IsRead == 1
rsp.List = append(rsp.List, commItem)
}
return
... ... @@ -273,7 +274,7 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance
rsp = &protocol.MsgChanceSubmitResponse{Total: total}
for i := 0; i < len(myChances); i++ {
chance := myChances[i]
commItem := protocol.CommonListItem{}
commItem := protocol.MsgCommonListItem{}
commItem.ReviewStatus = chance.ReviewStatus
if len(chance.SourceContent) == 0 { //机会删除
commItem.ChanceStatus = protocol.ChanceStatusDelete
... ... @@ -306,6 +307,7 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance
commItem.Score = approveData.Score
}
}
commItem.IsRead = chance.IsRead == 1
//审核完有审核数据
commItem.Message = chance.Message
rsp.List = append(rsp.List, commItem)
... ... @@ -331,7 +333,7 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc
rsp = &protocol.MsgChanceCommentResponse{Total: total}
for i := 0; i < len(myChances); i++ {
chance := myChances[i]
commItem := protocol.CommonListItem{}
commItem := protocol.MsgCommonListItem{}
if chance.SourceType == protocol.SourceTypeChance {
commItem.ReviewStatus = chance.ReviewStatus
if len(chance.SourceContent) == 0 { //机会删除
... ... @@ -360,18 +362,24 @@ func MsgChanceComment(header *protocol.RequestHeader, request *protocol.MsgChanc
commItem.ReviewStatus = chance.ReviewStatus
}
if chance.SourceType == protocol.SourceTypeComment {
if provider, err = agg.GetUserBaseInfo(chance.CommentedUserId, header.CompanyId); err != nil {
commItem.ChanceStatus = protocol.ChanceStatusDelete
log.Error(err)
//return
}
commItem.CommentedData = protocol.CommentData{
Id: chance.SourceId,
Content: chance.CommentedContent,
CommentTime: chance.CommentedTime.Unix() * 1000,
Provider: provider,
}
}
commItem.CommentData = protocol.CommentData{
Id: chance.CommentId,
CommentTime: chance.CommentTime.Unix() * 1000,
Content: chance.CommentContent,
IsRead: chance.IsRead == 1,
}
commItem.IsRead = chance.IsRead == 1
commItem.SourceType = chance.SourceType
rsp.List = append(rsp.List, commItem)
}
... ... @@ -396,7 +404,7 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc
rsp = &protocol.MsgChanceThumbUpResponse{Total: total}
for i := 0; i < len(myChances); i++ {
chance := myChances[i]
commItem := protocol.CommonListItem{}
commItem := protocol.MsgCommonListItem{}
if chance.SourceType == protocol.SourceTypeChance {
commItem.ReviewStatus = chance.ReviewStatus
if len(chance.SourceContent) == 0 { //机会删除
... ... @@ -425,18 +433,24 @@ func MsgChanceThumbUp(header *protocol.RequestHeader, request *protocol.MsgChanc
commItem.ReviewStatus = chance.ReviewStatus
}
if chance.SourceType == protocol.SourceTypeComment {
if provider, err = agg.GetUserBaseInfo(chance.CommentedUserId, header.CompanyId); err != nil {
commItem.ChanceStatus = protocol.ChanceStatusDelete
log.Error(err)
//return
}
commItem.CommentedData = protocol.CommentData{
Id: chance.SourceId,
Content: chance.CommentedContent,
CommentTime: chance.CommentedTime.Unix() * 1000,
Provider: provider,
}
}
commItem.ThumbUpData = protocol.ThumbUpData{
Id: chance.CommentId,
ThumbUpTime: chance.CommentTime.Unix() * 1000,
Content: chance.CommentContent,
IsRead: chance.IsRead == 1,
}
commItem.IsRead = chance.IsRead == 1
commItem.SourceType = chance.SourceType
rsp.List = append(rsp.List, commItem)
}
... ...