Merge branch 'v2.3.0release' of github.com:OpenIMSDK/Open-IM-Server into v2.3.0release

This commit is contained in:
wangchuxiao
2022-09-27 15:35:50 +08:00
27 changed files with 556 additions and 618 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ func SendMsg(c *gin.Context) {
}
client := pbChat.NewMsgClient(etcdConn)
log.Info("", "", "api SendMsg call, api call rpc...")
log.Info(params.OperationID, "", "api SendMsg call, api call rpc...")
reply, err := client.SendMsg(context.Background(), pbData)
if err != nil {
+13 -3
View File
@@ -62,7 +62,7 @@ func callbackOfflinePush(operationID string, userIDList []string, msg *commonPb.
func callbackOnlinePush(operationID string, userIDList []string, msg *commonPb.MsgData) cbApi.CommonCallbackResp {
callbackResp := cbApi.CommonCallbackResp{OperationID: operationID}
if !config.Config.Callback.CallbackOnlinePush.Enable {
if !config.Config.Callback.CallbackOnlinePush.Enable || utils.IsContain(msg.SendID, userIDList) {
return callbackResp
}
req := cbApi.CallbackBeforePushReq{
@@ -96,6 +96,11 @@ func callbackOnlinePush(operationID string, userIDList []string, msg *commonPb.M
return callbackResp
}
}
if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
if resp.OfflinePushInfo != nil {
msg.OfflinePushInfo = resp.OfflinePushInfo
}
}
return callbackResp
}
@@ -133,8 +138,13 @@ func callbackBeforeSuperGroupOnlinePush(operationID string, groupID string, msg
return callbackResp
}
}
if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow && len(resp.UserIDList) != 0 {
*pushToUserList = resp.UserIDList
if resp.ErrCode == constant.CallbackHandleSuccess && resp.ActionCode == constant.ActionAllow {
if len(resp.UserIDList) != 0 {
*pushToUserList = resp.UserIDList
}
if resp.OfflinePushInfo != nil {
msg.OfflinePushInfo = resp.OfflinePushInfo
}
}
log.NewDebug(operationID, utils.GetSelfFuncName(), pushToUserList, resp.UserIDList)
return callbackResp
+13
View File
@@ -56,6 +56,19 @@ func (rpc *rpcAuth) UserToken(_ context.Context, req *pbAuth.UserTokenReq) (*pbA
return &pbAuth.UserTokenResp{CommonResp: &pbAuth.CommonResp{}, Token: tokens, ExpiredTime: expTime}, nil
}
func (rpc *rpcAuth) ParseToken(_ context.Context, req *pbAuth.ParseTokenReq) (*pbAuth.ParseTokenResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
claims, err := token_verify.ParseToken(req.Token, req.OperationID)
if err != nil {
errMsg := "ParseToken failed " + err.Error() + req.OperationID + " token " + req.Token
log.Error(req.OperationID, errMsg, "token:", req.Token)
return &pbAuth.ParseTokenResp{CommonResp: &pbAuth.CommonResp{ErrCode: 4001, ErrMsg: errMsg}}, nil
}
resp := pbAuth.ParseTokenResp{CommonResp: &pbAuth.CommonResp{}, UserID: claims.UID, Platform: claims.Platform, ExpireTimeSeconds: uint32(claims.ExpiresAt.Unix())}
log.Info(req.OperationID, utils.GetSelfFuncName(), " rpc return ", resp.String())
return &resp, nil
}
func (rpc *rpcAuth) ForceLogout(_ context.Context, req *pbAuth.ForceLogoutReq) (*pbAuth.ForceLogoutResp, error) {
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), " rpc args ", req.String())
if !token_verify.IsManagerUserID(req.OpUserID) {
-1
View File
@@ -1 +0,0 @@
package auth
+1
View File
@@ -933,6 +933,7 @@ func Notification(n *NotificationMsg) {
log.NewError(req.OperationID, "SendMsg rpc failed, ", req.String(), reply.ErrCode, reply.ErrMsg)
}
}
func getOnlineAndOfflineUserIDList(memberList []string, m map[string][]string, operationID string) {
var onllUserIDList, offlUserIDList []string
var wsResult []*pbRelay.GetUsersOnlineStatusResp_SuccessResult