58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package friend
|
|
|
|
import (
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
const (
|
|
FriendSubTypeList = "list"
|
|
FriendSubTypeApply = "apply"
|
|
FriendSubTypeApplyList = "applylist"
|
|
FriendSubTypeAddBlack = "addblack"
|
|
FriendSubTypeDelBlack = "delblack"
|
|
FriendSubTypeBlacklist = "blacklist"
|
|
FriendSubTypeAgree = "agree"
|
|
FriendSubTypeRefuse = "refuse"
|
|
FriendSubTypeSearch = "search"
|
|
FriendSubTypeZan = "zan"
|
|
FriendSubTypeZanreceive = "zanreceive"
|
|
FriendSubTypeZanList = "zanlist"
|
|
FriendSubTypeRandList = "randlist"
|
|
FriendSubTypeAssistHero = "assisthero"
|
|
FriendSubTypeDel = "del"
|
|
FriendSubTypeAssistlist = "assistlist"
|
|
FriendSubTypeGetreward = "getreward"
|
|
)
|
|
|
|
type apiComp struct {
|
|
modules.MCompGate
|
|
moduleFriend *Friend
|
|
}
|
|
|
|
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
|
_ = this.MCompGate.Init(service, module, comp, options)
|
|
this.moduleFriend = module.(*Friend)
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
|
|
if user, err := this.moduleFriend.ModuleUser.GetRmoteUser(userId); err != nil {
|
|
return nil
|
|
} else {
|
|
if user != nil {
|
|
return &pb.FriendBase{
|
|
ServerId: user.Sid,
|
|
UserId: userId,
|
|
NickName: user.Name,
|
|
Level: user.Lv,
|
|
Avatar: user.Avatar,
|
|
OfflineTime: user.Offlinetime,
|
|
}
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|