huangjiajun před 1 měsícem
rodič
revize
91178dbc8e
4 změnil soubory, kde provedl 29 přidání a 7 odebrání
  1. +2
    -0
      db/model/plan_reward.go
  2. +2
    -0
      lib/comm_plan/init.go
  3. +14
    -0
      svc/get_plan_cfg.go
  4. +11
    -7
      svc/reward_commission.go

+ 2
- 0
db/model/plan_reward.go Zobrazit soubor

@@ -8,6 +8,8 @@ type PlanReward struct {
RegionRate float32 `json:"region_rate" xorm:"not null default 0.0000 comment('区域代理抽成比例') FLOAT(6,4)"`
RegionSubRate float32 `json:"region_sub_rate" xorm:"not null default 0.0000 comment('区域代理抽成比例') FLOAT(6,4)"`
GlobalRate float32 `json:"global_rate" xorm:"not null default 0.0000 comment('全球分红抽成比例') FLOAT(6,4)"`
StoreSubsidyRate float64 `json:"store_subsidy_rate" xorm:"not null default 0.0000 comment('全球分红抽成比例') FLOAT(6,4)"`
RedPacketRate float64 `json:"red_packet_rate" xorm:"not null default 0.0000 comment('全球分红抽成比例') FLOAT(6,4)"`
SelfBuyGlobalRate float64 `json:"self_buy_global_rate" xorm:"not null default 0.0000 comment('全球分红抽成比例') FLOAT(6,4)"`
BuckleRate float64 `json:"buckle_rate_rate" xorm:"not null default 0.0000 comment('抽成比例') FLOAT(6,4)"`
SettleMode int `json:"settle_mode" xorm:"not null default 1 comment('0.手动方案,1.自动方案') TINYINT(1)"`


+ 2
- 0
lib/comm_plan/init.go Zobrazit soubor

@@ -40,6 +40,8 @@ type PlanOpt struct {
RegionRate float64 // 区域代理占佣比例
RegionSubRate float64 // 区域代理占佣比例
GlobalRate float64 // 全球分红占佣比例
StoreSubsidyRate float64
RedPacketRate float64
SelfBuyGlobalRate float64
MerchantRate float64 //商家占佣比例
NewAgentRate float64 //代理分红占佣比例


+ 14
- 0
svc/get_plan_cfg.go Zobrazit soubor

@@ -47,6 +47,8 @@ func GetAllPlan(eg *xorm.Engine, dbName string) (map[string]*model.PlanReward, m
SysRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["sys_rate"]) / 100,
RegionRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["region_rate"]) / 100,
GlobalRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["global_rate"]) / 100,
StoreSubsidyRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["store_subsidy_rate"]) / 100,
RedPacketRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["red_packet_rate"]) / 100,
SettleMode: zhios_order_relate_utils.StrToInt(oneRewardPlan["settle_mode"]),
PlanCommissionId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_commission_id"]),
PlanSettleId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_settle_id"]),
@@ -72,6 +74,8 @@ func GetAllPlan(eg *xorm.Engine, dbName string) (map[string]*model.PlanReward, m
SysRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["sys_rate"]) / 100,
RegionRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["region_rate"]) / 100,
GlobalRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["global_rate"]) / 100,
StoreSubsidyRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["store_subsidy_rate"]) / 100,
RedPacketRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["red_packet_rate"]) / 100,
SettleMode: zhios_order_relate_utils.StrToInt(oneRewardPlan["settle_mode"]),
PlanCommissionId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_commission_id"]),
PlanSettleId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_settle_id"]),
@@ -134,6 +138,8 @@ func GetPlanCfg(eg *xorm.Engine, pvd, masterId string, rewardOpts map[string]*mo
opt.RegionRate = float64(int64(rewardOpt.RegionRate*1e4)) / 1e4
opt.RegionSubRate = float64(int64(rewardOpt.RegionSubRate*1e4)) / 1e4
opt.GlobalRate = float64(int64(rewardOpt.GlobalRate*1e4)) / 1e4
opt.StoreSubsidyRate = float64(int64(rewardOpt.StoreSubsidyRate*1e4)) / 1e4
opt.RedPacketRate = float64(int64(rewardOpt.RedPacketRate*1e4)) / 1e4
opt.SelfBuyGlobalRate = float64(int64(rewardOpt.SelfBuyGlobalRate*1e4)) / 1e4
opt.PushHandRate = float64(int64(rewardOpt.PushHandRate*1e4)) / 1e4
opt.MerchantRate = float64(int64(rewardOpt.MerchantRate*1e4)) / 1e4
@@ -290,6 +296,8 @@ func GetPlanCfgService(eg *xorm.Engine, pvd, masterId string, rewardOpts map[str
opt.RegionRate = float64(int64(rewardOpt.RegionRate*1e4)) / 1e4
opt.RegionSubRate = float64(int64(rewardOpt.RegionSubRate*1e4)) / 1e4
opt.GlobalRate = float64(int64(rewardOpt.GlobalRate*1e4)) / 1e4
opt.StoreSubsidyRate = float64(int64(rewardOpt.StoreSubsidyRate*1e4)) / 1e4
opt.RedPacketRate = float64(int64(rewardOpt.RedPacketRate*1e4)) / 1e4
opt.SelfBuyGlobalRate = float64(int64(rewardOpt.SelfBuyGlobalRate*1e4)) / 1e4
opt.PushHandRate = float64(int64(rewardOpt.PushHandRate*1e4)) / 1e4
opt.MerchantRate = float64(int64(rewardOpt.MerchantRate*1e4)) / 1e4
@@ -437,6 +445,8 @@ func PlanOpts(eg *xorm.Engine) map[string]*comm_plan.PlanOpt {
SysRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["sys_rate"]) / 100,
RegionRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["region_rate"]) / 100,
GlobalRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["global_rate"]) / 100,
StoreSubsidyRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["store_subsidy_rate"]) / 100,
RedPacketRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["red_packet_rate"]) / 100,
SettleMode: zhios_order_relate_utils.StrToInt(oneRewardPlan["settle_mode"]),
PlanCommissionId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_commission_id"]),
PlanSettleId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_settle_id"]),
@@ -462,6 +472,8 @@ func PlanOpts(eg *xorm.Engine) map[string]*comm_plan.PlanOpt {
SysRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["sys_rate"]) / 100,
RegionRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["region_rate"]) / 100,
GlobalRate: zhios_order_relate_utils.StrToFloat32(oneRewardPlan["global_rate"]) / 100,
StoreSubsidyRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["store_subsidy_rate"]) / 100,
RedPacketRate: zhios_order_relate_utils.StrToFloat64(oneRewardPlan["red_packet_rate"]) / 100,
SettleMode: zhios_order_relate_utils.StrToInt(oneRewardPlan["settle_mode"]),
PlanCommissionId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_commission_id"]),
PlanSettleId: zhios_order_relate_utils.StrToInt(oneRewardPlan["plan_settle_id"]),
@@ -492,6 +504,8 @@ func PlanOpts(eg *xorm.Engine) map[string]*comm_plan.PlanOpt {
PvdRate: float64(v.PvdRate),
RegionRate: float64(v.RegionRate),
GlobalRate: float64(v.GlobalRate),
StoreSubsidyRate: v.StoreSubsidyRate,
RedPacketRate: v.RedPacketRate,
SelfBuyGlobalRate: v.SelfBuyGlobalRate,
UserRate: subsidyTmp,
BuckleRate: v.BuckleRate,


+ 11
- 7
svc/reward_commission.go Zobrazit soubor

@@ -860,6 +860,8 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types string, rmd *md.Commissi
sysFee := fee * opt.SysRate // 平台比例
regionFee := fee * opt.RegionRate // 区域代理比例
globalFee := fee * opt.GlobalRate // 全球分红比例
StoreSubsidyRate := fee * opt.StoreSubsidyRate // x
RedPacketRate := fee * opt.RedPacketRate //
selfBuyGlobalFee := fee * opt.SelfBuyGlobalRate // 全球分红比例
pushHandFee := fee * opt.PushHandRate
merchantFee := fee * opt.MerchantRate
@@ -867,7 +869,7 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types string, rmd *md.Commissi
regionSubFee := fee * opt.RegionSubRate

// 剩余可分配的佣金
total := int64(fee*1e6) - int64(pvdFee*1e6) - int64(sysFee*1e6) - int64(regionFee*1e6) - int64(regionSubFee*1e6) - int64(globalFee*1e6) - int64(selfBuyGlobalFee*1e6) - int64(pushHandFee*1e6) - int64(merchantFee*1e6) - int64(newAgentFee*1e6)
total := int64(fee*1e6) - int64(pvdFee*1e6) - int64(sysFee*1e6) - int64(regionFee*1e6) - int64(regionSubFee*1e6) - int64(StoreSubsidyRate*1e6) - int64(regionFee*1e6) - int64(globalFee*1e6) - int64(selfBuyGlobalFee*1e6) - int64(pushHandFee*1e6) - int64(merchantFee*1e6) - int64(newAgentFee*1e6)
for _, v := range opt.RateList {
total -= int64(fee * (v / 100) * 1e6)
}
@@ -878,18 +880,20 @@ func CommFee(fee float64, opt *comm_plan.PlanOpt, types string, rmd *md.Commissi
if fee < 0 {
fee = 0
}
pvdFeeFirst := feeFirst * opt.PvdRate // 供应商联盟比例
sysFeeFirst := feeFirst * opt.SysRate // 平台比例
regionFeeFirst := feeFirst * opt.RegionRate // 区域代理比例
globalFeeFirst := feeFirst * opt.GlobalRate // 全球分红比例
selfBuyGlobalFeeFirst := feeFirst * opt.SelfBuyGlobalRate // 全球分红比例
pvdFeeFirst := feeFirst * opt.PvdRate // 供应商联盟比例
sysFeeFirst := feeFirst * opt.SysRate // 平台比例
regionFeeFirst := feeFirst * opt.RegionRate // 区域代理比例
globalFeeFirst := feeFirst * opt.GlobalRate // 全球分红比例
StoreSubsidyRateFeeFirst := feeFirst * opt.StoreSubsidyRate // 全球分红比例
RedPacketRateFeeFirst := feeFirst * opt.RedPacketRate // 全球分红比例
selfBuyGlobalFeeFirst := feeFirst * opt.SelfBuyGlobalRate // 全球分红比例
pushHandFeeFirst := feeFirst * opt.PushHandRate
merchantFeeFirst := feeFirst * opt.MerchantRate
newAgentFeeFirst := feeFirst * opt.NewAgentRate
regionSubFeeFirst := feeFirst * opt.RegionSubRate

// 剩余可分配的佣金
totalFirst := int64(feeFirst*1e6) - int64(pvdFeeFirst*1e6) - int64(sysFeeFirst*1e6) - int64(regionFeeFirst*1e6) - int64(regionSubFeeFirst*1e6) - int64(globalFeeFirst*1e6) - int64(selfBuyGlobalFeeFirst*1e6) - int64(pushHandFeeFirst*1e6) - int64(merchantFeeFirst*1e6) - int64(newAgentFeeFirst*1e6)
totalFirst := int64(feeFirst*1e6) - int64(pvdFeeFirst*1e6) - int64(sysFeeFirst*1e6) - int64(StoreSubsidyRateFeeFirst*1e6) - int64(RedPacketRateFeeFirst*1e6) - int64(regionFeeFirst*1e6) - int64(regionSubFeeFirst*1e6) - int64(globalFeeFirst*1e6) - int64(selfBuyGlobalFeeFirst*1e6) - int64(pushHandFeeFirst*1e6) - int64(merchantFeeFirst*1e6) - int64(newAgentFeeFirst*1e6)
for _, v := range opt.RateList {
totalFirst -= int64(feeFirst * (v / 100) * 1e6)
}


Načítá se…
Zrušit
Uložit