<?php

namespace App\Modules\Trade\Pay;

use App\Libs\Pay\PayFactory;
use Exception;
use Log;

class AliOrderArousePay extends OrderArousePayAbstract
{
    public function arouse(array $data)
    {
        $ali_param = [
            'body' => '小说阅读',
            'subject' => '追书云',
            'out_trade_no' => $data['trade_no'],
            'timeout_express' => '90m',
            'total_amount' => $data['price'] / 100,
            'product_code' => 'QUICK_WAP_WAY',
            'return_url' => '',
            'type' => $data['type'],
        ];
        try {
            $pay = PayFactory::aliPay();
            $result = $pay->send($ali_param);
            return $result;
        } catch (Exception $e) {
            Log::error("创建支付宝订单失败，" . $e->getMessage());
        }
    }
}
