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

This commit is contained in:
meixiongfeng 2023-01-04 19:49:29 +08:00
commit 4d0a507cec
6 changed files with 33 additions and 36 deletions

View File

@ -669,16 +669,15 @@ const (
Sign = "sign" Sign = "sign"
) )
// 特权类型
const ( const (
PrivilegeType1 int32 = iota + 1 //每日获得 PrivilegeType1 = iota + 1 //每日获得
PrivilegeType2 //金币商店每日免费刷新次数 PrivilegeType2 //金币商店每日免费刷新次数
PrivilegeType3 //维京远征每日可购买挑战次数 PrivilegeType3 //维京远征每日可购买挑战次数
PrivilegeType4 //狩猎每日可购买挑战次数 PrivilegeType4 //狩猎每日可购买挑战次数
PrivilegeType5 //竞技场每日可购买挑战次数 PrivilegeType5 //竞技场每日可购买挑战次数
PrivilegeType6 //梦境每日可购买挑战次数 PrivilegeType6 //梦境每日可购买挑战次数
PrivilegeType7 //巨怪商队背包容量 PrivilegeType7 //巨怪商队背包容量
PrivilegeType8 //美食馆每日最大制作时间 PrivilegeType8 //美食馆每日最大制作时间
PrivilegeType9 //武馆每日最大练功时间 PrivilegeType9 //武馆每日最大练功时间
PrivilegeType10 //铁匠铺每日最大锻造时间 PrivilegeType10 //铁匠铺每日最大锻造时间
) )

View File

