|
@@ -1095,11 +1095,13 @@ func (this *MessaggeService) Chat(in *messagecenter.MessageEntity) (fool bool, e
|
|
|
for _, v := range in.ReceiverIds {
|
|
|
if !isWithdrawByOthers {
|
|
|
args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, v, 2, 2, in.SendId, nowTime, 1)
|
|
|
+ //最后一次聊天
|
|
|
+ SocializeSummaryAddOrUpdate(tx, 0, in.SendId, v, messageId, isCustomerServiceAccess, nowTime)
|
|
|
}
|
|
|
if !isWithdrawByMyself {
|
|
|
args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, v, 2, 2, v, nowTime, 0)
|
|
|
//最后一次聊天
|
|
|
- SocializeSummaryAddOrUpdate(tx, 0, in.SendId, v, messageId, isCustomerServiceAccess, nowTime)
|
|
|
+ SocializeSummaryAddOrUpdate(tx, 0, v, in.SendId, messageId, isCustomerServiceAccess, nowTime)
|
|
|
}
|
|
|
}
|
|
|
MessageMailBoxAdd(tx, fieids, args)
|
|
@@ -1225,28 +1227,6 @@ func SocializeSummaryAddOrUpdate(tx *sql.Tx, groupId, myPositionId, yourPosition
|
|
|
"customer_service_access": isCustomerServiceAccess,
|
|
|
}) > 0
|
|
|
}
|
|
|
- //接收方
|
|
|
- if r := IC.BaseMysql.SelectBySql(fmt.Sprintf(`select id,unread from %s where my_position_id =? and your_position_id =? limit 1`, util.SOCIALIZE_SUMMARY), yourPositionId, myPositionId); r != nil && len(*r) > 0 {
|
|
|
- //存在更新
|
|
|
- ok_your = IC.BaseMysql.UpdateByTx(tx, util.SOCIALIZE_SUMMARY, map[string]interface{}{
|
|
|
- "my_position_id": yourPositionId,
|
|
|
- "your_position_id": myPositionId,
|
|
|
- }, map[string]interface{}{
|
|
|
- "message_id": messageId,
|
|
|
- "timestamp": timestamp,
|
|
|
- "unread": gconv.Int((*r)[0]["unread"]) + 1,
|
|
|
- })
|
|
|
- } else {
|
|
|
- //新增
|
|
|
- ok_your = IC.BaseMysql.InsertByTx(tx, util.SOCIALIZE_SUMMARY, map[string]interface{}{
|
|
|
- "my_position_id": yourPositionId,
|
|
|
- "your_position_id": myPositionId,
|
|
|
- "message_id": messageId,
|
|
|
- "timestamp": timestamp,
|
|
|
- "unread": 1,
|
|
|
- "customer_service_access": isCustomerServiceAccess,
|
|
|
- }) > 0
|
|
|
- }
|
|
|
return ok_my && ok_your
|
|
|
}
|
|
|
}
|