作者 yangfu

我提交的修改

... ... @@ -122,7 +122,7 @@ GROUP BY msg_type`
func UpdateUserMsgSetRead(userId int64, companyId int64, msgType int, msgId int64) (err error) {
o := orm.NewOrm()
sql := `update user_msg set is_read = 1
where receive_user_id = ? and company_id=? `
where receive_user_id = ? and company_id=? and source_type<>3`
if msgType > 0 {
sql += fmt.Sprintf(" and (msg_type & %v)>0", msgType)
}
... ...
... ... @@ -74,6 +74,11 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe
if msg.IsRead == 1 {
return
}
//if msg.SourceType==protocol.SourceTypeBulletin{//公告已读
// if !checkBulletinCanRead(msg.SourceId){
// return
// }
//}
err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, request.MsgId)
if err != nil {
log.Error(err)
... ... @@ -81,6 +86,20 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe
return
}
//检查公告可否可以读
func checkBulletinCanRead(sourceId int64) bool {
var bulletin *models.Bulletin
var err error
if bulletin, err = models.GetBulletinById(int(sourceId)); err != nil {
log.Error(sourceId, err)
return false
}
if bulletin.AllowClose == 0 {
return true
}
return false
}
//标记全部已读
func MsgCenterAllRead(header *protocol.RequestHeader, request *protocol.MsgCenterAllReadRequest) (rsp *protocol.MsgCenterAllReadResponse, err error) {
var ()
... ... @@ -355,14 +374,14 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance
commItem.Chance = item
}
if chance.ReviewStatus == protocol.ReviewStatusPass {
var approveData *protocol.ApproveData
utils.JsonUnmarshal(chance.ApproveData, &approveData)
if approveData != nil {
commItem.Score = approveData.Score
}
}
if len(chance.Data) > 0 { //获取评分 && chance.ReviewStatus == protocol.ReviewStatusPass
//if chance.ReviewStatus == protocol.ReviewStatusPass {
// var approveData *protocol.ApproveData
// utils.JsonUnmarshal(chance.ApproveData, &approveData)
// if approveData != nil {
// commItem.Score = approveData.Score
// }
//}
if len(chance.Data) > 0 && chance.ReviewStatus != protocol.ReviewStatusReturn { //获取评分 && chance.ReviewStatus == protocol.ReviewStatusPass
var msgData *protocol.MsgData
utils.JsonUnmarshal(chance.Data, &msgData)
commItem.Score = msgData.Score
... ...