order = $order; } /** * 获取总金额 * @return float */ public function getAmount() { if (isset($this->amount)) { return $this->amount; } $this->amount = $this->_getAmount(); if($this->amount){ // 将手续费金额保存在订单手续费表中 $preOrderFee = new PreOrderFee([ 'fee_code' => $this->code, 'amount' => $this->amount, 'name' => $this->getName(), ]); $preOrderFee->setOrder($this->order); } return $this->amount; } public function getCode(){ return $this->code; } public function getName(){ return $this->name; } abstract protected function _getAmount(); public function enable(){ return true; } }