Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
c70465f741
@ -42,7 +42,8 @@ func (this *apiComp) SellItem(session comm.IUserSession, req *pb.ItemsSellItemRe
|
|||||||
}
|
}
|
||||||
sale = make([]*cfg.Game_atn, len(itemcf.Sale))
|
sale = make([]*cfg.Game_atn, len(itemcf.Sale))
|
||||||
for i, v := range itemcf.Sale {
|
for i, v := range itemcf.Sale {
|
||||||
sale[i] = v
|
temp := *v
|
||||||
|
sale[i] = &temp
|
||||||
sale[i].N = v.N * int32(req.Amount)
|
sale[i].N = v.N * int32(req.Amount)
|
||||||
}
|
}
|
||||||
if code = this.module.DispenseRes(session, sale, true); code != pb.ErrorCode_Success {
|
if code = this.module.DispenseRes(session, sale, true); code != pb.ErrorCode_Success {
|
||||||
|
1
modules/redis/core.go
Normal file
1
modules/redis/core.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package redis
|
23
modules/redis/expiredcomp.go
Normal file
23
modules/redis/expiredcomp.go
Normal 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
39
modules/redis/module.go
Normal 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)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user