Documentation ¶
Index ¶
- Constants
- Variables
- func SendQRCodeInfo(uuid string, qrcode *common.QRCodeModel)
- type AddUserReq
- type BlacklistModel
- type Category
- type DB
- func (d *DB) AddOrRemoveBlacklistTx(uid string, touid string, blacklist int, version int64, tx *dbr.Tx) error
- func (d *DB) Blacklists(uid string) ([]*BlacklistModel, error)
- func (d *DB) Insert(m *Model) error
- func (d *DB) QueryByCategory(category string) ([]*Model, error)
- func (d *DB) QueryByKeyword(keyword string) (*Model, error)
- func (d *DB) QueryByPhone(zone string, phone string) (*Model, error)
- func (d *DB) QueryByPhones(phones []string) ([]*Model, error)
- func (d *DB) QueryByUID(uid string) (*Model, error)
- func (d *DB) QueryByUIDs(uids []string) ([]*Model, error)
- func (d *DB) QueryByUsername(username string) (*Model, error)
- func (d *DB) QueryByUsernameCxt(ctx context.Context, username string) (*Model, error)
- func (d *DB) QueryByVercode(vercode string) (*Model, error)
- func (d *DB) QueryDetailByUID(uid string, loginUID string) (*Detail, error)
- func (d *DB) QueryDetailByUIDs(uids []string, loginUID string) ([]*Detail, error)
- func (d *DB) QueryUIDsByUsernames(usernames []string) ([]string, error)
- func (d *DB) QueryUserWithOnlyShortNo(shortNo string) (*Model, error)
- func (d *DB) QueryWithAppID(appID string) ([]*Model, error)
- func (d *DB) UpdateUsersWithField(field string, value string, uid string) error
- type Detail
- type DetailModel
- type Friend
- type FriendApplyModel
- type FriendDetailModel
- type FriendModel
- type FriendReq
- type FriendResp
- type IOnlineService
- type IService
- type LoginLog
- type LoginLogDB
- type LoginLogModel
- type Manager
- type Model
- type OnLineUserResp
- type OnlineService
- type Resp
- type Service
- func (s *Service) AddFriend(uid string, friend *FriendReq) error
- func (s *Service) AddUser(user *AddUserReq) error
- func (s *Service) ExistBlacklist(uid string, toUID string) (bool, error)
- func (s *Service) GetAllUserCount() (int64, error)
- func (s *Service) GetAllUsers() ([]*Resp, error)
- func (s *Service) GetDeviceOnline(uid string, deviceFlag config.DeviceFlag) (*config.OnlinestatusResp, error)
- func (s *Service) GetFriends(uid string) ([]*FriendResp, error)
- func (s *Service) GetFriendsWithToUIDs(uid string, toUIDs []string) ([]*FriendResp, error)
- func (s *Service) GetOnetimePrekeyCount(uid string) (int, error)
- func (s *Service) GetOnlineCount() (int64, error)
- func (s *Service) GetRegisterCountWithDateSpace(startDate, endDate string) (map[string]int64, error)
- func (s *Service) GetRegisterWithDate(date string) (int64, error)
- func (s *Service) GetUser(uid string) (*Resp, error)
- func (s *Service) GetUserDetail(uid string, loginUID string) (*UserDetailResp, error)
- func (s *Service) GetUserDetails(uids []string, loginUID string) ([]*UserDetailResp, error)
- func (s *Service) GetUserOnlineStatus(uids []string) ([]*OnLineUserResp, error)
- func (s *Service) GetUserSettings(uids []string, loginUID string) ([]*SettingResp, error)
- func (s *Service) GetUserUIDWithUsernames(usernames []string) ([]string, error)
- func (s *Service) GetUserWithQRVercode(qrVercode string) (*Resp, error)
- func (s *Service) GetUserWithUsername(username string) (*Resp, error)
- func (s *Service) GetUsers(uids []string) ([]*Resp, error)
- func (s *Service) GetUsersWithAppID(appID string) ([]*Resp, error)
- func (s *Service) GetUsersWithCategories(categories []string) ([]*Resp, error)
- func (s *Service) GetUsersWithCategory(category Category) ([]*Resp, error)
- func (s *Service) IsFriend(uid string, toUID string) (bool, error)
- func (s *Service) SearchFriendsWithKeyword(uid string, keyword string) ([]*FriendResp, error)
- func (s *Service) UpdateLoginPassword(req UpdateLoginPasswordReq) error
- func (s *Service) UpdateUser(req UserUpdateReq) error
- func (s *Service) UpdateUserMsgExpireSecond(uid string, msgExpireSecond int64) error
- type Setting
- type SettingDB
- func (d *SettingDB) InsertUserSettingModel(setting *SettingModel) error
- func (d *SettingDB) InsertUserSettingModelTx(setting *SettingModel, tx *dbr.Tx) error
- func (d *SettingDB) QueryTwoUserSettingModel(uid, loginUID string) ([]*SettingModel, error)
- func (d *SettingDB) QueryUserSettingModel(uid, loginUID string) (*SettingModel, error)
- func (d *SettingDB) QueryUserSettings(uids []string, loginUID string) ([]*SettingModel, error)
- func (d *SettingDB) QueryWithUidsAndToUID(uids []string, toUID string) ([]*SettingModel, error)
- func (d *SettingDB) UpdateUserSettingModel(setting *SettingModel) error
- type SettingModel
- type SettingResp
- type Status
- type UpdateLoginPasswordReq
- type User
- func (u *User) GetFriendByVercode(vercode string) (*source.FriendModel, error)
- func (u *User) GetFriendByVercodes(vercodes []string) ([]*source.FriendModel, error)
- func (u *User) GetUserByMailListVercode(vercode string) (*source.UserModel, error)
- func (u *User) GetUserByQRVercode(qrvercode string) (*source.UserModel, error)
- func (u *User) GetUserByUID(uid string) (*source.UserModel, error)
- func (u *User) GetUserByVercode(vercode string) (*source.UserModel, error)
- func (u *User) Route(r *wkhttp.WKHttp)
- func (u *User) UserAvatar(c *wkhttp.Context)
- type UserDetailResp
- type UserUpdateReq
Constants ¶
const ( // Web3VerifyLogin 校验登录 Web3VerifyLogin string = "login" // Web3VerifyPassword 校验密码 Web3VerifyPassword string = "password" )
const ( // CategoryCustomerService 客服 CategoryCustomerService = "customerService" // CategorySystem 系统账号 CategorySystem = "system" )
const ( // CacheKeyFriends 好友key CacheKeyFriends string = "lm-friends:" )
const (
ChannelServiceName = "channel"
)
const (
ThirdAuthcodePrefix = "thirdlogin:authcode:"
)
const (
UserRedDotCategoryFriendApply = "friendApply"
)
Variables ¶
var (
ErrUserNeedVerification = errors.New("user need verification") // 用户需要验证
)
var ErrorUserNotExist = errors.New("用户不存在!")
var Names = []string{}/* 182 elements not displayed */
Names 注册用户随机名字
Functions ¶
func SendQRCodeInfo ¶
func SendQRCodeInfo(uuid string, qrcode *common.QRCodeModel)
SendQRCodeInfo 发送二维码数据
Types ¶
type AddUserReq ¶
type AddUserReq struct { Name string UID string // 如果无值,则随机生成 Username string Zone string Phone string Email string Password string }
AddUserReq AddUserReq
type BlacklistModel ¶
type BlacklistModel struct { UID string // 用户唯一id Name string // 用户名称 Username string // 用户名 db.BaseModel }
BlacklistModel 黑名单用户
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB 用户db操作
func (*DB) AddOrRemoveBlacklistTx ¶
func (d *DB) AddOrRemoveBlacklistTx(uid string, touid string, blacklist int, version int64, tx *dbr.Tx) error
AddOrRemoveBlacklist 添加黑名单
func (*DB) Blacklists ¶
func (d *DB) Blacklists(uid string) ([]*BlacklistModel, error)
Blacklists 黑名单列表
func (*DB) QueryByCategory ¶
QueryByCategory 根据用户分类查询用户列表
func (*DB) QueryByKeyword ¶
QueryByKeyword 通过用户名查询用户信息
func (*DB) QueryByPhone ¶
QueryByPhone 通过手机号和区号查询用户信息
func (*DB) QueryByUID ¶
QueryByUID 通过用户uid查询用户信息
func (*DB) QueryByUIDs ¶
QueryByUIDs 根据用户uid查询用户信息
func (*DB) QueryByUsername ¶
QueryByUsername 通过用户名查询用户信息
func (*DB) QueryByUsernameCxt ¶
QueryByUsernameCxt 通过用户名查询用户信息
func (*DB) QueryByVercode ¶
QueryByVercode 通过用户vercode查询用户信息
func (*DB) QueryDetailByUID ¶
QueryDetailByUID 查询用户详情
func (*DB) QueryDetailByUIDs ¶
QueryDetailByUIDs 查询用户详情集合
func (*DB) QueryUIDsByUsernames ¶
QueryUIDsByUsernames 通过用户名查询用户uids
func (*DB) QueryUserWithOnlyShortNo ¶
QueryUserWithOnlyShortNo 通过short_no获取用户信息
func (*DB) QueryWithAppID ¶
QueryWithAppID 根据appID查询用户列表
type Detail ¶
type Detail struct { Model Mute int // 免打扰 Top int // 置顶 ChatPwdOn int //是否开启聊天密码 Screenshot int //截屏通知 RevokeRemind int //撤回提醒 Receipt int //消息回执 db.BaseModel }
Detail 详情
type DetailModel ¶
type DetailModel struct { Remark string //好友备注 ToUID string // 好友uid ToName string // 好友名字 ToCategory string // 用户分类 Mute int // 免打扰 Top int // 置顶 Version int64 // 版本 Vercode string // 验证码 加好友需要 IsDeleted int // 是否删除 IsAlone int // 是否为单项好友 ShortNo string //短编号 ChatPwdOn int // 是否开启聊天密码 Blacklist int //是否在黑名单 Receipt int //消息是否回执 Robot int // 机器人0.否1.是 db.BaseModel }
DetailModel 好友详情
type FriendApplyModel ¶
type FriendApplyModel struct { UID string ToUID string Remark string Token string Status int // 状态 0.未处理 1.通过 2.拒绝 db.BaseModel }
FriendApplyModel 好友申请记录
type FriendDetailModel ¶
type FriendDetailModel struct { FriendModel Name string // 用户名称 ToName string //对方用户名称 }
FriendDetailModel 好友资料
type FriendModel ¶
type FriendModel struct { UID string ToUID string Flag int Version int64 IsDeleted int IsAlone int // 是否为单项好友 Vercode string SourceVercode string //来源验证码 Initiator int //1:发起方 db.BaseModel }
FriendModel 好友对象
type FriendResp ¶
FriendResp 用户好友
type IOnlineService ¶
type IService ¶
type IService interface { //获取用户 GetUser(uid string) (*Resp, error) // 获取用户详情(包括与loginUID的关系等等) GetUserDetail(uid string, loginUID string) (*UserDetailResp, error) // 批量获取用户详情 GetUserDetails(uids []string, loginUID string) ([]*UserDetailResp, error) // 通过用户名获取用户 GetUserWithUsername(username string) (*Resp, error) // 通过用户名获取用户uid集合 GetUserUIDWithUsernames(usernames []string) ([]string, error) // 批量获取用户信息 GetUsers(uids []string) ([]*Resp, error) // 通过APPID获取用户 GetUsersWithAppID(appID string) ([]*Resp, error) // 获取用户集合 GetUsersWithCategory(category Category) ([]*Resp, error) // 获取指定类别的用户列表 GetUsersWithCategories(categories []string) ([]*Resp, error) //查询某个人好友 GetFriendsWithToUIDs(uid string, toUIDs []string) ([]*FriendResp, error) //查询某个用户的所有好友 GetFriends(uid string) ([]*FriendResp, error) //添加一个好友 AddFriend(uid string, friend *FriendReq) error //添加一个用户 AddUser(user *AddUserReq) error // 通过qrvercode获取用户信息 GetUserWithQRVercode(qrVercode string) (*Resp, error) // 获取总用户数量 GetAllUserCount() (int64, error) // 查询某天注册用户数 GetRegisterWithDate(date string) (int64, error) // 获取某个时间区间的注册数量 GetRegisterCountWithDateSpace(startDate, endDate string) (map[string]int64, error) // IsFriend 查询两个用户是否为好友关系 IsFriend(uid string, toUID string) (bool, error) // 获取在线用户 GetUserOnlineStatus([]string) ([]*OnLineUserResp, error) // 更新用户信息 UpdateUser(req UserUpdateReq) error // 获取所有用户 GetAllUsers() ([]*Resp, error) // 更新登录密码 UpdateLoginPassword(req UpdateLoginPasswordReq) error // GetUserSettings 获取用户的配置 GetUserSettings(uids []string, loginUID string) ([]*SettingResp, error) // GetOnetimePrekeyCount 获取用户一次性signal key的数量(决定是否可以开启加密通讯) GetOnetimePrekeyCount(uid string) (int, error) // 获取设备在线状态 GetDeviceOnline(uid string, deviceFlag config.DeviceFlag) (*config.OnlinestatusResp, error) // 查询在线用户总数量 GetOnlineCount() (int64, error) // 存在黑明单 ExistBlacklist(uid string, toUID string) (bool, error) // 更新用户消息过期时长 UpdateUserMsgExpireSecond(uid string, msgExpireSecond int64) error // 搜索好友 SearchFriendsWithKeyword(uid string, keyword string) ([]*FriendResp, error) }
IService 用户服务接口
type LoginLogDB ¶
type LoginLogDB struct {
// contains filtered or unexported fields
}
LoginLogDB 登录日志DB
type LoginLogModel ¶
LoginLogModel 登录日志
type Model ¶
type Model struct { AppID string //app id UID string // 用户唯一id Name string // 用户名称 Username string // 用户名 Email string // email地址 Password string // 用户密码 Category string //用户分类 Sex int //性别 ShortNo string //唯一短编号 ShortStatus int //唯一短编号是否修改0.否1.是 Zone string //区号 Phone string //手机号 ChatPwd string //聊天密码 LockScreenPwd string // 锁屏密码 LockAfterMinute int // 在几分钟后锁屏 0表示立即 DeviceLock int //是否开启设备锁 SearchByPhone int //是否可以通过手机号搜索0.否1.是 SearchByShort int //是否可以通过短编号搜索0.否1.是 NewMsgNotice int //新消息通知0.否1.是 MsgShowDetail int //显示消息通知详情0.否1.是 VoiceOn int //声音0.否1.是 ShockOn int //震动0.否1.是 OfflineProtection int // 离线保护 Version int64 Status int // 状态 0.禁用 1.启用 Vercode string //验证码 QRVercode string // 二维码验证码 IsUploadAvatar int // 是否上传过头像0:未上传1:已上传 Role string // 角色 admin/superAdmin Robot int // 机器人0.否1.是 MuteOfApp int // app是否禁音(当pc登录的时候app可以设置禁音,当pc登录后有效) IsDestroy int // 是否已注销0.否1.是 WXOpenid string // 微信openid WXUnionid string // 微信unionid GiteeUID string // gitee uid GithubUID string // github uid Web3PublicKey string // web3公钥 MsgExpireSecond int64 // 消息过期时长 db.BaseModel }
Model 用户db model
type OnLineUserResp ¶
type OnlineService ¶
func NewOnlineService ¶
func NewOnlineService(ctx *config.Context) *OnlineService
func (*OnlineService) DeviceOnline ¶
func (o *OnlineService) DeviceOnline(uid string, device config.DeviceFlag) (bool, error)
func (*OnlineService) GetOnlineCount ¶
func (o *OnlineService) GetOnlineCount() (int64, error)
func (*OnlineService) GetUserLastOnlineStatus ¶
func (o *OnlineService) GetUserLastOnlineStatus(uids []string) ([]*config.OnlinestatusResp, error)
type Resp ¶
type Resp struct { UID string Name string Zone string Phone string Email string Status int // 用户状态 1 正常 2:黑名单 0 禁用 Password string IsUploadAvatar int NewMsgNotice int MsgShowDetail int //显示消息通知详情0.否1.是 MsgExpireSecond int64 CreatedAt int64 // 注册时间 10位时间戳 IsDestroy int // 是否注销 }
Resp 用户返回
type Service ¶
Service Service
func (*Service) ExistBlacklist ¶
func (*Service) GetAllUserCount ¶
GetAllUserCount 获取总用户数量
func (*Service) GetDeviceOnline ¶
func (s *Service) GetDeviceOnline(uid string, deviceFlag config.DeviceFlag) (*config.OnlinestatusResp, error)
func (*Service) GetFriends ¶
func (s *Service) GetFriends(uid string) ([]*FriendResp, error)
GetFriends 查询某个用户的所有好友
func (*Service) GetFriendsWithToUIDs ¶
func (s *Service) GetFriendsWithToUIDs(uid string, toUIDs []string) ([]*FriendResp, error)
GetFriendsWithToUIDs 查询一批好友
func (*Service) GetOnetimePrekeyCount ¶
func (*Service) GetRegisterCountWithDateSpace ¶
func (s *Service) GetRegisterCountWithDateSpace(startDate, endDate string) (map[string]int64, error)
GetRegisterCountWithDateSpace 获取某个时间区间的注册数量
func (*Service) GetRegisterWithDate ¶
GetRegisterWithDate 查询某天的注册量
func (*Service) GetUserDetail ¶
func (s *Service) GetUserDetail(uid string, loginUID string) (*UserDetailResp, error)
func (*Service) GetUserDetails ¶
func (s *Service) GetUserDetails(uids []string, loginUID string) ([]*UserDetailResp, error)
func (*Service) GetUserOnlineStatus ¶
func (s *Service) GetUserOnlineStatus(uids []string) ([]*OnLineUserResp, error)
GetUserOnlineStatus 查询在线用户
func (*Service) GetUserSettings ¶
func (s *Service) GetUserSettings(uids []string, loginUID string) ([]*SettingResp, error)
func (*Service) GetUserUIDWithUsernames ¶
GetUserUIDWithUsernames 获取用户uid集合
func (*Service) GetUserWithQRVercode ¶
GetUserWithQRVercode 通过qrvercode获取用户信息
func (*Service) GetUserWithUsername ¶
GetUserWithUsername 获取用户
func (*Service) GetUsersWithAppID ¶
GetUsersWithAppID 通过appID获取用户集合
func (*Service) GetUsersWithCategories ¶
GetUsersWithCategories 获取指定类别的用户列表
func (*Service) GetUsersWithCategory ¶
GetUsersWithCategory 获取用户列表
func (*Service) SearchFriendsWithKeyword ¶
func (s *Service) SearchFriendsWithKeyword(uid string, keyword string) ([]*FriendResp, error)
搜索好友
func (*Service) UpdateLoginPassword ¶
func (s *Service) UpdateLoginPassword(req UpdateLoginPasswordReq) error
func (*Service) UpdateUser ¶
func (s *Service) UpdateUser(req UserUpdateReq) error
type SettingDB ¶
type SettingDB struct {
// contains filtered or unexported fields
}
SettingDB 设置db
func (*SettingDB) InsertUserSettingModel ¶
func (d *SettingDB) InsertUserSettingModel(setting *SettingModel) error
InsertUserSettingModel 插入用户设置
func (*SettingDB) InsertUserSettingModelTx ¶
func (d *SettingDB) InsertUserSettingModelTx(setting *SettingModel, tx *dbr.Tx) error
InsertUserSettingModelTx 插入用户设置
func (*SettingDB) QueryTwoUserSettingModel ¶
func (d *SettingDB) QueryTwoUserSettingModel(uid, loginUID string) ([]*SettingModel, error)
QueryTwoUserSettingModel 查询双方用户设置
func (*SettingDB) QueryUserSettingModel ¶
func (d *SettingDB) QueryUserSettingModel(uid, loginUID string) (*SettingModel, error)
QueryUserSettingModel 查询用户设置
func (*SettingDB) QueryUserSettings ¶
func (d *SettingDB) QueryUserSettings(uids []string, loginUID string) ([]*SettingModel, error)
func (*SettingDB) QueryWithUidsAndToUID ¶
func (d *SettingDB) QueryWithUidsAndToUID(uids []string, toUID string) ([]*SettingModel, error)
func (*SettingDB) UpdateUserSettingModel ¶
func (d *SettingDB) UpdateUserSettingModel(setting *SettingModel) error
UpdateUserSettingModel 更新用户设置
type SettingModel ¶
type SettingModel struct { UID string // 用户UID ToUID string // 对方uid Mute int // 免打扰 Top int // 置顶 ChatPwdOn int // 是否开启聊天密码 Screenshot int //截屏通知 RevokeRemind int //撤回提醒 Blacklist int //黑名单 Receipt int //消息是否回执 Flame int // 是否开启阅后即焚 FlameSecond int // 阅后即焚秒数 Version int64 // 版本 Remark string // 备注 db.BaseModel }
SettingModel 用户设置
type SettingResp ¶
type UpdateLoginPasswordReq ¶
type User ¶
User 用户相关API
func (*User) GetFriendByVercode ¶
func (u *User) GetFriendByVercode(vercode string) (*source.FriendModel, error)
GetFriendByVercode 通过vercode获取好友信息
func (*User) GetFriendByVercodes ¶
func (u *User) GetFriendByVercodes(vercodes []string) ([]*source.FriendModel, error)
func (*User) GetUserByMailListVercode ¶
通过通讯录验证码获取用户信息
func (*User) GetUserByQRVercode ¶
GetUserByQRVercode 通过二维码验证码获取用户信息
func (*User) GetUserByUID ¶
GetUserByUID 通过UID获取用户信息
func (*User) GetUserByVercode ¶
GetUserByVercode 通过vercode获取用户信息
type UserDetailResp ¶
type UserDetailResp struct { UID string `json:"uid"` Name string `json:"name"` Username string `json:"username"` Email string `json:"email,omitempty"` // email(仅自己能看) Zone string `json:"zone,omitempty"` // 手机区号(仅自己能看) Phone string `json:"phone,omitempty"` // 手机号(仅自己能看) Mute int `json:"mute"` // 免打扰 Top int `json:"top"` // 置顶 Sex int `json:"sex"` //性别1:男 Category string `json:"category"` //用户分类 '客服' ShortNo string `json:"short_no"` // 用户唯一短编号 ChatPwdOn int `json:"chat_pwd_on"` //是否开启聊天密码 Screenshot int `json:"screenshot"` //截屏通知 RevokeRemind int `json:"revoke_remind"` //撤回提醒 Receipt int `json:"receipt"` //消息是否回执 Online int `json:"online"` //是否在线 LastOffline int `json:"last_offline"` //最后一次离线时间 DeviceFlag config.DeviceFlag `json:"device_flag"` // 在线设备标记 Follow int `json:"follow"` //是否是好友 BeDeleted int `json:"be_deleted"` // 被删除 BeBlacklist int `json:"be_blacklist"` // 被拉黑 Code string `json:"code"` //加好友所需vercode TODO: code不再使用 请使用Vercode Vercode string `json:"vercode"` // SourceDesc string `json:"source_desc"` // 好友来源 Remark string `json:"remark"` //好友备注 IsUploadAvatar int `json:"is_upload_avatar"` // 是否上传头像 Status int `json:"status"` //用户状态 1 正常 2:黑名单 Robot int `json:"robot"` // 机器人0.否1.是 IsDestroy int `json:"is_destroy"` // 是否注销0.否1.是 Flame int `json:"flame"` // 是否开启阅后即焚 FlameSecond int `json:"flame_second"` // 阅后即焚秒数 }
func NewUserDetailResp ¶
func NewUserDetailResp(m *Detail, remark, loginUID string, sourceFrom string, onLine int, lastOffline int, deviceFlag config.DeviceFlag, follow int, status int, beDeleted int, beBlacklist int, setting *SettingModel, vercode string) *UserDetailResp
type UserUpdateReq ¶
Source Files ¶
- 1module.go
- api.go
- api_device.go
- api_friend.go
- api_gitee.go
- api_github.go
- api_login_log.go
- api_maillist.go
- api_manager.go
- api_online.go
- api_setting.go
- api_usernamelogin.go
- const.go
- db.go
- db_device.go
- db_device_flag.go
- db_friend.go
- db_gitee.go
- db_github.go
- db_identities.go
- db_login_log.go
- db_maillist.go
- db_manager.go
- db_onetime_prekeys.go
- db_online.go
- db_setting.go
- event_friend.go
- service.go
- service_online.go
- source.go
- webhook.go