Skip to content

Commit

Permalink
国际化
Browse files Browse the repository at this point in the history
  • Loading branch information
liufei-ereach committed Mar 5, 2024
1 parent d1ec9d9 commit 0364f70
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/Event/MoneyAllHistoryEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 3 additions & 1 deletion src/Event/MoneyHistoryEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Listeners/MoneyAllHistoryListeners.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/Listeners/MoneyHistoryListeners.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0364f70

Please sign in to comment.