73 lines
1.5 KiB
Go
73 lines
1.5 KiB
Go
package passon
|
|
|
|
import (
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/modules"
|
|
"go_dreamfactory/pb"
|
|
|
|
"go_dreamfactory/lego/base"
|
|
"go_dreamfactory/lego/core"
|
|
"go_dreamfactory/lego/sys/log"
|
|
)
|
|
|
|
/*
|
|
模块名:PassOn
|
|
描述:传功系统
|
|
开发:李伟
|
|
*/
|
|
func NewModule() core.IModule {
|
|
m := new(Passon)
|
|
return m
|
|
}
|
|
|
|
type Passon struct {
|
|
modules.ModuleBase
|
|
api *apiComp
|
|
modelPasson *modelPasson
|
|
configure *Configure_Comp
|
|
service base.IRPCXService
|
|
}
|
|
|
|
func (this *Passon) GetType() core.M_Modules {
|
|
return comm.ModuleMail
|
|
}
|
|
|
|
func (this *Passon) OnInstallComp() {
|
|
this.ModuleBase.OnInstallComp()
|
|
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
|
|
this.modelPasson = this.RegisterComp(new(modelPasson)).(*modelPasson)
|
|
this.configure = this.RegisterComp(new(Configure_Comp)).(*Configure_Comp)
|
|
}
|
|
|
|
func (this *Passon) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
|
err = this.ModuleBase.Init(service, module, options)
|
|
this.service = service.(base.IRPCXService)
|
|
return
|
|
}
|
|
func (this *Passon) Start() (err error) {
|
|
err = this.ModuleBase.Start()
|
|
return
|
|
}
|
|
|
|
// 英雄升级
|
|
func (this *Passon) HeroUpLv(session comm.IUserSession, heroid string, lv int32) {
|
|
var (
|
|
passon *pb.DBPasson
|
|
err error
|
|
)
|
|
if passon, err = this.modelPasson.getUserPasson(session.GetUserId()); err != nil {
|
|
this.Error("getUserPasson err", log.Field{Key: "err", Value: err.Error()})
|
|
return
|
|
}
|
|
if lv <= passon.Passonlv {
|
|
return
|
|
}
|
|
|
|
for _, v := range passon.Teacher {
|
|
if v == heroid {
|
|
return
|
|
}
|
|
}
|
|
|
|
}
|