作者 yangfu

我提交的修改

@@ -122,7 +122,7 @@ GROUP BY msg_type` @@ -122,7 +122,7 @@ GROUP BY msg_type`
122 func UpdateUserMsgSetRead(userId int64, companyId int64, msgType int, msgId int64) (err error) { 122 func UpdateUserMsgSetRead(userId int64, companyId int64, msgType int, msgId int64) (err error) {
123 o := orm.NewOrm() 123 o := orm.NewOrm()
124 sql := `update user_msg set is_read = 1 124 sql := `update user_msg set is_read = 1
125 - where receive_user_id = ? and company_id=? ` 125 + where receive_user_id = ? and company_id=? and source_type<>3`
126 if msgType > 0 { 126 if msgType > 0 {
127 sql += fmt.Sprintf(" and (msg_type & %v)>0", msgType) 127 sql += fmt.Sprintf(" and (msg_type & %v)>0", msgType)
128 } 128 }
@@ -74,6 +74,11 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe @@ -74,6 +74,11 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe
74 if msg.IsRead == 1 { 74 if msg.IsRead == 1 {
75 return 75 return
76 } 76 }
  77 + //if msg.SourceType==protocol.SourceTypeBulletin{//公告已读
  78 + // if !checkBulletinCanRead(msg.SourceId){
  79 + // return
  80 + // }
  81 + //}
77 err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, request.MsgId) 82 err = models.UpdateUserMsgSetRead(header.UserId, header.CompanyId, request.MsgType, request.MsgId)
78 if err != nil { 83 if err != nil {
79 log.Error(err) 84 log.Error(err)
@@ -81,6 +86,20 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe @@ -81,6 +86,20 @@ func MsgCenterRead(header *protocol.RequestHeader, request *protocol.MsgCenterRe
81 return 86 return
82 } 87 }
83 88
  89 +//检查公告可否可以读
  90 +func checkBulletinCanRead(sourceId int64) bool {
  91 + var bulletin *models.Bulletin
  92 + var err error
  93 + if bulletin, err = models.GetBulletinById(int(sourceId)); err != nil {
  94 + log.Error(sourceId, err)
  95 + return false
  96 + }
  97 + if bulletin.AllowClose == 0 {
  98 + return true
  99 + }
  100 + return false
  101 +}
  102 +
84 //标记全部已读 103 //标记全部已读
85 func MsgCenterAllRead(header *protocol.RequestHeader, request *protocol.MsgCenterAllReadRequest) (rsp *protocol.MsgCenterAllReadResponse, err error) { 104 func MsgCenterAllRead(header *protocol.RequestHeader, request *protocol.MsgCenterAllReadRequest) (rsp *protocol.MsgCenterAllReadResponse, err error) {
86 var () 105 var ()
@@ -355,14 +374,14 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance @@ -355,14 +374,14 @@ func MsgChanceSubmit(header *protocol.RequestHeader, request *protocol.MsgChance
355 commItem.Chance = item 374 commItem.Chance = item
356 } 375 }
357 376
358 - if chance.ReviewStatus == protocol.ReviewStatusPass {  
359 - var approveData *protocol.ApproveData  
360 - utils.JsonUnmarshal(chance.ApproveData, &approveData)  
361 - if approveData != nil {  
362 - commItem.Score = approveData.Score  
363 - }  
364 - }  
365 - if len(chance.Data) > 0 { //获取评分 && chance.ReviewStatus == protocol.ReviewStatusPass 377 + //if chance.ReviewStatus == protocol.ReviewStatusPass {
  378 + // var approveData *protocol.ApproveData
  379 + // utils.JsonUnmarshal(chance.ApproveData, &approveData)
  380 + // if approveData != nil {
  381 + // commItem.Score = approveData.Score
  382 + // }
  383 + //}
  384 + if len(chance.Data) > 0 && chance.ReviewStatus != protocol.ReviewStatusReturn { //获取评分 && chance.ReviewStatus == protocol.ReviewStatusPass
366 var msgData *protocol.MsgData 385 var msgData *protocol.MsgData
367 utils.JsonUnmarshal(chance.Data, &msgData) 386 utils.JsonUnmarshal(chance.Data, &msgData)
368 commItem.Score = msgData.Score 387 commItem.Score = msgData.Score