user_id = $data['user_id'] ?? 0; $this->point_id = $data['point_id'] ?? 0; $this->amount = $data['amount'] ?? 0; $this->log_type = $data['log_type'] ?? LOG_TYPE::TEST; $this->operate_id = $data['operate_id'] ?? ''; $this->remark = $data['remark'] ?? ''; $this->success = $data['success'] ?? false; } /** * 转换为数组 * * @return array */ public function toArray(): array { return [ 'user_id' => $this->user_id, 'point_id' => $this->point_id, 'amount' => $this->amount, 'log_type' => $this->log_type->value, 'operate_id' => $this->operate_id, 'remark' => $this->remark, 'success' => $this->success, ]; } }