orgCd = $orgCd; $this->outOrderId = $outOrderId; $this->oglOrdId = $oglOrdId; } /** * 交易码,扫码支付固定:TRANS0105 * * @return string */ public function getTrscode() :string { return 'TRANS1133'; } /** * 聚合:tran * * @return string */ public function getProCd() :string { return 'tran'; } /** * 费率通道 * * @return integer */ public function getChanelType() :int { return 1; } /** * @param string $mchtCd * @return array */ public function getTransData(string $mchtCd) :array { return [ 'trscode' => $this->getTrscode(), 'orgCd' => $this->orgCd, 'mchtCd' => $mchtCd, 'outOrderId' => $this->outOrderId, 'oglOrdId' => $this->oglOrdId, 'proCd' => $this->getProCd(), 'chanelType' => $this->getChanelType(), 'transAmt' => $this->getTotalAmount(), 'isSplitBill' => $this->getIsSplitBill(), 'itemsList' => $this->getSplitBill(), ]; } /** * 获取分账总金额 * * @return float */ protected function getTotalAmount() { // func2 $list = array_column( $this->getSplitBill(), 'item10' ); $total = 0; foreach ($list as $item) { $total = bcadd($total, $item, 2); } return $total; // func1 return array_sum( array_column( $this->getSplitBill(), 'item10' ) ); } }