@ -310,7 +310,8 @@ type (
// 查询所有特权 key 对应comm.PrivilegeType1类型 // 查询所有特权 key 对应comm.PrivilegeType1类型
CheckAllPrivilege(session IUserSession) map[int32]*pb.PrivilegeList CheckAllPrivilege(session IUserSession) map[int32]*pb.PrivilegeList
// 通过特权类型获取特权对应的增加数量 // 通过特权类型获取特权对应的增加数量
GetCountByPrivilegeId(uid string, pId int32) (count int32)
GetCountByPrivilegeId(uid string, pType int32) (count int32)
} }
//武馆 //武馆
IMartialhall interface { IMartialhall interface {

View File

@ -250,10 +250,11 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
if int32(len(v)) > randomIndex { if int32(len(v)) > randomIndex {
if star == 5 { // 抽出5星英雄后A次抽奖内不会再抽到5星英雄普通卡池+阵营卡池) if star == 5 { // 抽出5星英雄后A次抽奖内不会再抽到5星英雄普通卡池+阵营卡池)
curDrawCount := drawCount - req.DrawCount curDrawCount := drawCount - req.DrawCount
if curDrawCount <= 10 { // 首次十连不计算 if drawCount <= 10 { // 前10次不计算连续抽卡最多连续出A个相同阵营的英雄
szCards = append(szCards, v[randomIndex].Id)
continue continue
} }
newID := this.module.ContinuousRestriction(session.GetUserId(), v[randomIndex].Id, curDrawCount+int32(index), strPool[index]) newID := this.module.ContinuousRestriction(session.GetUserId(), v[randomIndex].Id, curDrawCount+int32(index+1), strPool[index])
szCards = append(szCards, newID) szCards = append(szCards, newID)
continue continue
} }

View File

@ -53,10 +53,10 @@ func (this *apiComp) BuyGift(session comm.IUserSession, req *pb.PrivilegeBuyGift
return return
} }
vip.Reward[req.VipLv] = true vip.Reward[req.VipLv] = true
update := map[string]interface{}{
this.module.modelVip.modifyVipData(session.GetUserId(), map[string]interface{}{
"reward": vip.Reward, "reward": vip.Reward,
} })
this.module.modelVip.modifyVipData(session.GetUserId(), update)
// 推送 // 推送
session.SendMsg(string(this.module.GetType()), PrivilegeBuyGiftResp, &pb.PrivilegeBuyGiftResp{Data: vip}) session.SendMsg(string(this.module.GetType()), PrivilegeBuyGiftResp, &pb.PrivilegeBuyGiftResp{Data: vip})
return return

View File

@ -353,7 +353,7 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3
return return
} }
} }
update := map[string]interface{}{}
for i := oldVip + 1; i <= newVip; i++ { for i := oldVip + 1; i <= newVip; i++ {
conf := this.configure.GetVipConfigureData(i) conf := this.configure.GetVipConfigureData(i)
if conf != nil { if conf != nil {
@ -381,11 +381,12 @@ func (this *Privilege) AddVipData(session comm.IUserSession, oldVip, newVip int3
this.mail.SendMailByCid(session, comm.VipDaily, res) this.mail.SendMailByCid(session, comm.VipDaily, res)
} }
} }
update["privilege"] = vip.Privilege
this.modelVip.modifyVipData(session.GetUserId(), update) this.modelVip.modifyVipData(session.GetUserId(), map[string]interface{}{
"privilege": vip.Privilege,
})
session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeVipListResp{Data: vip}) session.SendMsg(string(this.GetType()), PrivilegeGetListResp, &pb.PrivilegeVipListResp{Data: vip})
} }
// 发送特权每日奖励 // 发送特权每日奖励
@ -410,13 +411,13 @@ func (this *Privilege) SendDailyPrivilegeMail(session comm.IUserSession, cId []i
this.mail.SendMailByCid(session, comm.VipDaily, res) this.mail.SendMailByCid(session, comm.VipDaily, res)
} }
} }
func (this *Privilege) GetCountByPrivilegeId(uid string, pId int32) (count int32) { func (this *Privilege) GetCountByPrivilegeId(uid string, pType int32) (count int32) {
if this.IsCross() { // 跨服情况 if this.IsCross() { // 跨服情况
if model, err := this.GetDBModuleByUid(uid, comm.TableVip, time.Hour); err == nil { if model, err := this.GetDBModuleByUid(uid, comm.TableVip, time.Hour); err == nil {
vip := &pb.DBVip{} vip := &pb.DBVip{}
if err = model.Get(uid, vip); err == nil { if err = model.Get(uid, vip); err == nil {
if v, ok := vip.Privilege[pId]; ok { if v, ok := vip.Privilege[pType]; ok {
data := this.configure.GetPrivilegeByType(pId) data := this.configure.GetPrivilegeByType(pType)
for _, v1 := range v.PrivilegeID { for _, v1 := range v.PrivilegeID {
if c, ok1 := data[v1]; ok1 { if c, ok1 := data[v1]; ok1 {
count += c count += c
@ -426,19 +427,16 @@ func (this *Privilege) GetCountByPrivilegeId(uid string, pId int32) (count int32
} }
} }
} else { } else {
vip, err := this.modelVip.getVipList(uid) if vip, err := this.modelVip.getVipList(uid); err == nil {
if err != nil { if v, ok := vip.Privilege[pType]; ok {
return data := this.configure.GetPrivilegeByType(pType)
} for _, v1 := range v.PrivilegeID {
if v, ok := vip.Privilege[pId]; ok { if c, ok1 := data[v1]; ok1 {
data := this.configure.GetPrivilegeByType(pId) count += c
for _, v1 := range v.PrivilegeID { }
if c, ok1 := data[v1]; ok1 {
count += c
} }
} }
} }
} }
return return
} }

View File

@ -40,7 +40,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
} }
if code = this.module.CheckRes(session, []*cfg.Gameatn{costRes}); code != pb.ErrorCode_Success { if code = this.module.CheckRes(session, []*cfg.Gameatn{costRes}); code != pb.ErrorCode_Success {
//
if req.AutoBuy { // 不够的时候看是否能自动购买 if req.AutoBuy { // 不够的时候看是否能自动购买
if code = this.module.AutoBuyTicket(session); code != pb.ErrorCode_Success { if code = this.module.AutoBuyTicket(session); code != pb.ErrorCode_Success {
return return
@ -49,7 +48,6 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.VikingChalleng
code = pb.ErrorCode_VikingMaxChallengeCount code = pb.ErrorCode_VikingMaxChallengeCount
return return
} }
//return
} }
cfgData := this.module.configure.GetVikingBossConfigData(req.BossId, req.Difficulty) cfgData := this.module.configure.GetVikingBossConfigData(req.BossId, req.Difficulty)