Files
hzmys.hkpgsow.cn/app/home/controller/Wechatpay.php
gaofeng 6d9aee81aa 提交
2026-05-12 18:27:28 +08:00

38 lines
1.2 KiB
PHP

<?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'));
}
}