代码精简
This commit is contained in:
parent
ab88daadd0
commit
39fa612612
@ -669,16 +669,15 @@ const (
|
||||
Sign = "sign"
|
||||
)
|
||||
|
||||
// 特权类型
|
||||
const (
|
||||
PrivilegeType1 int32 = iota + 1 //每日获得
|
||||
PrivilegeType2 //金币商店每日免费刷新次数
|
||||
PrivilegeType3 //维京远征每日可购买挑战次数
|
||||
PrivilegeType4 //狩猎每日可购买挑战次数
|
||||
PrivilegeType5 //竞技场每日可购买挑战次数
|
||||
PrivilegeType6 //梦境每日可购买挑战次数
|
||||
PrivilegeType7 //巨怪商队背包容量
|
||||
PrivilegeType8 //美食馆每日最大制作时间
|
||||
PrivilegeType9 //武馆每日最大练功时间
|
||||
PrivilegeType10 //铁匠铺每日最大锻造时间
|
||||
PrivilegeType1 = iota + 1 //每日获得
|
||||
PrivilegeType2 //金币商店每日免费刷新次数
|
||||
PrivilegeType3 //维京远征每日可购买挑战次数
|
||||
PrivilegeType4 //狩猎每日可购买挑战次数
|
||||
PrivilegeType5 //竞技场每日可购买挑战次数
|
||||
PrivilegeType6 //梦境每日可购买挑战次数
|
||||
PrivilegeType7 //巨怪商队背包容量
|
||||
PrivilegeType8 //美食馆每日最大制作时间
|
||||
PrivilegeType9 //武馆每日最大练功时间
|
||||
PrivilegeType10 //铁匠铺每日最大锻造时间
|
||||
)
|
||||
|
@ -306,7 +306,8 @@ type (
|
||||
// 查询所有特权 key 对应comm.PrivilegeType1类型
|
||||
CheckAllPrivilege(session IUserSession) map[int32]*pb.PrivilegeList
|
||||
// 通过特权类型获取特权对应的增加数量
|
||||
GetCountByPrivilegeId(uid string, pId int32) (count int32)
|
||||
|
||||
GetCountByPrivilegeId(uid string, pType int32) (count int32)
|
||||
}
|
||||
//武馆
|
||||
IMartialhall interface {
|
||||
|
@ -410,13 +410,13 @@ func (this *Privilege) SendDailyPrivilegeMail(session comm.IUserSession, cId []i
|
||||
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 model, err := this.GetDBModuleByUid(uid, comm.TableVip, time.Hour); err == nil {
|
||||
vip := &pb.DBVip{}
|
||||
if err = model.Get(uid, vip); err == nil {
|
||||
if v, ok := vip.Privilege[pId]; ok {
|
||||
data := this.configure.GetPrivilegeByType(pId)
|
||||
if v, ok := vip.Privilege[pType]; ok {
|
||||
data := this.configure.GetPrivilegeByType(pType)
|
||||
for _, v1 := range v.PrivilegeID {
|
||||
if c, ok1 := data[v1]; ok1 {
|
||||
count += c
|
||||
@ -426,19 +426,16 @@ func (this *Privilege) GetCountByPrivilegeId(uid string, pId int32) (count int32
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vip, err := this.modelVip.getVipList(uid)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if v, ok := vip.Privilege[pId]; ok {
|
||||
data := this.configure.GetPrivilegeByType(pId)
|
||||
for _, v1 := range v.PrivilegeID {
|
||||
if c, ok1 := data[v1]; ok1 {
|
||||
count += c
|
||||
if vip, err := this.modelVip.getVipList(uid); err == nil {
|
||||
if v, ok := vip.Privilege[pType]; ok {
|
||||
data := this.configure.GetPrivilegeByType(pType)
|
||||
for _, v1 := range v.PrivilegeID {
|
||||
if c, ok1 := data[v1]; ok1 {
|
||||
count += c
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user