|
|
@ -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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|