李帅

1.打印paypal token

......@@ -20,7 +20,7 @@ class PayController extends Controller
$order = Order::query()->where('order_sn', $order_sn)->first();
if ($order->status !== Order::UNPAID) return false;
if ($order->status != Order::UNPAID) return Response::fail('订单错误!');
// if ($order->pay_amount <= 0) return $this->paid($order_sn); 0元购应该单独写一套
......
......@@ -35,12 +35,10 @@ class PaypalPayment implements PaymentInterface
public function __construct()
{
try{
// 初始化时做一些准备工作
$redis = Redis::connection();
$access_token = $redis->get('paypal:access_token');
if ($access_token){
Log::channel('daily')->debug($access_token);
$this->accessToken = $access_token;
}else{
$client = new Client([
......@@ -57,12 +55,8 @@ class PaypalPayment implements PaymentInterface
$body = $response->getBody();
$content = json_decode($body->getContents(),true);
$this->accessToken = $content['access_token'];
Log::channel('daily')->debug($content['access_token']);
$redis->setex('paypal:access_token',$content['expires_in'],$content['access_token']);
}
}catch (\Exception $exception){
Log::channel('daily')->error($exception->getMessage());
}
}
/**
......