del user field

test-errcode
wangchuxiao 2 years ago
parent 5017c61e28
commit 07309b872b

@ -187,11 +187,6 @@ func (s *userServer) UserRegister(ctx context.Context, req *pbuser.UserRegisterR
UserID: user.UserID, UserID: user.UserID,
Nickname: user.Nickname, Nickname: user.Nickname,
FaceURL: user.FaceURL, FaceURL: user.FaceURL,
Gender: user.Gender,
AreaCode: user.AreaCode,
PhoneNumber: user.PhoneNumber,
Birth: time.UnixMilli(user.Birth),
Email: user.Email,
Ex: user.Ex, Ex: user.Ex,
CreateTime: now, CreateTime: now,
AppMangerLevel: user.AppMangerLevel, AppMangerLevel: user.AppMangerLevel,

@ -168,11 +168,6 @@ const (
MinioDurationTimes = 3600 MinioDurationTimes = 3600
//Aws //Aws
AwsDurationTimes = 3600 AwsDurationTimes = 3600
// verificationCode used for
VerificationCodeForRegister = 1
VerificationCodeForReset = 2
VerificationCodeForRegisterSuffix = "_forRegister"
VerificationCodeForResetSuffix = "_forReset"
//callbackCommand //callbackCommand
CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsgCommand" CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsgCommand"

@ -17,7 +17,7 @@ var errIndex = errors.New("err index")
type metaCache interface { type metaCache interface {
ExecDel(ctx context.Context) error ExecDel(ctx context.Context) error
// delete key rapid // delete key rapid
DeleteKey(ctx context.Context, key string) error DelKey(ctx context.Context, key string) error
AddKeys(keys ...string) AddKeys(keys ...string)
GetPreDeleteKeys() []string GetPreDeleteKeys() []string
} }
@ -38,7 +38,7 @@ func (m *metaCacheRedis) ExecDel(ctx context.Context) error {
return nil return nil
} }
func (m *metaCacheRedis) DeleteKey(ctx context.Context, key string) error { func (m *metaCacheRedis) DelKey(ctx context.Context, key string) error {
return m.rcClient.TagAsDeleted2(ctx, key) return m.rcClient.TagAsDeleted2(ctx, key)
} }

@ -3,11 +3,12 @@ package log
import ( import (
"context" "context"
"fmt" "fmt"
"time"
"github.com/pkg/errors" "github.com/pkg/errors"
"gorm.io/gorm" "gorm.io/gorm"
gormLogger "gorm.io/gorm/logger" gormLogger "gorm.io/gorm/logger"
gormUtils "gorm.io/gorm/utils" gormUtils "gorm.io/gorm/utils"
"time"
) )
type SqlLogger struct { type SqlLogger struct {
@ -42,7 +43,7 @@ func (SqlLogger) Error(ctx context.Context, msg string, args ...interface{}) {
ZError(ctx, msg, nil, args) ZError(ctx, msg, nil, args)
} }
func (l SqlLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) { func (l *SqlLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) {
if l.LogLevel <= gormLogger.Silent { if l.LogLevel <= gormLogger.Silent {
return return
} }

File diff suppressed because it is too large Load Diff

@ -65,15 +65,10 @@ message UserInfo{
string userID = 1; string userID = 1;
string nickname = 2; string nickname = 2;
string faceURL = 3; string faceURL = 3;
int32 gender = 4; string ex = 4;
string areaCode = 5; int64 createTime = 5;
string phoneNumber = 6; int32 appMangerLevel = 6;
int64 birth = 7; int32 globalRecvMsgOpt = 7;
string email = 8;
string ex = 9;
int64 createTime = 10;
int32 appMangerLevel = 11;
int32 globalRecvMsgOpt = 12;
} }
message FriendInfo{ message FriendInfo{

@ -2,6 +2,8 @@ package check
import ( import (
"context" "context"
"strings"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/log" "github.com/OpenIMSDK/Open-IM-Server/pkg/common/log"
"github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry" "github.com/OpenIMSDK/Open-IM-Server/pkg/discoveryregistry"
@ -10,7 +12,6 @@ import (
"github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user" "github.com/OpenIMSDK/Open-IM-Server/pkg/proto/user"
"github.com/OpenIMSDK/Open-IM-Server/pkg/utils" "github.com/OpenIMSDK/Open-IM-Server/pkg/utils"
"google.golang.org/grpc" "google.golang.org/grpc"
"strings"
) )
func NewUserCheck(client discoveryregistry.SvcDiscoveryRegistry) *UserCheck { func NewUserCheck(client discoveryregistry.SvcDiscoveryRegistry) *UserCheck {
@ -78,7 +79,6 @@ func (u *UserCheck) GetPublicUserInfos(ctx context.Context, userIDs []string, co
UserID: e.UserID, UserID: e.UserID,
Nickname: e.Nickname, Nickname: e.Nickname,
FaceURL: e.FaceURL, FaceURL: e.FaceURL,
Gender: e.Gender,
Ex: e.Ex, Ex: e.Ex,
} }
}), nil }), nil

@ -129,11 +129,9 @@ func (db *DBFriendRequest) DB2PB(ctx context.Context, friendRequests []*relation
pbFriendRequest.FromUserID = users[v.FromUserID].UserID pbFriendRequest.FromUserID = users[v.FromUserID].UserID
pbFriendRequest.FromNickname = users[v.FromUserID].Nickname pbFriendRequest.FromNickname = users[v.FromUserID].Nickname
pbFriendRequest.FromFaceURL = users[v.FromUserID].FaceURL pbFriendRequest.FromFaceURL = users[v.FromUserID].FaceURL
pbFriendRequest.FromGender = users[v.FromUserID].Gender
pbFriendRequest.ToUserID = users[v.ToUserID].UserID pbFriendRequest.ToUserID = users[v.ToUserID].UserID
pbFriendRequest.ToNickname = users[v.ToUserID].Nickname pbFriendRequest.ToNickname = users[v.ToUserID].Nickname
pbFriendRequest.ToFaceURL = users[v.ToUserID].FaceURL pbFriendRequest.ToFaceURL = users[v.ToUserID].FaceURL
pbFriendRequest.ToGender = users[v.ToUserID].Gender
pbFriendRequest.CreateTime = v.CreateTime.Unix() pbFriendRequest.CreateTime = v.CreateTime.Unix()
pbFriendRequest.HandleTime = v.HandleTime.Unix() pbFriendRequest.HandleTime = v.HandleTime.Unix()
pbFriendRequest.HandlerUserID = v.HandlerUserID pbFriendRequest.HandlerUserID = v.HandlerUserID
@ -162,14 +160,12 @@ func (db *DBFriendRequest) Convert(ctx context.Context) (*sdk.FriendRequest, err
} }
pbFriendRequest.FromNickname = user.Nickname pbFriendRequest.FromNickname = user.Nickname
pbFriendRequest.FromFaceURL = user.FaceURL pbFriendRequest.FromFaceURL = user.FaceURL
pbFriendRequest.FromGender = user.Gender
user, err = db.userCheck.GetUserInfo(ctx, db.ToUserID) user, err = db.userCheck.GetUserInfo(ctx, db.ToUserID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
pbFriendRequest.ToNickname = user.Nickname pbFriendRequest.ToNickname = user.Nickname
pbFriendRequest.ToFaceURL = user.FaceURL pbFriendRequest.ToFaceURL = user.FaceURL
pbFriendRequest.ToGender = user.Gender
pbFriendRequest.CreateTime = db.CreateTime.Unix() pbFriendRequest.CreateTime = db.CreateTime.Unix()
pbFriendRequest.HandleTime = db.HandleTime.Unix() pbFriendRequest.HandleTime = db.HandleTime.Unix()
return pbFriendRequest, nil return pbFriendRequest, nil
@ -474,7 +470,6 @@ func (*DBUser) DB2PB(users []*relation.UserModel) (PBUsers []*sdk.UserInfo, err
func (pb *PBUser) Convert() (*relation.UserModel, error) { func (pb *PBUser) Convert() (*relation.UserModel, error) {
dst := &relation.UserModel{} dst := &relation.UserModel{}
utils.CopyStructFields(dst, pb) utils.CopyStructFields(dst, pb)
dst.Birth = utils.UnixSecondToTime(pb.Birth)
dst.CreateTime = utils.UnixSecondToTime(pb.CreateTime) dst.CreateTime = utils.UnixSecondToTime(pb.CreateTime)
return dst, nil return dst, nil
} }
@ -483,7 +478,6 @@ func (db *DBUser) Convert() (*sdk.UserInfo, error) {
dst := &sdk.UserInfo{} dst := &sdk.UserInfo{}
utils.CopyStructFields(dst, db) utils.CopyStructFields(dst, db)
dst.CreateTime = db.CreateTime.Unix() dst.CreateTime = db.CreateTime.Unix()
dst.Birth = db.Birth.Unix()
return dst, nil return dst, nil
} }

Loading…
Cancel
Save