Merge remote-tracking branch 'origin/errcode' into errcode

test-errcode
withchao 2 years ago
commit 4b3d965783

@ -8,7 +8,7 @@ import (
"Open_IM/pkg/common/tokenverify"
utils2 "Open_IM/pkg/common/utils"
pbGroup "Open_IM/pkg/proto/group"
open_im_sdk "Open_IM/pkg/proto/sdkws"
"Open_IM/pkg/proto/sdkws"
"Open_IM/pkg/utils"
"context"
"github.com/golang/protobuf/jsonpb"
@ -23,7 +23,7 @@ import (
// uint64 OperationTime = 4;
//} creator->group
func setOpUserInfo(opUserID, groupID string, groupMemberInfo *open_im_sdk.GroupMemberFullInfo) error {
func setOpUserInfo(opUserID, groupID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error {
if tokenverify.IsManagerUserID(opUserID) {
u, err := imdb.GetUserByUserID(opUserID)
if err != nil {
@ -51,7 +51,7 @@ func setOpUserInfo(opUserID, groupID string, groupMemberInfo *open_im_sdk.GroupM
return nil
}
func setGroupInfo(groupID string, groupInfo *open_im_sdk.GroupInfo) error {
func setGroupInfo(groupID string, groupInfo *sdkws.GroupInfo) error {
group, err := imdb.GetGroupInfoByGroupID(groupID)
if err != nil {
return utils.Wrap(err, "GetGroupInfoByGroupID failed")
@ -64,7 +64,7 @@ func setGroupInfo(groupID string, groupInfo *open_im_sdk.GroupInfo) error {
return nil
}
func setGroupMemberInfo(groupID, userID string, groupMemberInfo *open_im_sdk.GroupMemberFullInfo) error {
func setGroupMemberInfo(groupID, userID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error {
groupMember, err := imdb.GetGroupMemberInfoByGroupIDAndUserID(groupID, userID)
if err == nil {
return utils.Wrap(utils2.GroupMemberDBCopyOpenIM(groupMemberInfo, groupMember), "")
@ -82,7 +82,7 @@ func setGroupMemberInfo(groupID, userID string, groupMemberInfo *open_im_sdk.Gro
return nil
}
func setGroupOwnerInfo(groupID string, groupMemberInfo *open_im_sdk.GroupMemberFullInfo) error {
func setGroupOwnerInfo(groupID string, groupMemberInfo *sdkws.GroupMemberFullInfo) error {
groupMember, err := imdb.GetGroupOwnerInfoByGroupID(groupID)
if err != nil {
return utils.Wrap(err, "")
@ -93,7 +93,7 @@ func setGroupOwnerInfo(groupID string, groupMemberInfo *open_im_sdk.GroupMemberF
return nil
}
func setPublicUserInfo(userID string, publicUserInfo *open_im_sdk.PublicUserInfo) error {
func setPublicUserInfo(userID string, publicUserInfo *sdkws.PublicUserInfo) error {
user, err := imdb.GetUserByUserID(userID)
if err != nil {
return utils.Wrap(err, "")
@ -211,7 +211,7 @@ func groupNotification(contentType int32, m proto.Message, sendID, groupID, recv
// 创建群后调用
func GroupCreatedNotification(operationID, opUserID, groupID string, initMemberList []string) {
GroupCreatedTips := open_im_sdk.GroupCreatedTips{Group: &open_im_sdk.GroupInfo{},
GroupCreatedTips := sdkws.GroupCreatedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, GroupOwnerUser: &open_im_sdk.GroupMemberFullInfo{}}
if err := setOpUserInfo(opUserID, groupID, GroupCreatedTips.OpUser); err != nil {
log.NewError(operationID, "setOpUserInfo failed ", err.Error(), opUserID, groupID, GroupCreatedTips.OpUser)
@ -248,7 +248,7 @@ func GroupCreatedNotification(operationID, opUserID, groupID string, initMemberL
// introduction := ""
// faceURL := ""
func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName, notification, introduction, faceURL string, needVerification *wrapperspb.Int32Value) {
GroupInfoChangedTips := open_im_sdk.GroupInfoSetTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}}
GroupInfoChangedTips := sdkws.GroupInfoSetTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, GroupInfoChangedTips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
@ -269,8 +269,8 @@ func GroupInfoSetNotification(operationID, opUserID, groupID string, groupName,
}
func GroupMutedNotification(operationID, opUserID, groupID string) {
tips := open_im_sdk.GroupMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}}
tips := sdkws.GroupMutedTips{Group: &sdkws.GroupInfo{},
OpUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
@ -283,8 +283,8 @@ func GroupMutedNotification(operationID, opUserID, groupID string) {
}
func GroupCancelMutedNotification(operationID, opUserID, groupID string) {
tips := open_im_sdk.GroupCancelMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}}
tips := sdkws.GroupCancelMutedTips{Group: &sdkws.GroupInfo{},
OpUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
@ -297,8 +297,8 @@ func GroupCancelMutedNotification(operationID, opUserID, groupID string) {
}
func GroupMemberMutedNotification(operationID, opUserID, groupID, groupMemberUserID string, mutedSeconds uint32) {
tips := open_im_sdk.GroupMemberMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}}
tips := sdkws.GroupMemberMutedTips{Group: &sdkws.GroupInfo{},
OpUser: &sdkws.GroupMemberFullInfo{}, MutedUser: &sdkws.GroupMemberFullInfo{}}
tips.MutedSeconds = mutedSeconds
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
@ -316,8 +316,8 @@ func GroupMemberMutedNotification(operationID, opUserID, groupID, groupMemberUse
}
func GroupMemberInfoSetNotification(operationID, opUserID, groupID, groupMemberUserID string) {
tips := open_im_sdk.GroupMemberInfoSetTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, ChangedUser: &open_im_sdk.GroupMemberFullInfo{}}
tips := sdkws.GroupMemberInfoSetTips{Group: &sdkws.GroupInfo{},
OpUser: &sdkws.GroupMemberFullInfo{}, ChangedUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
@ -338,8 +338,8 @@ func GroupMemberRoleLevelChangeNotification(operationID, opUserID, groupID, grou
log.NewError(operationID, utils.GetSelfFuncName(), "invalid notificationType: ", notificationType)
return
}
tips := open_im_sdk.GroupMemberInfoSetTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, ChangedUser: &open_im_sdk.GroupMemberFullInfo{}}
tips := sdkws.GroupMemberInfoSetTips{Group: &sdkws.GroupInfo{},
OpUser: &sdkws.GroupMemberFullInfo{}, ChangedUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
@ -356,8 +356,8 @@ func GroupMemberRoleLevelChangeNotification(operationID, opUserID, groupID, grou
}
func GroupMemberCancelMutedNotification(operationID, opUserID, groupID, groupMemberUserID string) {
tips := open_im_sdk.GroupMemberCancelMutedTips{Group: &open_im_sdk.GroupInfo{},
OpUser: &open_im_sdk.GroupMemberFullInfo{}, MutedUser: &open_im_sdk.GroupMemberFullInfo{}}
tips := sdkws.GroupMemberCancelMutedTips{Group: &sdkws.GroupInfo{},
OpUser: &sdkws.GroupMemberFullInfo{}, MutedUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, tips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
@ -385,7 +385,7 @@ func GroupMemberCancelMutedNotification(operationID, opUserID, groupID, groupMem
//
// 申请进群后调用
func JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGroupReq) {
JoinGroupApplicationTips := open_im_sdk.JoinGroupApplicationTips{Group: &open_im_sdk.GroupInfo{}, Applicant: &open_im_sdk.PublicUserInfo{}}
JoinGroupApplicationTips := sdkws.JoinGroupApplicationTips{Group: &sdkws.GroupInfo{}, Applicant: &sdkws.PublicUserInfo{}}
err := setGroupInfo(req.GroupID, JoinGroupApplicationTips.Group)
if err != nil {
log.Error(utils.OperationID(ctx), "setGroupInfo failed ", err.Error(), req.GroupID)
@ -409,7 +409,7 @@ func JoinGroupApplicationNotification(ctx context.Context, req *pbGroup.JoinGrou
}
func MemberQuitNotification(req *pbGroup.QuitGroupReq) {
MemberQuitTips := open_im_sdk.MemberQuitTips{Group: &open_im_sdk.GroupInfo{}, QuitUser: &open_im_sdk.GroupMemberFullInfo{}}
MemberQuitTips := sdkws.MemberQuitTips{Group: &sdkws.GroupInfo{}, QuitUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(req.GroupID, MemberQuitTips.Group); err != nil {
log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID)
return
@ -431,7 +431,7 @@ func MemberQuitNotification(req *pbGroup.QuitGroupReq) {
//
// 处理进群请求后调用
func GroupApplicationAcceptedNotification(req *pbGroup.GroupApplicationResponseReq) {
GroupApplicationAcceptedTips := open_im_sdk.GroupApplicationAcceptedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg}
GroupApplicationAcceptedTips := sdkws.GroupApplicationAcceptedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg}
if err := setGroupInfo(req.GroupID, GroupApplicationAcceptedTips.Group); err != nil {
log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, GroupApplicationAcceptedTips.Group)
return
@ -457,7 +457,7 @@ func GroupApplicationAcceptedNotification(req *pbGroup.GroupApplicationResponseR
}
func GroupApplicationRejectedNotification(req *pbGroup.GroupApplicationResponseReq) {
GroupApplicationRejectedTips := open_im_sdk.GroupApplicationRejectedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg}
GroupApplicationRejectedTips := sdkws.GroupApplicationRejectedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, HandleMsg: req.HandledMsg}
if err := setGroupInfo(req.GroupID, GroupApplicationRejectedTips.Group); err != nil {
log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, GroupApplicationRejectedTips.Group)
return
@ -482,7 +482,7 @@ func GroupApplicationRejectedNotification(req *pbGroup.GroupApplicationResponseR
}
func GroupOwnerTransferredNotification(req *pbGroup.TransferGroupOwnerReq) {
GroupOwnerTransferredTips := open_im_sdk.GroupOwnerTransferredTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}, NewGroupOwner: &open_im_sdk.GroupMemberFullInfo{}}
GroupOwnerTransferredTips := sdkws.GroupOwnerTransferredTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}, NewGroupOwner: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(req.GroupID, GroupOwnerTransferredTips.Group); err != nil {
log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID)
return
@ -499,7 +499,7 @@ func GroupOwnerTransferredNotification(req *pbGroup.TransferGroupOwnerReq) {
}
func GroupDismissedNotification(req *pbGroup.DismissGroupReq) {
tips := open_im_sdk.GroupDismissedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}}
tips := sdkws.GroupDismissedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(req.GroupID, tips.Group); err != nil {
log.NewError(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID)
return
@ -520,7 +520,7 @@ func GroupDismissedNotification(req *pbGroup.DismissGroupReq) {
//
// 被踢后调用
func MemberKickedNotification(req *pbGroup.KickGroupMemberReq, kickedUserIDList []string) {
MemberKickedTips := open_im_sdk.MemberKickedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}}
MemberKickedTips := sdkws.MemberKickedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(req.GroupID, MemberKickedTips.Group); err != nil {
log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID)
return
@ -530,7 +530,7 @@ func MemberKickedNotification(req *pbGroup.KickGroupMemberReq, kickedUserIDList
return
}
for _, v := range kickedUserIDList {
var groupMemberInfo open_im_sdk.GroupMemberFullInfo
var groupMemberInfo sdkws.GroupMemberFullInfo
if err := setGroupMemberInfo(req.GroupID, v, &groupMemberInfo); err != nil {
log.Error(req.OperationID, "setGroupMemberInfo failed ", err.Error(), req.GroupID, v)
continue
@ -553,7 +553,7 @@ func MemberKickedNotification(req *pbGroup.KickGroupMemberReq, kickedUserIDList
//
// 被邀请进群后调用
func MemberInvitedNotification(operationID, groupID, opUserID, reason string, invitedUserIDList []string) {
MemberInvitedTips := open_im_sdk.MemberInvitedTips{Group: &open_im_sdk.GroupInfo{}, OpUser: &open_im_sdk.GroupMemberFullInfo{}}
MemberInvitedTips := sdkws.MemberInvitedTips{Group: &sdkws.GroupInfo{}, OpUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, MemberInvitedTips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID)
return
@ -563,7 +563,7 @@ func MemberInvitedNotification(operationID, groupID, opUserID, reason string, in
return
}
for _, v := range invitedUserIDList {
var groupMemberInfo open_im_sdk.GroupMemberFullInfo
var groupMemberInfo sdkws.GroupMemberFullInfo
if err := setGroupMemberInfo(groupID, v, &groupMemberInfo); err != nil {
log.Error(operationID, "setGroupMemberInfo failed ", err.Error(), groupID)
continue
@ -594,8 +594,8 @@ func MemberInvitedNotification(operationID, groupID, opUserID, reason string, in
// }
//
// 群成员主动申请进群,管理员同意后调用,
func MemberEnterNotification(req *pbGroup.GroupApplicationResponseReq) {
MemberEnterTips := open_im_sdk.MemberEnterTips{Group: &open_im_sdk.GroupInfo{}, EntrantUser: &open_im_sdk.GroupMemberFullInfo{}}
func MemberEnterNotification(ctx context.Context, req *pbGroup.GroupApplicationResponseReq) {
MemberEnterTips := sdkws.MemberEnterTips{Group: &sdkws.GroupInfo{}, EntrantUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(req.GroupID, MemberEnterTips.Group); err != nil {
log.Error(req.OperationID, "setGroupInfo failed ", err.Error(), req.GroupID, MemberEnterTips.Group)
return
@ -608,7 +608,7 @@ func MemberEnterNotification(req *pbGroup.GroupApplicationResponseReq) {
}
func MemberEnterDirectlyNotification(groupID string, entrantUserID string, operationID string) {
MemberEnterTips := open_im_sdk.MemberEnterTips{Group: &open_im_sdk.GroupInfo{}, EntrantUser: &open_im_sdk.GroupMemberFullInfo{}}
MemberEnterTips := sdkws.MemberEnterTips{Group: &sdkws.GroupInfo{}, EntrantUser: &sdkws.GroupMemberFullInfo{}}
if err := setGroupInfo(groupID, MemberEnterTips.Group); err != nil {
log.Error(operationID, "setGroupInfo failed ", err.Error(), groupID, MemberEnterTips.Group)
return

@ -8,15 +8,18 @@ import (
"Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/controller"
"Open_IM/pkg/common/db/relation"
relationTb "Open_IM/pkg/common/db/table/relation"
tablerelation "Open_IM/pkg/common/db/table/relation"
"Open_IM/pkg/common/log"
promePkg "Open_IM/pkg/common/prometheus"
prome "Open_IM/pkg/common/prometheus"
"Open_IM/pkg/common/tokenverify"
"Open_IM/pkg/common/tracelog"
sdkws "Open_IM/pkg/proto/sdkws"
pbUser "Open_IM/pkg/proto/user"
"Open_IM/pkg/proto/group"
pbgroup "Open_IM/pkg/proto/group"
"Open_IM/pkg/proto/sdkws"
pbuser "Open_IM/pkg/proto/user"
"Open_IM/pkg/utils"
"context"
"github.com/golang/protobuf/ptypes/wrappers"
grpcPrometheus "github.com/grpc-ecosystem/go-grpc-prometheus"
"google.golang.org/grpc"
@ -61,9 +64,9 @@ func (s *userServer) Run() {
//grpc server
var grpcOpts []grpc.ServerOption
if config.Config.Prometheus.Enable {
promePkg.NewGrpcRequestCounter()
promePkg.NewGrpcRequestFailedCounter()
promePkg.NewGrpcRequestSuccessCounter()
prome.NewGrpcRequestCounter()
prome.NewGrpcRequestFailedCounter()
prome.NewGrpcRequestSuccessCounter()
grpcOpts = append(grpcOpts, []grpc.ServerOption{
// grpc.UnaryInterceptor(promePkg.UnaryServerInterceptorProme),
grpc.StreamInterceptor(grpcPrometheus.StreamServerInterceptor),
@ -73,7 +76,7 @@ func (s *userServer) Run() {
srv := grpc.NewServer(grpcOpts...)
defer srv.GracefulStop()
//Service registers with etcd
pbUser.RegisterUserServer(srv, s)
pbuser.RegisterUserServer(srv, s)
err = srv.Serve(listener)
if err != nil {
@ -88,12 +91,15 @@ func (s *userServer) SyncJoinedGroupMemberFaceURL(ctx context.Context, userID st
if err != nil {
return
}
for _, group := range members {
err := s.SetGroupMemberFaceURL(ctx, faceURL, group.GroupID, userID)
if err != nil {
return
}
chat.GroupMemberInfoSetNotification(operationID, opUserID, group.GroupID, userID)
groupIDs := make([]string, 0)
for _, v := range members {
groupIDs = append(groupIDs, v.GroupID)
}
if s.SetGroupMemberInfo(ctx, "", faceURL, "", 0, groupIDs, userID) != nil {
return
}
for _, v := range groupIDs {
chat.GroupMemberInfoSetNotification(operationID, opUserID, v, userID)
}
}
@ -103,24 +109,57 @@ func (s *userServer) SyncJoinedGroupMemberNickname(ctx context.Context, userID s
if err != nil {
return
}
groupIDs := make([]string, 0)
for _, v := range members {
if v.Nickname == oldNickname {
err := s.SetGroupMemberNickname(ctx, newNickname, v.GroupID, v.UserID)
if err != nil {
return
}
chat.GroupMemberInfoSetNotification(operationID, opUserID, v.GroupID, userID)
groupIDs = append(groupIDs, v.GroupID)
}
}
s.SetGroupMemberInfo(ctx, newNickname, "", "", 0, groupIDs, userID)
for _, v := range groupIDs {
chat.GroupMemberInfoSetNotification(operationID, opUserID, v, userID)
}
}
// 设置群昵称
func (s *userServer) SetGroupMemberNickname(ctx context.Context, nickname string, groupID string, userID string) (err error) {
return
}
//func (s *userServer) SetGroupMemberNickname(ctx context.Context, nickname string, groupID string, userID string) (err error) {
// conn, err := s.RegisterCenter.GetConn(config.Config.RpcRegisterName.OpenImGroupName)
// if err != nil {
// return err
// }
// client := group.NewGroupClient(conn)
// req := &pbgroup.SetGroupMemberNicknameReq{GroupID: groupID, Nickname: nickname, UserID: userID}
// _, err = client.SetGroupMemberNickname(ctx, req)
// return
//}
// 设置群头像
func (s *userServer) SetGroupMemberFaceURL(ctx context.Context, faceURL string, groupID string, userID string) (err error) {
func (s *userServer) SetGroupMemberInfo(ctx context.Context, nickname, faceURL, ex string, roleLevel int32, groupIDs []string, userID string) (err error) {
conn, err := s.RegisterCenter.GetConn(config.Config.RpcRegisterName.OpenImGroupName)
if err != nil {
return err
}
req := pbgroup.SetGroupMemberInfo{UserID: userID}
if nickname != "" {
req.Nickname = &wrappers.StringValue{Value: nickname}
}
if faceURL != "" {
req.FaceURL = &wrappers.StringValue{Value: faceURL}
}
if ex != "" {
req.Ex = &wrappers.StringValue{Value: ex}
}
if roleLevel != 0 {
req.RoleLevel = &wrappers.Int32Value{Value: roleLevel}
}
setGroupMemberInfoReq := &pbgroup.SetGroupMemberInfoReq{}
for _, v := range groupIDs {
req.GroupID = v
setGroupMemberInfoReq.Members = append(setGroupMemberInfoReq.Members, &req)
}
client := group.NewGroupClient(conn)
_, err = client.SetGroupMemberInfo(ctx, setGroupMemberInfoReq)
return
}
@ -130,8 +169,8 @@ func (s *userServer) GetJoinedGroupMembers(ctx context.Context, userID string) (
}
// ok
func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbUser.GetDesignateUsersReq) (resp *pbUser.GetDesignateUsersResp, err error) {
resp = &pbUser.GetDesignateUsersResp{}
func (s *userServer) GetDesignateUsers(ctx context.Context, req *pbuser.GetDesignateUsersReq) (resp *pbuser.GetDesignateUsersResp, err error) {
resp = &pbuser.GetDesignateUsersResp{}
users, err := s.FindWithError(ctx, req.UserIDs)
if err != nil {
return nil, err
@ -148,8 +187,8 @@ func (s *userServer) GetAllPageFriends(ctx context.Context, ownerUserID string)
}
// ok
func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserInfoReq) (resp *pbUser.UpdateUserInfoResp, err error) {
resp = &pbUser.UpdateUserInfoResp{}
func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbuser.UpdateUserInfoReq) (resp *pbuser.UpdateUserInfoResp, err error) {
resp = &pbuser.UpdateUserInfoResp{}
err = tokenverify.CheckAccessV3(ctx, req.UserInfo.UserID)
if err != nil {
return nil, err
@ -166,7 +205,7 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
if err != nil {
return nil, err
}
err = s.Update(ctx, []*relationTb.UserModel{user})
err = s.Update(ctx, []*tablerelation.UserModel{user})
if err != nil {
return nil, err
}
@ -191,8 +230,8 @@ func (s *userServer) UpdateUserInfo(ctx context.Context, req *pbUser.UpdateUserI
}
// ok
func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbUser.SetGlobalRecvMessageOptReq) (resp *pbUser.SetGlobalRecvMessageOptResp, err error) {
resp = &pbUser.SetGlobalRecvMessageOptResp{}
func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbuser.SetGlobalRecvMessageOptReq) (resp *pbuser.SetGlobalRecvMessageOptResp, err error) {
resp = &pbuser.SetGlobalRecvMessageOptResp{}
if _, err := s.FindWithError(ctx, []string{req.UserID}); err != nil {
return nil, err
}
@ -206,8 +245,8 @@ func (s *userServer) SetGlobalRecvMessageOpt(ctx context.Context, req *pbUser.Se
}
// ok
func (s *userServer) AccountCheck(ctx context.Context, req *pbUser.AccountCheckReq) (resp *pbUser.AccountCheckResp, err error) {
resp = &pbUser.AccountCheckResp{}
func (s *userServer) AccountCheck(ctx context.Context, req *pbuser.AccountCheckReq) (resp *pbuser.AccountCheckResp, err error) {
resp = &pbuser.AccountCheckResp{}
if utils.Duplicate(req.CheckUserIDs) {
return nil, constant.ErrArgs.Wrap("userID repeated")
}
@ -224,7 +263,7 @@ func (s *userServer) AccountCheck(ctx context.Context, req *pbUser.AccountCheckR
userIDs[v.UserID] = nil
}
for _, v := range req.CheckUserIDs {
temp := &pbUser.AccountCheckRespSingleUserStatus{UserID: v}
temp := &pbuser.AccountCheckRespSingleUserStatus{UserID: v}
if _, ok := userIDs[v]; ok {
temp.AccountStatus = constant.Registered
} else {
@ -236,8 +275,8 @@ func (s *userServer) AccountCheck(ctx context.Context, req *pbUser.AccountCheckR
}
// ok
func (s *userServer) GetPaginationUsers(ctx context.Context, req *pbUser.GetPaginationUsersReq) (resp *pbUser.GetPaginationUsersResp, err error) {
resp = &pbUser.GetPaginationUsersResp{}
func (s *userServer) GetPaginationUsers(ctx context.Context, req *pbuser.GetPaginationUsersReq) (resp *pbuser.GetPaginationUsersResp, err error) {
resp = &pbuser.GetPaginationUsersResp{}
usersDB, total, err := s.Page(ctx, req.Pagination.PageNumber, req.Pagination.ShowNumber)
if err != nil {
return nil, err
@ -248,8 +287,8 @@ func (s *userServer) GetPaginationUsers(ctx context.Context, req *pbUser.GetPagi
}
// ok
func (s *userServer) UserRegister(ctx context.Context, req *pbUser.UserRegisterReq) (resp *pbUser.UserRegisterResp, err error) {
resp = &pbUser.UserRegisterResp{}
func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterReq) (resp *pbuser.UserRegisterResp, err error) {
resp = &pbuser.UserRegisterResp{}
if utils.DuplicateAny(req.Users, func(e *sdkws.UserInfo) string { return e.UserID }) {
return nil, constant.ErrArgs.Wrap("userID repeated")
}

Loading…
Cancel
Save