fundId = $data['fund_id'] ?? 0; $dto->oldBalance = $data['old_balance'] ?? 0; $dto->newBalance = $data['new_balance'] ?? 0; $dto->changeAmount = $data['change_amount'] ?? 0; $dto->updatedAt = $data['updated_at'] ?? time(); return $dto; } /** * 转换为数组 * * @return array */ public function toArray(): array { return [ 'fund_id' => $this->fundId instanceof FUND_TYPE ? $this->fundId->value : $this->fundId, 'old_balance' => $this->oldBalance, 'new_balance' => $this->newBalance, 'change_amount' => $this->changeAmount, 'updated_at' => $this->updatedAt, ]; } }