Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
2db8e930cd
@ -218,6 +218,8 @@ type (
|
|||||||
|
|
||||||
// 体力转经验
|
// 体力转经验
|
||||||
PsConvertExp(ps int32) (res *cfg.Gameatn)
|
PsConvertExp(ps int32) (res *cfg.Gameatn)
|
||||||
|
|
||||||
|
CleanUserConsumeMoney(session IUserSession) (err error)
|
||||||
}
|
}
|
||||||
//武器模块
|
//武器模块
|
||||||
IEquipment interface {
|
IEquipment interface {
|
||||||
|
@ -48,7 +48,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.EntertainGetList
|
|||||||
if list.Etime > endSeasonTime {
|
if list.Etime > endSeasonTime {
|
||||||
list.Etime = endSeasonTime
|
list.Etime = endSeasonTime
|
||||||
update["etime"] = list.Etime
|
update["etime"] = list.Etime
|
||||||
this.module.ModuleUser.CleanUserMerchantmoney(session)
|
this.module.ModuleUser.CleanUserConsumeMoney(session)
|
||||||
curMonth := time.Now().Month() // 计算赛季
|
curMonth := time.Now().Month() // 计算赛季
|
||||||
curYear := time.Now().Year()
|
curYear := time.Now().Year()
|
||||||
preMonth := this.module.service.GetOpentime().Month()
|
preMonth := this.module.service.GetOpentime().Month()
|
||||||
@ -56,6 +56,13 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.EntertainGetList
|
|||||||
tmp := int(curYear-preYear)*12 + int(curMonth-preMonth)
|
tmp := int(curYear-preYear)*12 + int(curMonth-preMonth)
|
||||||
list.Rounds = int32(tmp)
|
list.Rounds = int32(tmp)
|
||||||
update["rounds"] = list.Rounds
|
update["rounds"] = list.Rounds
|
||||||
|
|
||||||
|
// 低于一定的分数数据不清了
|
||||||
|
score := this.module.configure.GetConsumeResetIntegral()
|
||||||
|
if list.Consumeexp > score {
|
||||||
|
list.Consumeexp = score
|
||||||
|
update["consumeexp"] = list.Consumeexp
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this.module.model.modifyEntertainmList(session.GetUserId(), update)
|
this.module.model.modifyEntertainmList(session.GetUserId(), update)
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ type configureComp struct {
|
|||||||
lock sync.RWMutex
|
lock sync.RWMutex
|
||||||
block map[int32]*cfg.GameBlockData
|
block map[int32]*cfg.GameBlockData
|
||||||
order map[int32][]*cfg.GamePassCheckData //战令
|
order map[int32][]*cfg.GamePassCheckData //战令
|
||||||
|
resetScore int32 // 重置积分
|
||||||
}
|
}
|
||||||
|
|
||||||
const moduleName = "entertainment"
|
const moduleName = "entertainment"
|
||||||
@ -48,6 +49,9 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
|
|||||||
})
|
})
|
||||||
configure.RegisterConfigure(game_block, cfg.NewGameBlock, this.LoadGameBlock)
|
configure.RegisterConfigure(game_block, cfg.NewGameBlock, this.LoadGameBlock)
|
||||||
configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.updatePassCheck)
|
configure.RegisterConfigure(game_passcheck, cfg.NewGamePassCheck, this.updatePassCheck)
|
||||||
|
configure.RegisterConfigure(game_consumeIntegral, cfg.NewGameConsumeIntegral, this.loadConsumeIntegral)
|
||||||
|
|
||||||
|
this.GetConsumeResetIntegral()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,3 +369,28 @@ func (this *configureComp) GetGameConsumeReward() (conf []*cfg.GameIntegralData,
|
|||||||
err = comm.NewNotFoundConfErr(moduleName, game_integral, nil)
|
err = comm.NewNotFoundConfErr(moduleName, game_integral, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func (this *configureComp) loadConsumeIntegral() {
|
||||||
|
var (
|
||||||
|
v interface{}
|
||||||
|
configure *cfg.GameConsumeIntegral
|
||||||
|
err error
|
||||||
|
ok bool
|
||||||
|
)
|
||||||
|
if v, err = this.GetConfigure(game_consumeIntegral); err != nil {
|
||||||
|
this.module.Errorln(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if configure, ok = v.(*cfg.GameConsumeIntegral); ok {
|
||||||
|
for _, v := range configure.GetDataList() {
|
||||||
|
if v.Type == 2 {
|
||||||
|
this.resetScore = v.Key
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *configureComp) GetConsumeResetIntegral() (score int32) {
|
||||||
|
return this.resetScore
|
||||||
|
}
|
||||||
|
@ -310,31 +310,23 @@ func (this *ModelUser) changelv(session comm.IUserSession, lv int32, exp int64,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModelUser) CleanUserMerchantmoney(session comm.IUserSession) (err error) {
|
func (this *ModelUser) CleanUserMerchantmoney(session comm.IUserSession) (err error) {
|
||||||
// 只处理跨服
|
|
||||||
if !db.IsCross() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var (
|
|
||||||
update map[string]interface{}
|
|
||||||
uid string
|
|
||||||
)
|
|
||||||
|
|
||||||
uid = session.GetUserId()
|
// 获取本服的数据
|
||||||
|
if m, e := this.module.GetDBModelByUid(session.GetUserId(), this.TableName); e == nil {
|
||||||
user := &pb.DBUser{}
|
user := &pb.DBUser{}
|
||||||
update = make(map[string]interface{}, 0)
|
if err := m.Get(session.GetUserId(), user); err == nil {
|
||||||
update["profit"] = 0
|
if user.Caravanlv == 0 {
|
||||||
update["merchantmoney"] = 0
|
|
||||||
if user.Caravanlv == 0 { // 默认1级
|
|
||||||
user.Caravanlv = 1
|
user.Caravanlv = 1
|
||||||
update["caravanlv"] = user.Caravanlv
|
|
||||||
}
|
}
|
||||||
|
err = m.Change(session.GetUserId(), map[string]interface{}{
|
||||||
if err := this.Get(uid, user); err == nil {
|
"profit": 0,
|
||||||
err = this.Change(uid, update)
|
"caravanlv": user.Caravanlv,
|
||||||
|
"merchantmoney": 0,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
this.module.Errorf("err:%v", err)
|
this.module.Errorf("err:%v", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -407,3 +399,12 @@ func (this *ModelUser) ResAutoReplies(session comm.IUserSession, resreplies map[
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func (this *ModelUser) CleanUserConsumeMoney(session comm.IUserSession) (err error) {
|
||||||
|
// 获取本服的数据
|
||||||
|
if m, e := this.module.GetDBModelByUid(session.GetUserId(), this.TableName); e == nil {
|
||||||
|
err = m.Change(session.GetUserId(), map[string]interface{}{
|
||||||
|
"consumemoney": 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
@ -1476,3 +1476,7 @@ func (this *User) PsConvertExp(ps int32) (res *cfg.Gameatn) {
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *User) CleanUserConsumeMoney(session comm.IUserSession) (err error) {
|
||||||
|
return this.modelUser.CleanUserConsumeMoney(session)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user