userId = $data['user_id'] ?? 0; $this->fundId = $data['fund_id'] ?? 0; $this->amount = $data['amount'] ?? 0.00; $this->remark = $data['remark'] ?? null; $this->type = $data['type'] ?? null; } /** * 转换为数组 */ public function toArray(): array { return [ 'user_id' => $this->userId, 'fund_id' => $this->fundId, 'amount' => $this->amount, 'remark' => $this->remark, 'type' => $this->type, ]; } }