This commit is contained in:
meixiongfeng 2022-08-05 16:49:45 +08:00
commit c70465f741
4 changed files with 65 additions and 1 deletions

View File

@ -42,7 +42,8 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemRe
}
sale = make([]*cfg.Game_atn, len(itemcf.Sale))
for i, v := range itemcf.Sale {
sale[i] = v
temp := *v
sale[i] = &temp
sale[i].N = v.N * int32(req.Amount)
}
if code = this.module.DispenseRes(session, sale, true); code != pb.ErrorCode_Success {

1
modules/redis/core.go Normal file
View File

@ -0,0 +1 @@
package redis

View File

@ -0,0 +1,23 @@
package redis
import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/core/cbase"
)
///过期数据管理组件
type ExpiredComp struct {
cbase.ModuleCompBase
}
//组件初始化接口
func (this *ExpiredComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
this.ModuleCompBase.Init(service, module, comp, opt)
return
}
//定时清理过期数据
func (this *ExpiredComp) run() {
}

39
modules/redis/module.go Normal file
View File

@ -0,0 +1,39 @@
package redis
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
/*
模块名:缓存管理
描述:处理缓存数据过期问题
开发:李伟
*/
func NewModule() core.IModule {
m := new(Redis)
return m
}
type Redis struct {
modules.ModuleBase
expiredComp *ExpiredComp
}
//模块名
func (this *Redis) GetType() core.M_Modules {
return comm.ModuleEquipment
}
//模块初始化接口 注册用户创建角色事件
func (this *Redis) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
//装备组件
func (this *Redis) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.expiredComp = this.RegisterComp(new(ExpiredComp)).(*ExpiredComp)
}