Showing
2 changed files
with
1 additions
and
7 deletions
... | @@ -20,7 +20,7 @@ class PayController extends Controller | ... | @@ -20,7 +20,7 @@ class PayController extends Controller |
20 | 20 | ||
21 | $order = Order::query()->where('order_sn', $order_sn)->first(); | 21 | $order = Order::query()->where('order_sn', $order_sn)->first(); |
22 | 22 | ||
23 | - if ($order->status !== Order::UNPAID) return false; | 23 | + if ($order->status != Order::UNPAID) return Response::fail('订单错误!'); |
24 | 24 | ||
25 | // if ($order->pay_amount <= 0) return $this->paid($order_sn); 0元购应该单独写一套 | 25 | // if ($order->pay_amount <= 0) return $this->paid($order_sn); 0元购应该单独写一套 |
26 | 26 | ... | ... |
... | @@ -35,12 +35,10 @@ class PaypalPayment implements PaymentInterface | ... | @@ -35,12 +35,10 @@ class PaypalPayment implements PaymentInterface |
35 | 35 | ||
36 | public function __construct() | 36 | public function __construct() |
37 | { | 37 | { |
38 | - try{ | ||
39 | // 初始化时做一些准备工作 | 38 | // 初始化时做一些准备工作 |
40 | $redis = Redis::connection(); | 39 | $redis = Redis::connection(); |
41 | $access_token = $redis->get('paypal:access_token'); | 40 | $access_token = $redis->get('paypal:access_token'); |
42 | if ($access_token){ | 41 | if ($access_token){ |
43 | - Log::channel('daily')->debug($access_token); | ||
44 | $this->accessToken = $access_token; | 42 | $this->accessToken = $access_token; |
45 | }else{ | 43 | }else{ |
46 | $client = new Client([ | 44 | $client = new Client([ |
... | @@ -57,12 +55,8 @@ class PaypalPayment implements PaymentInterface | ... | @@ -57,12 +55,8 @@ class PaypalPayment implements PaymentInterface |
57 | $body = $response->getBody(); | 55 | $body = $response->getBody(); |
58 | $content = json_decode($body->getContents(),true); | 56 | $content = json_decode($body->getContents(),true); |
59 | $this->accessToken = $content['access_token']; | 57 | $this->accessToken = $content['access_token']; |
60 | - Log::channel('daily')->debug($content['access_token']); | ||
61 | $redis->setex('paypal:access_token',$content['expires_in'],$content['access_token']); | 58 | $redis->setex('paypal:access_token',$content['expires_in'],$content['access_token']); |
62 | } | 59 | } |
63 | - }catch (\Exception $exception){ | ||
64 | - Log::channel('daily')->error($exception->getMessage()); | ||
65 | - } | ||
66 | } | 60 | } |
67 | 61 | ||
68 | /** | 62 | /** | ... | ... |
-
Please register or login to post a comment