提交
This commit is contained in:
37
app/home/controller/Wechatpay.php
Normal file
37
app/home/controller/Wechatpay.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\home\controller;
|
||||
|
||||
use api\Httpcurl;
|
||||
use think\facade\Request;
|
||||
|
||||
class Wechatpay extends Base
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
$order_sn = Request::instance()->param('order_sn');
|
||||
if (!$order_sn) {
|
||||
return $this->error(lang('wepay.missing_order_sn'), url('visa/index'));
|
||||
}
|
||||
|
||||
$response = Httpcurl::request(config('app.GET_ORDER_DETAIL_URL'), 'post', ['order_sn' => $order_sn, 'model' => MODEL]);
|
||||
if ($response[3]) {
|
||||
return $this->error(lang('wepay.payment_failed_retry'), url('visa/index'));
|
||||
}
|
||||
|
||||
$pay_result = json_decode($response[0], true);
|
||||
if (empty($pay_result)) {
|
||||
return $this->error(lang('wepay.payment_failed_retry'), url('visa/index'));
|
||||
}
|
||||
if (!$pay_result['code']) {
|
||||
return $this->error(lang('wepay.payment_failed_retry'), url('visa/index'));
|
||||
}
|
||||
|
||||
$pay_result = $pay_result['data'];
|
||||
if ($pay_result['pay_status']) {
|
||||
return $this->success(lang('wepay.payment_success'), url('wepay/succ'), ['order_sn' => $order_sn]);
|
||||
}
|
||||
|
||||
return $this->error(lang('wepay.payment_failed_retry'), url('visa/index'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user