为了清楚起见,这是输入的数据:
数组([0] => 数组([SiteID] => 147 [Amount] => 500.00 [TransactionType] => D)
[1] => Array
(
[SiteID] => 145
[Amount] => 500.00
[TransactionType] => D
)
[2] => Array
(
[SiteID] => 145
[Amount] => 500.00
[TransactionType] => D
)
[3] => Array
(
[SiteID] => 147
[Amount] => 500.00
[TransactionType] => D
)
[4] => Array
(
[SiteID] => 146
[Amount] => 500.00
[TransactionType] => D
)
[5] => Array
(
[SiteID] => 146
[Amount] => 500.00
[TransactionType] => D
)
[6] => Array
(
[SiteID] => 145
[Amount] => 500.00
[TransactionType] => W
)
[7] => Array
(
[SiteID] => 145
[Amount] => 500.00
[TransactionType] => W
)
[8] => Array
(
[SiteID] => 146
[Amount] => 330.00
[TransactionType] => W
)
[9] => Array
(
[SiteID] => 146
[Amount] => 500.00
[TransactionType] => W
)
[10] => Array
(
[SiteID] => 3
[Amount] => 500.00
[TransactionType] => D
)
我需要获得相同 SiteID 的所有事务的总和,它是 TransactionType。例如:
D - 存款,W - 赎回,R - 重新加载
结果:array ([147]=>array([Deposit] => 1000, [Reload]=>3000, [Redemption]=>2000))
注意:147 是 SiteID。
我需要计算相同 SiteID 的所有交易的存款、重新加载、赎回。
如果 SiteID 存在不止一次,只需添加每个周期的存款、重新加载和赎回。:)
请回复。谢谢并以正确的方式指导我!