|
@@ -51,13 +51,8 @@ func AllBonusStatics(orders []*domain.Order, action int) (bonus protocol.Bonus) |
|
@@ -51,13 +51,8 @@ func AllBonusStatics(orders []*domain.Order, action int) (bonus protocol.Bonus) |
51
|
bonus = protocol.Bonus{}
|
51
|
bonus = protocol.Bonus{}
|
52
|
for i := range orders {
|
52
|
for i := range orders {
|
53
|
o := orders[i]
|
53
|
o := orders[i]
|
54
|
- //if action == protocol.BonusTotal {
|
|
|
55
|
- bonus.Received += o.OrderBonusReceive()
|
|
|
56
|
- bonus.Outstanding += o.OrderBonusWait()
|
|
|
57
|
- //}
|
|
|
58
|
- //if action == protocol.BonusOutstanding {
|
|
|
59
|
- // bonus.Outstanding += o.OrderBonusOutstanding()
|
|
|
60
|
- //}
|
54
|
+ bonus.Received = utils.Decimal(bonus.Received + o.OrderBonusReceive())
|
|
|
55
|
+ bonus.Outstanding = utils.Decimal(bonus.Outstanding + o.OrderBonusWait())
|
61
|
}
|
56
|
}
|
62
|
return
|
57
|
return
|
63
|
}
|
58
|
}
|
|
@@ -67,17 +62,10 @@ func QuartersBonusStatics(orders []*domain.Order, action int) (bonus []protocol. |
|
@@ -67,17 +62,10 @@ func QuartersBonusStatics(orders []*domain.Order, action int) (bonus []protocol. |
67
|
bonus = make([]protocol.Bonus, 4)
|
62
|
bonus = make([]protocol.Bonus, 4)
|
68
|
for i := range orders {
|
63
|
for i := range orders {
|
69
|
o := orders[i]
|
64
|
o := orders[i]
|
70
|
- quarter := o.CreateAt.Month() / 3
|
|
|
71
|
- bonus[quarter].Received += o.OrderBonusReceive()
|
|
|
72
|
- bonus[quarter].Outstanding += o.OrderBonusWait()
|
|
|
73
|
- bonus[quarter].Expend += o.OrderBonusOutstanding()
|
|
|
74
|
- //if action == protocol.BonusTotal {
|
|
|
75
|
- //bonus[quarter].Received += o.OrderBonusReceive()
|
|
|
76
|
- //bonus[quarter].Outstanding += o.OrderBonusWait()
|
|
|
77
|
- //}
|
|
|
78
|
- //if action == protocol.BonusOutstanding {
|
|
|
79
|
- //bonus[quarter].Expend += o.OrderBonusOutstanding()
|
|
|
80
|
- //}
|
65
|
+ quarter := (o.CreateAt.Month() - 1) / 3
|
|
|
66
|
+ bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + o.OrderBonusReceive())
|
|
|
67
|
+ bonus[quarter].Outstanding = utils.Decimal(bonus[quarter].Outstanding + o.OrderBonusWait())
|
|
|
68
|
+ bonus[quarter].Expend = utils.Decimal(bonus[quarter].Expend + o.OrderBonusOutstanding())
|
81
|
}
|
69
|
}
|
82
|
return
|
70
|
return
|
83
|
}
|
71
|
}
|