|
|
@ -41,7 +41,7 @@ func (db *DBFriend) convert() (*sdk.FriendInfo, error) {
|
|
|
|
return pbFriend, nil
|
|
|
|
return pbFriend, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (pb *PBFriend) convert() (*imdb.Friend, error) {
|
|
|
|
func (pb *PBFriend) Convert() (*imdb.Friend, error) {
|
|
|
|
dbFriend := &imdb.Friend{}
|
|
|
|
dbFriend := &imdb.Friend{}
|
|
|
|
utils2.CopyStructFields(dbFriend, pb)
|
|
|
|
utils2.CopyStructFields(dbFriend, pb)
|
|
|
|
dbFriend.FriendUserID = pb.FriendUser.UserID
|
|
|
|
dbFriend.FriendUserID = pb.FriendUser.UserID
|
|
|
@ -57,14 +57,14 @@ type PBFriendRequest struct {
|
|
|
|
*sdk.FriendRequest
|
|
|
|
*sdk.FriendRequest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (pb *PBFriendRequest) convert() (*imdb.FriendRequest, error) {
|
|
|
|
func (pb *PBFriendRequest) Convert() (*imdb.FriendRequest, error) {
|
|
|
|
dbFriendRequest := &imdb.FriendRequest{}
|
|
|
|
dbFriendRequest := &imdb.FriendRequest{}
|
|
|
|
utils.CopyStructFields(dbFriendRequest, pb)
|
|
|
|
utils.CopyStructFields(dbFriendRequest, pb)
|
|
|
|
dbFriendRequest.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime))
|
|
|
|
dbFriendRequest.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime))
|
|
|
|
dbFriendRequest.HandleTime = utils.UnixSecondToTime(int64(pb.HandleTime))
|
|
|
|
dbFriendRequest.HandleTime = utils.UnixSecondToTime(int64(pb.HandleTime))
|
|
|
|
return dbFriendRequest, nil
|
|
|
|
return dbFriendRequest, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (db *DBFriendRequest) convert() (*sdk.FriendRequest, error) {
|
|
|
|
func (db *DBFriendRequest) Convert() (*sdk.FriendRequest, error) {
|
|
|
|
pbFriendRequest := &sdk.FriendRequest{}
|
|
|
|
pbFriendRequest := &sdk.FriendRequest{}
|
|
|
|
utils.CopyStructFields(pbFriendRequest, db)
|
|
|
|
utils.CopyStructFields(pbFriendRequest, db)
|
|
|
|
user, err := getUsersInfo([]string{db.FromUserID})
|
|
|
|
user, err := getUsersInfo([]string{db.FromUserID})
|
|
|
@ -94,13 +94,13 @@ type PBBlack struct {
|
|
|
|
*sdk.BlackInfo
|
|
|
|
*sdk.BlackInfo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (pb *PBBlack) convert() (*imdb.Black, error) {
|
|
|
|
func (pb *PBBlack) Convert() (*imdb.Black, error) {
|
|
|
|
dbBlack := &imdb.Black{}
|
|
|
|
dbBlack := &imdb.Black{}
|
|
|
|
dbBlack.BlockUserID = pb.BlackUserInfo.UserID
|
|
|
|
dbBlack.BlockUserID = pb.BlackUserInfo.UserID
|
|
|
|
dbBlack.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime))
|
|
|
|
dbBlack.CreateTime = utils.UnixSecondToTime(int64(pb.CreateTime))
|
|
|
|
return dbBlack, nil
|
|
|
|
return dbBlack, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (db *DBBlack) convert() (*sdk.BlackInfo, error) {
|
|
|
|
func (db *DBBlack) Convert() (*sdk.BlackInfo, error) {
|
|
|
|
pbBlack := &sdk.BlackInfo{}
|
|
|
|
pbBlack := &sdk.BlackInfo{}
|
|
|
|
utils.CopyStructFields(pbBlack, db)
|
|
|
|
utils.CopyStructFields(pbBlack, db)
|
|
|
|
pbBlack.CreateTime = uint32(db.CreateTime.Unix())
|
|
|
|
pbBlack.CreateTime = uint32(db.CreateTime.Unix())
|
|
|
@ -125,7 +125,7 @@ func (pb *PBGroup) Convert() (*imdb.Group, error) {
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
return dst, nil
|
|
|
|
return dst, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (db *DBGroup) convert() (*sdk.GroupInfo, error) {
|
|
|
|
func (db *DBGroup) Convert() (*sdk.GroupInfo, error) {
|
|
|
|
dst := &sdk.GroupInfo{}
|
|
|
|
dst := &sdk.GroupInfo{}
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
user, err := getGroupOwnerInfo(db.GroupID)
|
|
|
|
user, err := getGroupOwnerInfo(db.GroupID)
|
|
|
@ -155,14 +155,14 @@ type PBGroupMember struct {
|
|
|
|
*sdk.GroupMemberFullInfo
|
|
|
|
*sdk.GroupMemberFullInfo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (pb *PBGroupMember) convert() (*imdb.GroupMember, error) {
|
|
|
|
func (pb *PBGroupMember) Convert() (*imdb.GroupMember, error) {
|
|
|
|
dst := &imdb.GroupMember{}
|
|
|
|
dst := &imdb.GroupMember{}
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
dst.JoinTime = utils.UnixSecondToTime(int64(pb.JoinTime))
|
|
|
|
dst.JoinTime = utils.UnixSecondToTime(int64(pb.JoinTime))
|
|
|
|
dst.MuteEndTime = utils.UnixSecondToTime(int64(pb.MuteEndTime))
|
|
|
|
dst.MuteEndTime = utils.UnixSecondToTime(int64(pb.MuteEndTime))
|
|
|
|
return dst, nil
|
|
|
|
return dst, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (db *DBGroupMember) convert() (*sdk.GroupMemberFullInfo, error) {
|
|
|
|
func (db *DBGroupMember) Convert() (*sdk.GroupMemberFullInfo, error) {
|
|
|
|
dst := &sdk.GroupMemberFullInfo{}
|
|
|
|
dst := &sdk.GroupMemberFullInfo{}
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
|
|
|
|
|
|
|
@ -191,14 +191,14 @@ type PBGroupRequest struct {
|
|
|
|
*sdk.GroupRequest
|
|
|
|
*sdk.GroupRequest
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (pb *PBGroupRequest) convert() (*imdb.GroupRequest, error) {
|
|
|
|
func (pb *PBGroupRequest) Convert() (*imdb.GroupRequest, error) {
|
|
|
|
dst := &imdb.GroupRequest{}
|
|
|
|
dst := &imdb.GroupRequest{}
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
dst.ReqTime = utils.UnixSecondToTime(int64(pb.ReqTime))
|
|
|
|
dst.ReqTime = utils.UnixSecondToTime(int64(pb.ReqTime))
|
|
|
|
dst.HandledTime = utils.UnixSecondToTime(int64(pb.HandleTime))
|
|
|
|
dst.HandledTime = utils.UnixSecondToTime(int64(pb.HandleTime))
|
|
|
|
return dst, nil
|
|
|
|
return dst, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func (db *DBGroupRequest) convert() (*sdk.GroupRequest, error) {
|
|
|
|
func (db *DBGroupRequest) Convert() (*sdk.GroupRequest, error) {
|
|
|
|
dst := &sdk.GroupRequest{}
|
|
|
|
dst := &sdk.GroupRequest{}
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
dst.ReqTime = uint32(db.ReqTime.Unix())
|
|
|
|
dst.ReqTime = uint32(db.ReqTime.Unix())
|
|
|
@ -214,7 +214,7 @@ type PBUser struct {
|
|
|
|
*sdk.UserInfo
|
|
|
|
*sdk.UserInfo
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (pb *PBUser) convert() (*imdb.User, error) {
|
|
|
|
func (pb *PBUser) Convert() (*imdb.User, error) {
|
|
|
|
dst := &imdb.User{}
|
|
|
|
dst := &imdb.User{}
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
utils.CopyStructFields(dst, pb)
|
|
|
|
dst.Birth = utils.UnixSecondToTime(pb.Birthday)
|
|
|
|
dst.Birth = utils.UnixSecondToTime(pb.Birthday)
|
|
|
@ -222,7 +222,7 @@ func (pb *PBUser) convert() (*imdb.User, error) {
|
|
|
|
return dst, nil
|
|
|
|
return dst, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (db *DBUser) convert() (*sdk.UserInfo, error) {
|
|
|
|
func (db *DBUser) Convert() (*sdk.UserInfo, error) {
|
|
|
|
dst := &sdk.UserInfo{}
|
|
|
|
dst := &sdk.UserInfo{}
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
dst.CreateTime = uint32(db.CreateTime.Unix())
|
|
|
|
dst.CreateTime = uint32(db.CreateTime.Unix())
|
|
|
@ -230,7 +230,7 @@ func (db *DBUser) convert() (*sdk.UserInfo, error) {
|
|
|
|
return dst, nil
|
|
|
|
return dst, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (db *DBUser) convertPublic() (*sdk.PublicUserInfo, error) {
|
|
|
|
func (db *DBUser) ConvertPublic() (*sdk.PublicUserInfo, error) {
|
|
|
|
dst := &sdk.PublicUserInfo{}
|
|
|
|
dst := &sdk.PublicUserInfo{}
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
utils.CopyStructFields(dst, db)
|
|
|
|
return dst, nil
|
|
|
|
return dst, nil
|
|
|
|