fix calc
This commit is contained in:
parent
0d6b0bce10
commit
88b4c917c6
|
@ -11,12 +11,12 @@ func TestCalcIncome(t *testing.T) {
|
|||
|
||||
ztp := &dbstruct.ZoneThirdPartner{
|
||||
ThirdPartnerMid: goproto.Int64(100001),
|
||||
SharingRatio: goproto.Float64(0.4),
|
||||
SharingRatio: goproto.Float64(0.1),
|
||||
}
|
||||
zclList := []*dbstruct.ZoneCollaborator{
|
||||
&dbstruct.ZoneCollaborator{
|
||||
CollaboratorMid: goproto.Int64(200001),
|
||||
SharingRatio: goproto.Float64(0.15),
|
||||
SharingRatio: goproto.Float64(0.09),
|
||||
},
|
||||
&dbstruct.ZoneCollaborator{
|
||||
CollaboratorMid: goproto.Int64(200002),
|
||||
|
@ -31,7 +31,7 @@ func TestCalcIncome(t *testing.T) {
|
|||
SharingRatio: goproto.Float64(0.05),
|
||||
},
|
||||
}
|
||||
list := v._calcWithZoneWithTp(100, 10000, 1, ztp, zclList)
|
||||
list := v._calcWithZoneWithTp(100, 10, 1, ztp, zclList)
|
||||
for _, v := range list {
|
||||
t.Logf("%v, %v, %v\n", v.Mid, v.Rate, v.Dias)
|
||||
}
|
||||
|
|
|
@ -629,7 +629,7 @@ func (v *Vas) _calcWithZoneWithoutTp(streamerMid, totalDias int64, defaultIncome
|
|||
// 有空间,有代运营
|
||||
func (v *Vas) _calcWithZoneWithTp(streamerMid, totalDias int64, defaultIncomeSType int32, ztp *dbstruct.ZoneThirdPartner, zclList []*dbstruct.ZoneCollaborator) []IncomeInfo {
|
||||
list := make([]IncomeInfo, 0)
|
||||
ztpDias := totalDias
|
||||
leftDias := totalDias
|
||||
|
||||
// 官方
|
||||
officialDias := int64(float64(totalDias) * 0.2)
|
||||
|
@ -639,15 +639,13 @@ func (v *Vas) _calcWithZoneWithTp(streamerMid, totalDias int64, defaultIncomeSTy
|
|||
Rate: 0.2,
|
||||
Dias: officialDias,
|
||||
})
|
||||
ztpDias -= officialDias
|
||||
leftDias -= officialDias
|
||||
|
||||
// 代运营+协作者真正分成rate
|
||||
ztpRate := 0.8 * ztp.GetSharingRatio()
|
||||
// 代运营自己
|
||||
ztpSelfRate := ztpRate
|
||||
partsRate := 0.8 * ztp.GetSharingRatio()
|
||||
|
||||
// 主播
|
||||
streamerRate := 0.8 - ztpRate
|
||||
streamerRate := 0.8 - partsRate
|
||||
streamerDias := int64(float64(totalDias) * streamerRate)
|
||||
list = append(list, IncomeInfo{
|
||||
Mid: streamerMid,
|
||||
|
@ -655,7 +653,7 @@ func (v *Vas) _calcWithZoneWithTp(streamerMid, totalDias int64, defaultIncomeSTy
|
|||
Rate: streamerRate,
|
||||
Dias: streamerDias,
|
||||
})
|
||||
ztpDias -= streamerDias
|
||||
leftDias -= streamerDias
|
||||
|
||||
// 协作者
|
||||
for _, zcl := range zclList {
|
||||
|
@ -667,17 +665,28 @@ func (v *Vas) _calcWithZoneWithTp(streamerMid, totalDias int64, defaultIncomeSTy
|
|||
Rate: zclRate,
|
||||
Dias: zclDias,
|
||||
})
|
||||
ztpSelfRate -= zclRate
|
||||
ztpDias -= zclDias
|
||||
leftDias -= zclDias
|
||||
}
|
||||
|
||||
// 代运营自己
|
||||
// 代运营
|
||||
ztpRate := 0.8 * ztp.GetSharingRatio()
|
||||
ztpDias := int64(float64(totalDias) * ztpRate)
|
||||
list = append(list, IncomeInfo{
|
||||
Mid: ztp.GetThirdPartnerMid(),
|
||||
IncomeSType: dbstruct.CHSTypeIncomeThirdPartner,
|
||||
Rate: ztpSelfRate,
|
||||
Rate: ztpRate,
|
||||
Dias: ztpDias,
|
||||
})
|
||||
leftDias -= ztpDias
|
||||
|
||||
// 如果剩余钻石,加到官方上
|
||||
list = append(list, IncomeInfo{
|
||||
Mid: common.OfficialMid,
|
||||
IncomeSType: defaultIncomeSType,
|
||||
Rate: 0,
|
||||
Dias: leftDias,
|
||||
})
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue