mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
update
This commit is contained in:
parent
775aba52bd
commit
6b0a2c9464
@ -143,14 +143,28 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) {
|
|||||||
if detailContent == "" {
|
if detailContent == "" {
|
||||||
detailContent = title
|
detailContent = title
|
||||||
}
|
}
|
||||||
pushResult, err := offlinePusher.Push(UIDList, title, detailContent, pushMsg.OperationID, opts)
|
if pushMsg.MsgData.ContentType == constant.SignalingNotification {
|
||||||
if err != nil {
|
go func() {
|
||||||
promePkg.PromeInc(promePkg.MsgOfflinePushFailedCounter)
|
pushResult, err := offlinePusher.Push(UIDList, title, detailContent, pushMsg.OperationID, opts)
|
||||||
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
|
if err != nil {
|
||||||
|
promePkg.PromeInc(promePkg.MsgOfflinePushFailedCounter)
|
||||||
|
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
|
||||||
|
} else {
|
||||||
|
promePkg.PromeInc(promePkg.MsgOfflinePushSuccessCounter)
|
||||||
|
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
||||||
|
}
|
||||||
|
}()
|
||||||
} else {
|
} else {
|
||||||
promePkg.PromeInc(promePkg.MsgOfflinePushSuccessCounter)
|
pushResult, err := offlinePusher.Push(UIDList, title, detailContent, pushMsg.OperationID, opts)
|
||||||
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
if err != nil {
|
||||||
|
promePkg.PromeInc(promePkg.MsgOfflinePushFailedCounter)
|
||||||
|
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
|
||||||
|
} else {
|
||||||
|
promePkg.PromeInc(promePkg.MsgOfflinePushSuccessCounter)
|
||||||
|
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,26 +304,54 @@ func MsgToSuperGroupUser(pushMsg *pbPush.PushMsgReq) {
|
|||||||
}
|
}
|
||||||
detailContent = title
|
detailContent = title
|
||||||
}
|
}
|
||||||
pushResult, err := offlinePusher.Push(needOfflinePushUserIDList, title, detailContent, pushMsg.OperationID, opts)
|
if pushMsg.MsgData.ContentType == constant.SignalingNotification {
|
||||||
if err != nil {
|
go func() {
|
||||||
promePkg.PromeInc(promePkg.MsgOfflinePushFailedCounter)
|
pushResult, err := offlinePusher.Push(needOfflinePushUserIDList, title, detailContent, pushMsg.OperationID, opts)
|
||||||
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
|
|
||||||
} else {
|
|
||||||
promePkg.PromeInc(promePkg.MsgOfflinePushSuccessCounter)
|
|
||||||
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
|
||||||
}
|
|
||||||
needBackgroupPushUserID := utils.IntersectString(needOfflinePushUserIDList, WebAndPcBackgroundUserIDList)
|
|
||||||
grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), pushMsg.OperationID)
|
|
||||||
if len(needBackgroupPushUserID) > 0 {
|
|
||||||
//Online push message
|
|
||||||
log.Debug(pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
|
|
||||||
for _, v := range grpcCons {
|
|
||||||
msgClient := pbRelay.NewRelayClient(v)
|
|
||||||
_, err := msgClient.SuperGroupBackgroundOnlinePush(context.Background(), &pbRelay.OnlineBatchPushOneMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData,
|
|
||||||
PushToUserIDList: needBackgroupPushUserID})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.NewError("push data to client rpc err", pushMsg.OperationID, "err", err)
|
promePkg.PromeInc(promePkg.MsgOfflinePushFailedCounter)
|
||||||
continue
|
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
|
||||||
|
} else {
|
||||||
|
promePkg.PromeInc(promePkg.MsgOfflinePushSuccessCounter)
|
||||||
|
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
||||||
|
}
|
||||||
|
needBackgroupPushUserID := utils.IntersectString(needOfflinePushUserIDList, WebAndPcBackgroundUserIDList)
|
||||||
|
grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), pushMsg.OperationID)
|
||||||
|
if len(needBackgroupPushUserID) > 0 {
|
||||||
|
//Online push message
|
||||||
|
log.Debug(pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
|
||||||
|
for _, v := range grpcCons {
|
||||||
|
msgClient := pbRelay.NewRelayClient(v)
|
||||||
|
_, err := msgClient.SuperGroupBackgroundOnlinePush(context.Background(), &pbRelay.OnlineBatchPushOneMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData,
|
||||||
|
PushToUserIDList: needBackgroupPushUserID})
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("push data to client rpc err", pushMsg.OperationID, "err", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
} else {
|
||||||
|
pushResult, err := offlinePusher.Push(needOfflinePushUserIDList, title, detailContent, pushMsg.OperationID, opts)
|
||||||
|
if err != nil {
|
||||||
|
promePkg.PromeInc(promePkg.MsgOfflinePushFailedCounter)
|
||||||
|
log.NewError(pushMsg.OperationID, "offline push error", pushMsg.String(), err.Error())
|
||||||
|
} else {
|
||||||
|
promePkg.PromeInc(promePkg.MsgOfflinePushSuccessCounter)
|
||||||
|
log.NewDebug(pushMsg.OperationID, "offline push return result is ", pushResult, pushMsg.MsgData)
|
||||||
|
}
|
||||||
|
needBackgroupPushUserID := utils.IntersectString(needOfflinePushUserIDList, WebAndPcBackgroundUserIDList)
|
||||||
|
grpcCons := getcdv3.GetDefaultGatewayConn4Unique(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), pushMsg.OperationID)
|
||||||
|
if len(needBackgroupPushUserID) > 0 {
|
||||||
|
//Online push message
|
||||||
|
log.Debug(pushMsg.OperationID, "len grpc", len(grpcCons), "data", pushMsg.String())
|
||||||
|
for _, v := range grpcCons {
|
||||||
|
msgClient := pbRelay.NewRelayClient(v)
|
||||||
|
_, err := msgClient.SuperGroupBackgroundOnlinePush(context.Background(), &pbRelay.OnlineBatchPushOneMsgReq{OperationID: pushMsg.OperationID, MsgData: pushMsg.MsgData,
|
||||||
|
PushToUserIDList: needBackgroupPushUserID})
|
||||||
|
if err != nil {
|
||||||
|
log.NewError("push data to client rpc err", pushMsg.OperationID, "err", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ func GetChatLog(chatLog *db.ChatLog, pageNumber, showNumber int32, contentTypeLi
|
|||||||
if chatLog.Content != "" {
|
if chatLog.Content != "" {
|
||||||
mdb = mdb.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
mdb = mdb.Where(" content like ? ", fmt.Sprintf("%%%s%%", chatLog.Content))
|
||||||
}
|
}
|
||||||
if chatLog.SessionType == 1 {
|
if chatLog.SessionType == 1 || chatLog.SessionType == 4 {
|
||||||
mdb = mdb.Where("session_type = ?", chatLog.SessionType)
|
mdb = mdb.Where("session_type = ?", chatLog.SessionType)
|
||||||
} else if chatLog.SessionType == 2 {
|
} else if chatLog.SessionType == 2 {
|
||||||
mdb = mdb.Where("session_type in (?)", []int{constant.GroupChatType, constant.SuperGroupChatType})
|
mdb = mdb.Where("session_type in (?)", []int{constant.GroupChatType, constant.SuperGroupChatType})
|
||||||
@ -37,7 +37,7 @@ func GetChatLog(chatLog *db.ChatLog, pageNumber, showNumber int32, contentTypeLi
|
|||||||
}
|
}
|
||||||
var chatLogs []db.ChatLog
|
var chatLogs []db.ChatLog
|
||||||
mdb = mdb.Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1)))
|
mdb = mdb.Limit(int(showNumber)).Offset(int(showNumber * (pageNumber - 1)))
|
||||||
if err := mdb.Find(&chatLogs).Error; err != nil {
|
if err := mdb.Order("send_time desc").Find(&chatLogs).Error; err != nil {
|
||||||
return 0, nil, err
|
return 0, nil, err
|
||||||
}
|
}
|
||||||
return count, chatLogs, nil
|
return count, chatLogs, nil
|
||||||
|
Loading…
x
Reference in New Issue
Block a user