package friend import ( "go_dreamfactory/comm" "go_dreamfactory/modules" "go_dreamfactory/lego/core" "github.com/spf13/cast" ) func NewModule() core.IModule { m := new(Friend) return m } type Friend struct { modules.ModuleBase api *apiComp modelFriend *ModelFriend configure *modules.MCompConfigure } func (this *Friend) GetType() core.M_Modules { return comm.ModuleFriend } func (this *Friend) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { err = this.ModuleBase.Init(service, module, options) return } func (this *Friend) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelFriend = this.RegisterComp(new(ModelFriend)).(*ModelFriend) } //获取最大好友数 func (this *Friend) getFriendMax() int { if maxHy := this.configure.GetGlobalConf("friend_maxnum"); maxHy != "" { return cast.ToInt(maxHy) } return 0 } //获取最大黑名单数 func (this *Friend) getBlackMax() int { if maxHy := this.configure.GetGlobalConf("friend_black"); maxHy != "" { return cast.ToInt(maxHy) } return 0 }