You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
937 B

  1. package model
  2. import (
  3. "egg-im/pkg/pb"
  4. "time"
  5. )
  6. // User 账户
  7. type User struct {
  8. Id int64 // 用户id
  9. PhoneNumber string // 手机号
  10. Nickname string // 昵称
  11. Sex int32 // 性别,1:男;2:女
  12. AvatarUrl string // 用户头像
  13. Extra string // 附加属性
  14. CreateTime time.Time // 创建时间
  15. UpdateTime time.Time // 更新时间
  16. IsAutoAddedFriends int // 是否自动被添加好友
  17. }
  18. func (u *User) ToProto() *pb.User {
  19. if u == nil {
  20. return nil
  21. }
  22. return &pb.User{
  23. UserId: u.Id,
  24. Nickname: u.Nickname,
  25. Sex: u.Sex,
  26. AvatarUrl: u.AvatarUrl,
  27. Extra: u.Extra,
  28. CreateTime: u.CreateTime.Unix(),
  29. UpdateTime: u.UpdateTime.Unix(),
  30. IsAutoAddedFriends: int64(u.IsAutoAddedFriends),
  31. PhoneNumber: u.PhoneNumber,
  32. }
  33. }