protected function getRetData(array $data)
    {
        if ($this->config->returnRaw) {
            $data['channel'] = Config::WX_CHARGE;
            return $data;
        }

        // 将金额处理为元
        $totalFee = bcdiv($data['total_fee'], 100, 2);
        $cashFee = bcdiv($data['cash_fee'], 100, 2);

        $retData = [
            'bank_type' => $data['bank_type'],
            'cash_fee' => $cashFee,
            'device_info' => $data['device_info'],
            'fee_type' => $data['fee_type'],
            'is_subscribe' => $data['is_subscribe'],
            'buyer_id'   => $data['openid'],
            'order_no'   => $data['out_trade_no'],
            'pay_time'   => date('Y-m-d H:i:s', strtotime($data['time_end'])),// 支付完成时间
            'amount'   => $totalFee,
            'trade_type' => $data['trade_type'],
            'transaction_id'   => $data['transaction_id'],
            'trade_state'   => strtolower($data['return_code']),
            'channel'   => Config::WX_CHARGE,
        ];

        // 检查是否存在用户自定义参数
        if (isset($data['attach']) && ! empty($data['attach'])) {
            $retData['return_param'] = $data['attach'];
        }

        return $retData;
    }
protected function getRetData(array $data)
    {
        if ($this->config->returnRaw) {
            $data['channel'] = Config::WX_CHARGE;
            return $data;
        }

        
        $totalFee = bcdiv($data['total_fee'], 100, 2);
        $cashFee = bcdiv($data['cash_fee'], 100, 2);

        $retData = [
            'bank_type' => $data['bank_type'],
            'cash_fee' => $cashFee,
            'device_info' => $data['device_info'],
            'fee_type' => $data['fee_type'],
            'is_subscribe' => $data['is_subscribe'],
            'buyer_id'   => $data['openid'],
            'order_no'   => $data['out_trade_no'],
            'pay_time'   => date('Y-m-d H:i:s', strtotime($data['time_end'])),
            'amount'   => $totalFee,
            'trade_type' => $data['trade_type'],
            'transaction_id'   => $data['transaction_id'],
            'trade_state'   => strtolower($data['return_code']),
            'channel'   => Config::WX_CHARGE,
        ];

        
        if (isset($data['attach']) && ! empty($data['attach'])) {
            $retData['return_param'] = $data['attach'];
        }

        return $retData;
    }
protected function getRetData ( array $ data ) { if ( $ this -> config -> returnRaw ) { $ data [ 'channel' ] = Config :: WX_CHARGE ; return $ data ; } // 将金额处理为元 $ totalFee = bcdiv ( $ data [ 'total_fee' ] , 100 , 2 ) ; $ cashFee = bcdiv ( $ data [ 'cash_fee' ] , 100 , 2 ) ; $ retData = [ 'bank_type' => $ data [ 'bank_type' ] , 'cash_fee' => $ cashFee , 'device_info' => $ data [ 'device_info' ] , 'fee_type' => $ data [ 'fee_type' ] , 'is_subscribe' => $ data [ 'is_subscribe' ] , 'buyer_id' => $ data [ 'openid' ] , 'order_no' => $ data [ 'out_trade_no' ] , 'pay_time' => date ( 'Y-m-d H:i:s' , strtotime ( $ data [ 'time_end' ] ) ) , // 支付完成时间 'amount' => $ totalFee , 'trade_type' => $ data [ 'trade_type' ] , 'transaction_id' => $ data [ 'transaction_id' ] , 'trade_state' => strtolower ( $ data [ 'return_code' ] ) , 'channel' => Config :: WX_CHARGE , ] ; // 检查是否存在用户自定义参数 if ( isset ( $ data [ 'attach' ] ) && ! empty ( $ data [ 'attach' ] ) ) { $ retData [ 'return_param' ] = $ data [ 'attach' ] ; } return $ retData ; }
获取向客户端返回的数据
@param array $data

@return array
@author helei
获取向客户端返回的数据 @param array $data