60 lines
1.7 KiB
Go
60 lines
1.7 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"
|
|
FriendSubTypeAssistHeroList = "assistherolist"
|
|
FriendSubTypeRelation = "getrelation"
|
|
FriendSubTypeQiecuo = "qiecuo"
|
|
FriendSubTypeAccept = "accept"
|
|
FriendQiecuoPush = ""
|
|
)
|
|
|
|
type apiComp struct {
|
|
modules.MCompGate
|
|
module *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.module = module.(*Friend)
|
|
return
|
|
}
|
|
|
|
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
|
|
if user, err := this.module.ModuleUser.GetUser(userId); err == nil {
|
|
return &pb.FriendBase{
|
|
ServerId: user.Sid,
|
|
UserId: userId,
|
|
NickName: user.Name,
|
|
Level: user.Lv,
|
|
Skin: user.CurSkin,
|
|
OfflineTime: user.Offlinetime,
|
|
Gender: user.Gender,
|
|
}
|
|
}
|
|
|
|
return nil
|
|
}
|