From 0364f704687c63a6d63fa769d19607db38ba1e9f Mon Sep 17 00:00:00 2001 From: mattoid Date: Tue, 5 Mar 2024 16:18:51 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Event/MoneyAllHistoryEvent.php | 4 +++- src/Event/MoneyHistoryEvent.php | 4 +++- src/Listeners/MoneyAllHistoryListeners.php | 2 +- src/Listeners/MoneyHistoryListeners.php | 2 ++ 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Event/MoneyAllHistoryEvent.php b/src/Event/MoneyAllHistoryEvent.php index c7a4632..1372188 100644 --- a/src/Event/MoneyAllHistoryEvent.php +++ b/src/Event/MoneyAllHistoryEvent.php @@ -8,13 +8,15 @@ class MoneyAllHistoryEvent public $list; public $money; public $source; + public $sourceKey; public $sourceDesc; - public function __construct($list = array(), $money = 0, $source = "", $sourceDesc = "") + public function __construct($list = array(), $money = 0, $source = "", $sourceDesc = "", $sourceKey = "") { $this->list = $list; $this->money = $money; $this->source = $source; + $this->sourceKey = $sourceKey; $this->sourceDesc = $sourceDesc; } diff --git a/src/Event/MoneyHistoryEvent.php b/src/Event/MoneyHistoryEvent.php index 9260b4f..f2ee29f 100644 --- a/src/Event/MoneyHistoryEvent.php +++ b/src/Event/MoneyHistoryEvent.php @@ -10,13 +10,15 @@ class MoneyHistoryEvent public $user; public $money; public $source; + public $sourceKey; public $sourceDesc; - public function __construct(User $user = null, $money = 0, $source = "", $sourceDesc = "") + public function __construct(User $user = null, $money = 0, $source = "", $sourceDesc = "", $sourceKey = "") { $this->user = $user; $this->money = $money; $this->source = $source; + $this->sourceKey = $sourceKey; $this->sourceDesc = $sourceDesc; } diff --git a/src/Listeners/MoneyAllHistoryListeners.php b/src/Listeners/MoneyAllHistoryListeners.php index 09aeaef..3ef885a 100644 --- a/src/Listeners/MoneyAllHistoryListeners.php +++ b/src/Listeners/MoneyAllHistoryListeners.php @@ -22,7 +22,7 @@ public function handle(MoneyAllHistoryEvent $event) { "type" => $event->money > 0 ? "C" : "D", "money" => $event->money > 0 ? $event->money : -$event->money, "source" => $this->source, - "source_desc" => $this->sourceKey, + "source_key" => $this->sourceKey, "source_desc" => $this->sourceDesc, "balance_money" => isset($item->init_money) ? $item->init_money : $item->money - $event->money, "last_money" => $event->money, diff --git a/src/Listeners/MoneyHistoryListeners.php b/src/Listeners/MoneyHistoryListeners.php index 646801f..cb35e5b 100644 --- a/src/Listeners/MoneyHistoryListeners.php +++ b/src/Listeners/MoneyHistoryListeners.php @@ -7,10 +7,12 @@ class MoneyHistoryListeners extends HistoryListeners { protected $source = ""; + protected $sourceKey = ""; protected $sourceDesc = ""; public function handle(MoneyHistoryEvent $event) { $this->source = $event->source; + $this->sourceKey = $event->sourceKey; $this->sourceDesc = $event->sourceDesc; $this->exec($event->user, $event->money);