|
@@ -556,7 +556,7 @@ func (b MessaggeService) SaveMessage(in *messagecenter.MessageEntity) (fool bool
|
|
|
}
|
|
|
|
|
|
// 客服 用户聊天消息列表同步
|
|
|
-//sendUserType 发送人类型 1客服 2用户
|
|
|
+// sendUserType 发送人类型 1客服 2用户
|
|
|
func UserSynchronousList(customerServiceId, userId, entId, messageId int64, createTime string, sendUserType int64) {
|
|
|
log.Printf("同步最后消息参数customerServiceId:%d,userId:%d,entId%d,messageId:%d", customerServiceId, userId, entId, messageId)
|
|
|
/* rwLock.Lock()
|
|
@@ -1031,15 +1031,15 @@ func (this *MessaggeService) Chat(in *messagecenter.MessageEntity) (fool bool, e
|
|
|
fieids := []string{"appid", "messag_id", "type", "send_user_id", "send_user_type", "receive_user_id", "receive_user_type", "own_type", "own_id", "create_time", "chat_group_id", "isread"}
|
|
|
for _, v := range in.GroupIds {
|
|
|
args := []interface{}{}
|
|
|
- //发送人自己
|
|
|
- if !isWithdrawByOthers {
|
|
|
- args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, in.SendId, 2, 2, in.SendId, nowTime, v, 1)
|
|
|
- //最后一次聊天
|
|
|
- SocializeSummaryAddOrUpdate(tx, v, in.SendId, 0, messageId, isCustomerServiceAccess, nowTime)
|
|
|
- }
|
|
|
- if !isWithdrawByMyself {
|
|
|
- groupUser := GetUserByGroupId(tx, v, in.SendId)
|
|
|
- for _, vv := range groupUser {
|
|
|
+ groupUser := GetUserByGroupId(tx, v, in.SendId)
|
|
|
+ for _, vv := range groupUser {
|
|
|
+ //发送人自己
|
|
|
+ if !isWithdrawByOthers {
|
|
|
+ args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, vv, 2, 2, in.SendId, nowTime, v, 1)
|
|
|
+ //最后一次聊天
|
|
|
+ SocializeSummaryAddOrUpdate(tx, v, in.SendId, 0, messageId, isCustomerServiceAccess, nowTime)
|
|
|
+ }
|
|
|
+ if !isWithdrawByMyself {
|
|
|
log.Println("获取到群组下员工:", vv)
|
|
|
//接收人其他用户
|
|
|
args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, vv, 2, 2, vv, nowTime, v, 0)
|
|
@@ -1058,19 +1058,18 @@ func (this *MessaggeService) Chat(in *messagecenter.MessageEntity) (fool bool, e
|
|
|
}
|
|
|
fieids := []string{"appid", "messag_id", "type", "send_user_id", "send_user_type", "receive_user_id", "receive_user_type", "own_type", "own_id", "create_time", "isread"}
|
|
|
args := []interface{}{}
|
|
|
- if !isWithdrawByOthers {
|
|
|
- args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, in.SendId, 2, 2, in.SendId, nowTime, 1)
|
|
|
- }
|
|
|
- if !isWithdrawByMyself {
|
|
|
- for _, v := range in.ReceiverIds {
|
|
|
- args = append(args, in.Appid, messageId, in.ItemType, in.SendId, 2, v, 2, 2, v, nowTime, 0)
|
|
|
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ 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)
|
|
|
}
|
|
|
+ MessageMailBoxAdd(tx, fieids, args)
|
|
|
}
|
|
|
return true
|
|
|
})
|
|
@@ -1120,8 +1119,8 @@ func GetUserByGroupId(tx *sql.Tx, groupId, sendId int64) []int64 {
|
|
|
}
|
|
|
|
|
|
// 最后一次聊天存储
|
|
|
-//1v1是双方的
|
|
|
-//群聊是发送人和其他人的
|
|
|
+// 1v1是双方的
|
|
|
+// 群聊是发送人和其他人的
|
|
|
func SocializeSummaryAddOrUpdate(tx *sql.Tx, groupId, myPositionId, yourPositionId, messageId int64, isCustomerServiceAccess int, timestamp string) bool {
|
|
|
//判断是否存在
|
|
|
if groupId > 0 {
|