浏览代码

fix:消息撤回修改

duxin 2 年之前
父节点
当前提交
8f0be30daa
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      service/message_mail_box.go

+ 5 - 1
service/message_mail_box.go

@@ -895,7 +895,11 @@ func SynchronousInfo(sender, recipient, conversationType, messageId, userType, e
 	case 2: //用户与客服
 		if IC.BaseMysql.Count(util.SOCIALIZE_MESSAGE, map[string]interface{}{"id": messageId, "own_id": recipient, "isread": 0}) > 0 {
 			if userType == 2 { //发送人是用户
-				IC.BaseMysql.SelectBySql(fmt.Sprintf("update %s set unread=CASE WHEN unread > 0 and user_id = %d and customer_service_id = %d and entId = %d THEN unread-1 ELSE 0 END;", util.Socialize_customer_service_user, sender, recipient, entId))
+				//接收人是会话标识 查询客服id
+				data := IC.BaseMysql.FindOne(util.SOCIALIZE_CHAT_SESSION, map[string]interface{}{"id": recipient}, "", "")
+				if data != nil && len(*data) > 0 {
+					IC.BaseMysql.SelectBySql(fmt.Sprintf("update %s set unread=CASE WHEN unread > 0 and user_id = %d and customer_service_id = %d and entId = %d THEN unread-1 ELSE 0 END;", util.Socialize_customer_service_user, sender, quitl.IntAll((*data)["customer_service_id"]), entId))
+				}
 			} else { //发送人是客服
 				IC.BaseMysql.SelectBySql(fmt.Sprintf("update %s set unread=CASE WHEN unread > 0 and user_id = %d and ent_id = %d THEN unread-1 ELSE 0 END;", util.Socialize_summary, recipient, entId))
 			}