Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2022-07-26 17:08:08 +08:00
commit b640d088b8
3 changed files with 10 additions and 10 deletions

View File

@ -65,6 +65,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
code = pb.ErrorCode_HeroNoExist
return
}
if tmp.Type != comm.CardTypeSkill {
code = pb.ErrorCode_HeroTypeErr
return
}
costColor = tmp.Color
if costColor != tagColor {
code = pb.ErrorCode_HeroColorErr
@ -87,7 +91,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
// 获取权重
for k, v := range tmpUpSkillID {
for _, v2 := range config.GetDataList() {
if v2.Hid == _hero.HeroID && k == v2.Skillpos && v.SkillLv == v2.Skilllevel {
if v2.Hid == _hero.HeroID && (k+1) == v2.Skillpos && v.SkillLv == v2.Skilllevel {
probability[k] = v2.Probability // 设置权重
}
}
@ -105,7 +109,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt
for k, v := range probability {
tmpValue += v
if int32(n.Int64()) <= tmpValue { // 找到了
if int32(n.Int64()) < tmpValue { // 找到了
upSkillPos = k
break
}

View File

@ -514,12 +514,6 @@ func (this *ModelHero) AddCardExp(uid string, hero *pb.DBHero, exp int32) (newhe
// 玩家离线 清除缓存
func (this *ModelHero) RemoveUserHeroInfo(session comm.IUserSession) (err error) {
userList := this.moduleHero.GetHeroList(session.GetUserId())
for _, v := range userList {
if err := this.moduleHero.modelHero.ClearnHeroCache(session.GetUserId(), v.Id); err != nil {
this.moduleHero.Errorf("cleanData err:%v", err)
}
}
this.moduleHero.modelHero.BatchDelLists(session.GetUserId())
return
}

View File

@ -40,11 +40,13 @@ func (this *DB_Comp) Start() (err error) {
}
func (this *DB_Comp) run() {
timer := time.NewTicker(time.Second * 2)
defer timer.Stop()
for {
select {
case v := <-this.task:
this.Model_UpdateDBByLog(v)
case <-time.After(time.Second * 2):
case <-timer.C: //<-time.After(time.Second * 2):
this.Model_UpdateDBByLog("")
}
if !this.isInit && this.Model_TotalCount() <= 0 {