|
@@ -527,8 +527,8 @@ func (b MessaggeService) FindMessage(in *messagecenter.MessageReq) *[]map[string
|
|
|
}
|
|
|
go func() {
|
|
|
updateMap := map[string]interface{}{}
|
|
|
- //if len(*data) > 0 && data != nil {
|
|
|
- if true {
|
|
|
+ if len(*data) > 0 && data != nil {
|
|
|
+ //if true {
|
|
|
//未读信息修改
|
|
|
switch in.MsgType {
|
|
|
case 2: //点对点聊天
|
|
@@ -643,44 +643,48 @@ func (b *MessaggeService) SaveAutoReplyMsg(userType, entId, entUserId, userId in
|
|
|
|
|
|
// 修改未读状态
|
|
|
func (b MessaggeService) UpdateReadById(in *messagecenter.ReadStateReq) bool {
|
|
|
- fool := util.Mysql.ExecTx("已读状态修改", func(tx *sql.Tx) bool {
|
|
|
- updateMap := map[string]interface{}{
|
|
|
- "messag_id": in.MessageId,
|
|
|
- "isread": 0,
|
|
|
- }
|
|
|
- fool := util.Mysql.Update(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap, map[string]interface{}{"read_time": time.Now().Local().Format(util.Date_Full_Layout), "isread": 1})
|
|
|
- if fool {
|
|
|
- //查询此条信息拥有者
|
|
|
- data := util.Mysql.FindOne(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap, "receive_user_type", "")
|
|
|
- if data != nil {
|
|
|
- userType := int64(1)
|
|
|
- userId := int64(0)
|
|
|
- if (*data)["receive_user_type"] == 2 {
|
|
|
- userType = 2
|
|
|
- userId = in.EntUserId
|
|
|
- } else {
|
|
|
- userType = 1
|
|
|
- userId = in.NewUserId
|
|
|
- }
|
|
|
- pc_a, err := util.GetData(userType, userId)
|
|
|
- if fool {
|
|
|
- if err == nil && pc_a != nil {
|
|
|
- if pc_a.Count >= 1 {
|
|
|
- //id一致
|
|
|
- if in.MessageId == pc_a.Data["id"] {
|
|
|
- util.SetData(userType, userId, map[string]interface{}{"data": map[string]interface{}{}, "count": pc_a.Count - 1}, util.SurvivalTime)
|
|
|
- } else {
|
|
|
- util.SetData(userType, userId, map[string]interface{}{"data": data, "count": pc_a.Count - 1}, util.SurvivalTime)
|
|
|
+ updateMap := map[string]interface{}{
|
|
|
+ "messag_id": in.MessageId,
|
|
|
+ "isread": 0,
|
|
|
+ }
|
|
|
+ if util.Mysql.Count(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap) > 0 {
|
|
|
+ fool := util.Mysql.ExecTx("已读状态修改", func(tx *sql.Tx) bool {
|
|
|
+
|
|
|
+ fool := util.Mysql.Update(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap, map[string]interface{}{"read_time": time.Now().Local().Format(util.Date_Full_Layout), "isread": 1})
|
|
|
+ if fool {
|
|
|
+ //查询此条信息拥有者
|
|
|
+ data := util.Mysql.FindOne(util.SOCIALIZE_MESSAGE_MAILBOX, updateMap, "receive_user_type", "")
|
|
|
+ if data != nil {
|
|
|
+ userType := int64(1)
|
|
|
+ userId := int64(0)
|
|
|
+ if (*data)["receive_user_type"] == 2 {
|
|
|
+ userType = 2
|
|
|
+ userId = in.EntUserId
|
|
|
+ } else {
|
|
|
+ userType = 1
|
|
|
+ userId = in.NewUserId
|
|
|
+ }
|
|
|
+ pc_a, err := util.GetData(userType, userId)
|
|
|
+ if fool {
|
|
|
+ if err == nil && pc_a != nil {
|
|
|
+ if pc_a.Count >= 1 {
|
|
|
+ //id一致
|
|
|
+ if in.MessageId == pc_a.Data["id"] {
|
|
|
+ util.SetData(userType, userId, map[string]interface{}{"data": map[string]interface{}{}, "count": pc_a.Count - 1}, util.SurvivalTime)
|
|
|
+ } else {
|
|
|
+ util.SetData(userType, userId, map[string]interface{}{"data": data, "count": pc_a.Count - 1}, util.SurvivalTime)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ return fool
|
|
|
+ })
|
|
|
return fool
|
|
|
- })
|
|
|
- return fool
|
|
|
+ }
|
|
|
+ return true
|
|
|
}
|
|
|
|
|
|
// WithdrawMessage 撤回消息
|