golang-im聊天
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.

2 jaren geleden
2 jaren geleden
2 jaren geleden
1234567891011121314151617181920212223242526272829303132333435363738
  1. package model
  2. import (
  3. "gim/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. MasterId int64 // 站长id
  17. IsAutoAddedFriends int // 是否自动被添加好友
  18. }
  19. func (u *User) ToProto() *pb.User {
  20. if u == nil {
  21. return nil
  22. }
  23. return &pb.User{
  24. UserId: u.Id,
  25. Nickname: u.Nickname,
  26. Sex: u.Sex,
  27. AvatarUrl: u.AvatarUrl,
  28. Extra: u.Extra,
  29. CreateTime: u.CreateTime.Unix(),
  30. UpdateTime: u.UpdateTime.Unix(),
  31. MasterId: u.MasterId,
  32. IsAutoAddedFriends: int64(u.IsAutoAddedFriends),
  33. }
  34. }