修改:付费升级代理等级页面
This commit is contained in:
@@ -134,11 +134,15 @@ type (
|
|||||||
LevelName string `json:"level_name"` // 等级名称
|
LevelName string `json:"level_name"` // 等级名称
|
||||||
LevelBonus float64 `json:"level_bonus"` // 等级加成(元)
|
LevelBonus float64 `json:"level_bonus"` // 等级加成(元)
|
||||||
PriceReduction float64 `json:"price_reduction"` // 底价降低(元,相对于当前等级)
|
PriceReduction float64 `json:"price_reduction"` // 底价降低(元,相对于当前等级)
|
||||||
PromoteRebate string `json:"promote_rebate"` // 推广返佣说明
|
PromoteRebate string `json:"promote_rebate"` // 推广返佣说明(旧字段,兼容保留)
|
||||||
MaxPromoteRebate float64 `json:"max_promote_rebate"` // 最高推广返佣金额(元)
|
MaxPromoteRebate float64 `json:"max_promote_rebate"` // 最高推广返佣金额(元,旧字段,兼容保留)
|
||||||
UpgradeRebate string `json:"upgrade_rebate"` // 下级升级返佣说明
|
UpgradeRebate string `json:"upgrade_rebate"` // 下级升级返佣说明(旧字段,兼容保留)
|
||||||
Privileges []string `json:"privileges"` // 特权列表
|
Privileges []string `json:"privileges"` // 特权列表(旧字段,兼容保留)
|
||||||
CanUpgradeSubordinate bool `json:"can_upgrade_subordinate"` // 是否可以升级下级
|
CanUpgradeSubordinate bool `json:"can_upgrade_subordinate"` // 是否可以升级下级(旧字段,兼容保留)
|
||||||
|
MaxSetPrice float64 `json:"max_set_price"` // 该等级可设置查询价最高金额(按所有产品最高价格取上限)
|
||||||
|
SubordinateRewardMax float64 `json:"subordinate_reward_max"` // 下级代理查询奖励最高金额(元/单)
|
||||||
|
InviteGoldReward float64 `json:"invite_gold_reward"` // 邀请黄金代理奖励金额(元)
|
||||||
|
InviteDiamondReward float64 `json:"invite_diamond_reward"` // 邀请钻石代理奖励金额(元)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ func (l *GetLevelPrivilegeLogic) GetLevelPrivilege() (resp *types.GetLevelPrivil
|
|||||||
currentBonus = level1Bonus
|
currentBonus = level1Bonus
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取升级返佣与费用配置
|
// 获取升级返佣与费用配置(同时作为邀请奖励金额)
|
||||||
upgradeToGoldRebate := getConfigFloat("upgrade_to_gold_rebate", 139.0)
|
upgradeToGoldRebate := getConfigFloat("upgrade_to_gold_rebate", 139.0)
|
||||||
upgradeToDiamondRebate := getConfigFloat("upgrade_to_diamond_rebate", 680.0)
|
upgradeToDiamondRebate := getConfigFloat("upgrade_to_diamond_rebate", 680.0)
|
||||||
upgradeToGoldFee := getConfigFloat("upgrade_to_gold_fee", 199.0)
|
upgradeToGoldFee := getConfigFloat("upgrade_to_gold_fee", 199.0)
|
||||||
@@ -87,6 +87,34 @@ func (l *GetLevelPrivilegeLogic) GetLevelPrivilege() (resp *types.GetLevelPrivil
|
|||||||
directParentAmountGold := getConfigFloat("direct_parent_amount_gold", 3.0)
|
directParentAmountGold := getConfigFloat("direct_parent_amount_gold", 3.0)
|
||||||
directParentAmountNormal := getConfigFloat("direct_parent_amount_normal", 2.0)
|
directParentAmountNormal := getConfigFloat("direct_parent_amount_normal", 2.0)
|
||||||
|
|
||||||
|
// 获取不同等级的提价上限(用于计算各等级可设置的最高查询价)
|
||||||
|
goldMaxUpliftAmount := getConfigFloat("gold_max_uplift_amount", 0.0)
|
||||||
|
diamondMaxUpliftAmount := getConfigFloat("diamond_max_uplift_amount", 0.0)
|
||||||
|
|
||||||
|
// 计算所有产品在各等级下的可设最高查询价(取所有产品中的最大值)
|
||||||
|
var maxSetPriceLevel1, maxSetPriceLevel2, maxSetPriceLevel3 float64
|
||||||
|
builder := l.svcCtx.AgentProductConfigModel.SelectBuilder()
|
||||||
|
productConfigs, err := l.svcCtx.AgentProductConfigModel.FindAll(l.ctx, builder, "")
|
||||||
|
if err == nil {
|
||||||
|
for _, cfg := range productConfigs {
|
||||||
|
// 普通等级:直接使用系统价格上限
|
||||||
|
if cfg.SystemMaxPrice > maxSetPriceLevel1 {
|
||||||
|
maxSetPriceLevel1 = cfg.SystemMaxPrice
|
||||||
|
}
|
||||||
|
// 黄金等级:系统价格上限 + gold_max_uplift_amount
|
||||||
|
if cfg.SystemMaxPrice+goldMaxUpliftAmount > maxSetPriceLevel2 {
|
||||||
|
maxSetPriceLevel2 = cfg.SystemMaxPrice + goldMaxUpliftAmount
|
||||||
|
}
|
||||||
|
// 钻石等级:系统价格上限 + diamond_max_uplift_amount
|
||||||
|
if cfg.SystemMaxPrice+diamondMaxUpliftAmount > maxSetPriceLevel3 {
|
||||||
|
maxSetPriceLevel3 = cfg.SystemMaxPrice + diamondMaxUpliftAmount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if !errors.Is(err, model.ErrNotFound) {
|
||||||
|
// 查询失败不影响主流程,仅记录日志,前端会看到 0
|
||||||
|
l.Errorf("查询产品配置失败用于计算最高可设查询价, err: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// 构建各等级特权信息
|
// 构建各等级特权信息
|
||||||
levels := []types.LevelPrivilegeItem{
|
levels := []types.LevelPrivilegeItem{
|
||||||
{
|
{
|
||||||
@@ -104,6 +132,10 @@ func (l *GetLevelPrivilegeLogic) GetLevelPrivilege() (resp *types.GetLevelPrivil
|
|||||||
"可邀请下级代理",
|
"可邀请下级代理",
|
||||||
},
|
},
|
||||||
CanUpgradeSubordinate: false,
|
CanUpgradeSubordinate: false,
|
||||||
|
MaxSetPrice: maxSetPriceLevel1,
|
||||||
|
SubordinateRewardMax: directParentAmountNormal,
|
||||||
|
InviteGoldReward: upgradeToGoldRebate,
|
||||||
|
InviteDiamondReward: upgradeToDiamondRebate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Level: 2,
|
Level: 2,
|
||||||
@@ -121,6 +153,10 @@ func (l *GetLevelPrivilegeLogic) GetLevelPrivilege() (resp *types.GetLevelPrivil
|
|||||||
"更多推广权益",
|
"更多推广权益",
|
||||||
},
|
},
|
||||||
CanUpgradeSubordinate: false,
|
CanUpgradeSubordinate: false,
|
||||||
|
MaxSetPrice: maxSetPriceLevel2,
|
||||||
|
SubordinateRewardMax: directParentAmountGold,
|
||||||
|
InviteGoldReward: upgradeToGoldRebate,
|
||||||
|
InviteDiamondReward: upgradeToDiamondRebate,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Level: 3,
|
Level: 3,
|
||||||
@@ -138,6 +174,10 @@ func (l *GetLevelPrivilegeLogic) GetLevelPrivilege() (resp *types.GetLevelPrivil
|
|||||||
"可免费升级下级为黄金代理",
|
"可免费升级下级为黄金代理",
|
||||||
},
|
},
|
||||||
CanUpgradeSubordinate: true,
|
CanUpgradeSubordinate: true,
|
||||||
|
MaxSetPrice: maxSetPriceLevel3,
|
||||||
|
SubordinateRewardMax: directParentAmountDiamond,
|
||||||
|
InviteGoldReward: upgradeToGoldRebate,
|
||||||
|
InviteDiamondReward: upgradeToDiamondRebate,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -268,11 +268,15 @@ type LevelPrivilegeItem struct {
|
|||||||
LevelName string `json:"level_name"` // 等级名称
|
LevelName string `json:"level_name"` // 等级名称
|
||||||
LevelBonus float64 `json:"level_bonus"` // 等级加成(元)
|
LevelBonus float64 `json:"level_bonus"` // 等级加成(元)
|
||||||
PriceReduction float64 `json:"price_reduction"` // 底价降低(元,相对于当前等级)
|
PriceReduction float64 `json:"price_reduction"` // 底价降低(元,相对于当前等级)
|
||||||
PromoteRebate string `json:"promote_rebate"` // 推广返佣说明
|
PromoteRebate string `json:"promote_rebate"` // 推广返佣说明(旧字段,兼容保留)
|
||||||
MaxPromoteRebate float64 `json:"max_promote_rebate"` // 最高推广返佣金额(元)
|
MaxPromoteRebate float64 `json:"max_promote_rebate"` // 最高推广返佣金额(元,旧字段,兼容保留)
|
||||||
UpgradeRebate string `json:"upgrade_rebate"` // 下级升级返佣说明
|
UpgradeRebate string `json:"upgrade_rebate"` // 下级升级返佣说明(旧字段,兼容保留)
|
||||||
Privileges []string `json:"privileges"` // 特权列表
|
Privileges []string `json:"privileges"` // 特权列表(旧字段,兼容保留)
|
||||||
CanUpgradeSubordinate bool `json:"can_upgrade_subordinate"` // 是否可以升级下级
|
CanUpgradeSubordinate bool `json:"can_upgrade_subordinate"` // 是否可以升级下级(旧字段,兼容保留)
|
||||||
|
MaxSetPrice float64 `json:"max_set_price"` // 该等级可设置查询价最高金额(按所有产品最高价格取上限)
|
||||||
|
SubordinateRewardMax float64 `json:"subordinate_reward_max"` // 下级代理查询奖励最高金额(元/单)
|
||||||
|
InviteGoldReward float64 `json:"invite_gold_reward"` // 邀请黄金代理奖励金额(元)
|
||||||
|
InviteDiamondReward float64 `json:"invite_diamond_reward"` // 邀请钻石代理奖励金额(元)
|
||||||
}
|
}
|
||||||
|
|
||||||
type Notification struct {
|
type Notification struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user