Commit 363408c8 authored by hujiebin's avatar hujiebin

feat:调整升级逻辑

parent 623b6af8
...@@ -5,21 +5,20 @@ import "git.hilo.cn/hilo-common/resource/mysql" ...@@ -5,21 +5,20 @@ import "git.hilo.cn/hilo-common/resource/mysql"
type GroupPowerGrade int type GroupPowerGrade int
const ( const (
GroupPowerGrade0 GroupPowerGrade = 0 GroupPowerGrade0 GroupPowerGrade = 0 // 青铜
GroupPowerGrade1 GroupPowerGrade = 1 // 青铜 GroupPowerGrade1 GroupPowerGrade = 1 // 白银
GroupPowerGrade2 GroupPowerGrade = 2 // 白银 GroupPowerGrade2 GroupPowerGrade = 2 // 黄金
GroupPowerGrade3 GroupPowerGrade = 3 // 黄金 GroupPowerGrade3 GroupPowerGrade = 3 // 黑金
GroupPowerGrade4 GroupPowerGrade = 4 // 黑金
GroupPowerGradeMax = GroupPowerGrade4 GroupPowerGradeMax = GroupPowerGrade3
) )
var ( var (
GroupPowerGradeExp = map[GroupPowerGrade]mysql.Num{ GroupPowerGradeExp = map[GroupPowerGrade]mysql.Num{
GroupPowerGrade0: 0,
GroupPowerGrade1: 2500000, GroupPowerGrade1: 2500000,
GroupPowerGrade2: 15000000, GroupPowerGrade2: 15000000,
GroupPowerGrade3: 45000000, // todo GroupPowerGrade3: 60000000,
GroupPowerGrade4: 60000000,
} }
) )
......
...@@ -63,28 +63,27 @@ type CvGroupPowerGradeDetail struct { ...@@ -63,28 +63,27 @@ type CvGroupPowerGradeDetail struct {
} }
var CvResGradeList = []CvResGrade{ var CvResGradeList = []CvResGrade{
{groupPower_e.GroupPowerGrade1, "青铜icon", "青铜bigIcon"}, // todo {groupPower_e.GroupPowerGrade0, "青铜icon", "青铜bigIcon"}, // todo
{groupPower_e.GroupPowerGrade2, "白银icon", "白银bigIcon"}, // todo {groupPower_e.GroupPowerGrade1, "白银icon", "白银bigIcon"}, // todo
{groupPower_e.GroupPowerGrade3, "黄金icon", "黄金bigIcon"}, // todo {groupPower_e.GroupPowerGrade2, "黄金icon", "黄金bigIcon"}, // todo
{groupPower_e.GroupPowerGrade4, "黑金icon", "黑金bigIcon"}, // todo {groupPower_e.GroupPowerGrade3, "黑金icon", "黑金bigIcon"}, // todo
} }
var GroupPowerGradePrivilegeNum = map[groupPower_e.GroupPowerGrade][]CvPrivilege{ var GroupPowerGradePrivilegeNum = map[groupPower_e.GroupPowerGrade][]CvPrivilege{
groupPower_e.GroupPowerGrade0: {}, groupPower_e.GroupPowerGrade0: {
groupPower_e.GroupPowerGrade1: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 300}, {groupPower_e.GroupPowerPrivilegeMemberNum, 300},
{groupPower_e.GroupPowerPrivilegeMgrNum, 10}, {groupPower_e.GroupPowerPrivilegeMgrNum, 10},
{groupPower_e.GroupPowerPrivilegeNameplate, 1}, {groupPower_e.GroupPowerPrivilegeNameplate, 1},
{groupPower_e.GroupPowerPrivilegeMedal, 1}, {groupPower_e.GroupPowerPrivilegeMedal, 1},
}, },
groupPower_e.GroupPowerGrade2: { groupPower_e.GroupPowerGrade1: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 500}, {groupPower_e.GroupPowerPrivilegeMemberNum, 500},
{groupPower_e.GroupPowerPrivilegeMgrNum, 15}, {groupPower_e.GroupPowerPrivilegeMgrNum, 15},
{groupPower_e.GroupPowerPrivilegeNameplate, 1}, {groupPower_e.GroupPowerPrivilegeNameplate, 1},
{groupPower_e.GroupPowerPrivilegeMedal, 1}, {groupPower_e.GroupPowerPrivilegeMedal, 1},
{groupPower_e.GroupPowerPrivilegeNameplateEdit, 1}, {groupPower_e.GroupPowerPrivilegeNameplateEdit, 1},
}, },
groupPower_e.GroupPowerGrade3: { groupPower_e.GroupPowerGrade2: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 800}, {groupPower_e.GroupPowerPrivilegeMemberNum, 800},
{groupPower_e.GroupPowerPrivilegeMgrNum, 20}, {groupPower_e.GroupPowerPrivilegeMgrNum, 20},
{groupPower_e.GroupPowerPrivilegeNameplate, 1}, {groupPower_e.GroupPowerPrivilegeNameplate, 1},
...@@ -92,7 +91,7 @@ var GroupPowerGradePrivilegeNum = map[groupPower_e.GroupPowerGrade][]CvPrivilege ...@@ -92,7 +91,7 @@ var GroupPowerGradePrivilegeNum = map[groupPower_e.GroupPowerGrade][]CvPrivilege
{groupPower_e.GroupPowerPrivilegeNameplateEdit, 1}, {groupPower_e.GroupPowerPrivilegeNameplateEdit, 1},
{groupPower_e.GroupPowerPrivilegeNameplateHeadwear, 1}, {groupPower_e.GroupPowerPrivilegeNameplateHeadwear, 1},
}, },
groupPower_e.GroupPowerGrade4: { groupPower_e.GroupPowerGrade3: {
{groupPower_e.GroupPowerPrivilegeMemberNum, 1200}, {groupPower_e.GroupPowerPrivilegeMemberNum, 1200},
{groupPower_e.GroupPowerPrivilegeMgrNum, 25}, {groupPower_e.GroupPowerPrivilegeMgrNum, 25},
{groupPower_e.GroupPowerPrivilegeNameplate, 1}, {groupPower_e.GroupPowerPrivilegeNameplate, 1},
......
...@@ -112,8 +112,8 @@ func IncrGroupPowerExp(txModel *domain.Model, groupPowerId mysql.ID, exp mysql.N ...@@ -112,8 +112,8 @@ func IncrGroupPowerExp(txModel *domain.Model, groupPowerId mysql.ID, exp mysql.N
} }
// 达到经验值之后升级 // 达到经验值之后升级
for grade := groupPower_e.GroupPowerGradeMax; grade >= groupPower_e.GroupPowerGrade0; grade-- { for grade := groupPower_e.GroupPowerGradeMax; grade >= groupPower_e.GroupPowerGrade0; grade-- {
if latestGrade.Exp > mysql.Num(groupPower_e.GroupPowerGradeExp[grade]) { if latestGrade.Exp > groupPower_e.GroupPowerGradeExp[grade] {
if latestGrade.Grade < grade { // 积分清零后,等级保持一段时间 if latestGrade.Grade < grade { // 升级
expireAt := now.EndOfMonth() expireAt := now.EndOfMonth()
expireAt = utils.AddDate(expireAt, 0, 1) // 等级有效期到下个月月底 expireAt = utils.AddDate(expireAt, 0, 1) // 等级有效期到下个月月底
updateAttrs := map[string]interface{}{ updateAttrs := map[string]interface{}{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment