feat(distribution): 完善分销站与主站业务数据及权益风控隔离,修复历史商品归属
This commit is contained in:
@@ -63,9 +63,20 @@ func (r *Repository) Create(ctx context.Context, renterID uint64, req CreateRequ
|
||||
return err
|
||||
}
|
||||
rentOriginalAmountCent := pricing.RentAmountCent
|
||||
growthSnapshot, err := rentergrowth.SnapshotForUser(tx, renterID)
|
||||
if err != nil {
|
||||
return err
|
||||
var growthSnapshot rentergrowth.DiscountSnapshot
|
||||
if distributionSite == nil {
|
||||
snap, err := rentergrowth.SnapshotForUser(tx, renterID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
growthSnapshot = snap
|
||||
} else {
|
||||
// 分销站点订单隔离主站成长等级免押与折扣,防止主站免押坏账与折扣侵蚀分销收益
|
||||
growthSnapshot = rentergrowth.DiscountSnapshot{
|
||||
LevelCode: rentergrowth.DefaultLevelCode,
|
||||
LevelName: rentergrowth.DefaultLevelName,
|
||||
DiscountBps: rentergrowth.DefaultDiscountBps,
|
||||
}
|
||||
}
|
||||
rentDiscountAmountCent := rentergrowth.CalculateDiscountCent(pricing.PureCoinAmountCent, pricing.PureCoinPlatformFeeCent, growthSnapshot.DiscountBps)
|
||||
if rentDiscountAmountCent > 0 {
|
||||
|
||||
Reference in New Issue
Block a user