Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Dec 6, 2018
1 parent 22e6f22 commit 73c482d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion app/Components/Trimepay.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php
namespace App\Components;

class Trimepay {
private $appId;
private $appSecret;
Expand Down Expand Up @@ -75,7 +77,7 @@ public function pay($type, $tradeNo, $totalFee, $notifyUrl = '', $returnUrl = ''
'payType' => $type
];
$signData = $this->prepareSign($payData);
$payData['sign'] = $trimepay->sign($signData);
$payData['sign'] = $this->sign($signData);
$response = $this->post($payData);
return $response;
}
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/Api/TrimepayController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public function store(Request $request)
\Log::info("【Trimepay】回调接口[POST]:" . var_export($request->all(), true));

$json = file_get_contents('php://input');
$data = json_decode($json, true);
parse_str($json, $data);
if (!$data) {
Log::info('Trimepay-POST:回调数据无法解析,可能是非法请求[' . getClientIp() . ']');
exit();
}

// 判断消息是否合法
$trimepay = new Trimepay($systemConfig['trimepay_appid'], $systemConfig['trimepay_appsecret']);
$trimepay = new Trimepay(self::$systemConfig['trimepay_appid'], self::$systemConfig['trimepay_appsecret']);
$cbData = [
'payStatus' => $data['payStatus'],
'payFee' => $data['payFee'],
Expand All @@ -64,11 +64,11 @@ public function store(Request $request)
Log::info('Trimepay-POST:回调数据签名错误,可能是非法请求[' . getClientIp() . ']');
exit();
} else {
exit('SUCCESS');
var_dump('SUCCESS');
}

switch ($data['payStatus']) {
case '1':
case 'SUCCESS':
$this->tradePaid($data);
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/PaymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function create(Request $request)
}
}else if(self::$systemConfig['is_trimepay']){
$trimepay = new Trimepay(self::$systemConfig['trimepay_appid'], self::$systemConfig['trimepay_appsecret']);
$result = $trimepay->pay('WEPAY_QR', $orderSn, $amount);
$result = $trimepay->pay('WEPAY_QR', $orderSn, $amount, self::$systemConfig['website_url'].'/api/trimepay', self::$systemConfig['website_url']);
if ($result['code']!==0) {
Log::error('【Trimepay】创建二维码失败:' . $result['msg']);

Expand All @@ -169,7 +169,7 @@ public function create(Request $request)
}else if(self::$systemConfig['is_trimepay']){
$payment->qr_url = $result['data'];
$payment->qr_code = 'https://www.zhihu.com/qrcode?url='.$result['data'];
$payment->qr_local_url = $this->base64ImageSaver($result['data']);
$payment->qr_local_url = 'https://www.zhihu.com/qrcode?url='.$result['data'];
}
$payment->status = 0;
$payment->save();
Expand Down
Empty file modified storage/ipip.ipdb
100644 → 100755
Empty file.
Empty file modified storage/qqwry.dat
100644 → 100755
Empty file.

0 comments on commit 73c482d

Please sign in to comment.