61 lines
1.3 KiB
Go
61 lines
1.3 KiB
Go
package reddot
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
)
|
|
|
|
/*
|
|
模块名:红点系统
|
|
描述:统一获取红点信息
|
|
开发:李伟
|
|
*/
|
|
func NewModule() core.IModule {
|
|
m := new(Reddot)
|
|
return m
|
|
}
|
|
|
|
type Reddot struct {
|
|
modules.ModuleBase
|
|
service base.IRPCXService
|
|
apicomp *apiComp
|
|
}
|
|
|
|
// 模块名
|
|
func (this *Reddot) GetType() core.M_Modules {
|
|
return comm.ModuleReddot
|
|
}
|
|
|
|
// 模块初始化接口 注册用户创建角色事件
|
|
func (this *Reddot) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
if err = this.ModuleBase.Init(service, module, options); err != nil {
|
|
return
|
|
}
|
|
this.service = service.(base.IRPCXService)
|
|
return
|
|
}
|
|
func (this *Reddot) Start() (err error) {
|
|
if err = this.ModuleBase.Start(); err != nil {
|
|
return
|
|
}
|
|
return
|
|
}
|
|
|
|
// 装备组件
|
|
func (this *Reddot) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.apicomp = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
}
|
|
|
|
// 推送红点
|
|
func (this *Reddot) PushReddot(session comm.IUserSession, reddot ...*pb.ReddotItem) (errdata *pb.ErrorData) {
|
|
if len(reddot) <= 0 {
|
|
return
|
|
}
|
|
session.SendMsg(string(this.GetType()), "change", &pb.ReddotChangePush{Rids: reddot})
|
|
return
|
|
}
|