代码精简
This commit is contained in:
parent
ab88daadd0
commit
39fa612612
@ -669,9 +669,8 @@ const (
|
|||||||
Sign = "sign"
|
Sign = "sign"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 特权类型
|
|
||||||
const (
|
const (
|
||||||
PrivilegeType1 int32 = iota + 1 //每日获得
|
PrivilegeType1 = iota + 1 //每日获得
|
||||||
PrivilegeType2 //金币商店每日免费刷新次数
|
PrivilegeType2 //金币商店每日免费刷新次数
|
||||||
PrivilegeType3 //维京远征每日可购买挑战次数
|
PrivilegeType3 //维京远征每日可购买挑战次数
|
||||||
PrivilegeType4 //狩猎每日可购买挑战次数
|
PrivilegeType4 //狩猎每日可购买挑战次数
|
||||||
|
@ -306,7 +306,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 {
|
||||||
|
@ -410,13 +410,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,12 +426,9 @@ 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)
|
||||||
}
|
|
||||||
if v, ok := vip.Privilege[pId]; ok {
|
|
||||||
data := this.configure.GetPrivilegeByType(pId)
|
|
||||||
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
|
||||||
@ -439,6 +436,6 @@ func (this *Privilege) GetCountByPrivilegeId(uid string, pId int32) (count int32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user