This commit is contained in:
meixiongfeng 2022-12-16 16:39:15 +08:00
parent f1b4b58460
commit 7c08f2e1bc
5 changed files with 46 additions and 18 deletions

View File

@ -13,13 +13,7 @@ func (this *apiComp) ResonanceUseEnergyCheck(session comm.IUserSession, req *pb.
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
} }
// for _, v := range req.Energy {
// if v.UseEnergy < 0 || (v.UseType != comm.ResonanceAtkPro && v.UseType != comm.ResonanceHpPro && v.UseType != comm.ResonanceDefPro) {
// code = pb.ErrorCode_ReqParameterError
// return
// }
// }
return return
} }

View File

@ -216,6 +216,36 @@ func (this *Hero) GetSpecifiedHero(session comm.IUserSession, heroConfId string,
if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 || amount == 0 { if session.GetUserId() == "" || heroConfId == "" || star == 0 || lv == 0 || amount == 0 {
return pb.ErrorCode_ReqParameterError return pb.ErrorCode_ReqParameterError
} }
// 等级校验
conf := this.configure.GetHeroConfig(heroConfId)
if conf == nil {
code = pb.ErrorCode_ReqParameterError
return
}
cid := heroConfId
maxStar := conf.Star
starConf := this.configure.GetHeroStarupConfig(cid, conf.Star)
if starConf == nil {
code = pb.ErrorCode_ReqParameterError
return
}
// 获取最大星级
for i := 1; ; i++ {
starConf := this.configure.GetHeroStarupConfig(cid, conf.Star+int32(i))
if starConf == nil {
break
}
if starConf != nil && starConf.Gold == 0 {
maxStar = star + int32(i)
break
}
}
maxLv := this.configure.GetHeroStargrowConfigByStar(maxStar) // 最大等级
if star > maxStar || lv > maxLv {
code = pb.ErrorCode_ReqParameterError
return
}
hero, err := this.modelHero.createOneHero(session.GetUserId(), heroConfId) hero, err := this.modelHero.createOneHero(session.GetUserId(), heroConfId)
if err != nil { if err != nil {
return pb.ErrorCode_HeroCreate return pb.ErrorCode_HeroCreate
@ -502,7 +532,6 @@ func (this *Hero) ContinuousRestriction(uid string, heroCid string, drawCount in
} }
} }
} }
} }
} }
} }
@ -687,7 +716,5 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession) (code pb.ErrorCode) {
if len(changeHero) > 0 { if len(changeHero) > 0 {
session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeHero}) session.SendMsg("hero", "change", &pb.HeroChangePush{List: changeHero})
} }
return return
} }

View File

@ -15,10 +15,8 @@ func (this *apiComp) GetlistCheck(session comm.IUserSession, req *pb.PrivilegeGe
///获取特权列表 ///获取特权列表
func (this *apiComp) Getlist(session comm.IUserSession, req *pb.PrivilegeGetListReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) Getlist(session comm.IUserSession, req *pb.PrivilegeGetListReq) (code pb.ErrorCode, data proto.Message) {
list, err := this.module.modelPrivilege.getPrivilegeList(session.GetUserId()) list, _ := this.module.modelPrivilege.getPrivilegeList(session.GetUserId())
if err != nil {
this.module.Errorf("can't get privilege list :%v", err)
}
session.SendMsg(string(this.module.GetType()), PrivilegeGetListResp, &pb.PrivilegeGetListResp{Data: list}) session.SendMsg(string(this.module.GetType()), PrivilegeGetListResp, &pb.PrivilegeGetListResp{Data: list})
return return
} }

View File

@ -15,10 +15,8 @@ func (this *apiComp) VipListCheck(session comm.IUserSession, req *pb.PrivilegeVi
///获取特权列表 ///获取特权列表
func (this *apiComp) VipList(session comm.IUserSession, req *pb.PrivilegeVipListReq) (code pb.ErrorCode, data proto.Message) { func (this *apiComp) VipList(session comm.IUserSession, req *pb.PrivilegeVipListReq) (code pb.ErrorCode, data proto.Message) {
list, err := this.module.modelVip.getVipList(session.GetUserId()) list, _ := this.module.modelVip.getVipList(session.GetUserId())
if err != nil {
this.module.Errorf("can't get privilege list :%v", err)
}
session.SendMsg(string(this.module.GetType()), PrivilegeVipListResp, &pb.PrivilegeVipListResp{Data: list}) session.SendMsg(string(this.module.GetType()), PrivilegeVipListResp, &pb.PrivilegeVipListResp{Data: list})
return return
} }

View File

@ -337,7 +337,7 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3
Reward: map[int32]bool{}, Reward: map[int32]bool{},
Privilege: map[int32]*pb.PrivilegeList{}, Privilege: map[int32]*pb.PrivilegeList{},
CTime: configure.Now().Unix(), CTime: configure.Now().Unix(),
RewardTime: 0, RewardTime: configure.Now().Unix(),
} }
if err = this.modelVip.addVipData(session.GetUserId(), vip); err != nil { if err = this.modelVip.addVipData(session.GetUserId(), vip); err != nil {
this.Errorf("err:%v", err) this.Errorf("err:%v", err)
@ -360,12 +360,23 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3
} }
} }
} }
// 发放每日福利
var res []*pb.UserAssets
for _, v := range conf.Daygift {
res = append(res, &pb.UserAssets{
A: v.A,
T: v.T,
N: v.N,
})
}
this.mail.SendMailByCid(session, comm.VipDaily, res)
} }
} }
update["privilege"] = vip.Privilege update["privilege"] = vip.Privilege
this.modelVip.modifyVipData(session.GetUserId(), update) this.modelVip.modifyVipData(session.GetUserId(), update)
session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeVipListResp{Data: vip}) session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeVipListResp{Data: vip})
} }
// 发送特权每日奖励 // 发送特权每日奖励