Exemplo n.º 1
0
                exit($site->{$method}($ret));
            }
        }
    }
}
$sql = 'SELECT * FROM ' . tablename('paylog') . ' WHERE `plid`=:plid';
$log = pdo_fetch($sql, array(':plid' => $params['tid']));
if (!empty($log) && $log['status'] != '0') {
    exit('这个订单已经支付成功, 不需要重复支付.');
}
$auth = sha1($sl . $log['weid'] . $_W['config']['setting']['authkey']);
if ($auth != $_GPC['auth']) {
    exit('参数传输错误.');
}
require_once model('payment');
$wOpt = wechat_build($params, $_W['account']['payment']['wechat']);
if (is_error($wOpt)) {
    if ($wOpt['message'] == 'invalid out_trade_no') {
        $id = date('YmdH');
        pdo_update('paylog', array('plid' => $id), array('plid' => $log['plid']));
        pdo_query("ALTER TABLE " . tablename('paylog') . " auto_increment = " . ($id + 1) . ";");
        message("抱歉,发起支付失败,系统已经修复此问题,请重新尝试支付。");
    }
    message("抱歉,发起支付失败,具体原因为:“{$wOpt['errno']}:{$wOpt['message']}”。请及时联系站点管理员。");
    exit;
}
?>
<script type="text/javascript">
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
	WeixinJSBridge.invoke('getBrandWCPayRequest', {
		'appId' : '<?php 
Exemplo n.º 2
0
if ($auth != $_GPC['auth']) {
    exit('参数传输错误.');
}
load()->model('payment');
$_W['uniacid'] = intval($log['uniacid']);
$_W['openid'] = intval($log['openid']);
$setting = uni_setting($_W['uniacid'], array('payment'));
if (!is_array($setting['payment'])) {
    exit('没有设定支付参数.');
}
$wechat = $setting['payment']['wechat'];
$sql = 'SELECT `key`,`secret` FROM ' . tablename('account_wechats') . ' WHERE `acid`=:acid';
$row = pdo_fetch($sql, array(':acid' => $wechat['account']));
$wechat['appid'] = $row['key'];
$wechat['secret'] = $row['secret'];
$wOpt = wechat_build($params, $wechat);
//print_r($wOpt);die();
if (is_error($wOpt)) {
    if ($wOpt['message'] == 'invalid out_trade_no' || $wOpt['message'] == 'OUT_TRADE_NO_USED') {
        $id = date('YmdH');
        pdo_update('core_paylog', array('plid' => $id), array('plid' => $log['plid']));
        pdo_query("ALTER TABLE " . tablename('core_paylog') . " auto_increment = " . ($id + 1) . ";");
        message("抱歉,发起支付失败,系统已经修复此问题,请重新尝试支付。");
    }
    message("抱歉,发起支付失败,具体原因为:“{$wOpt['errno']}:{$wOpt['message']}”。请及时联系站点管理员。");
    exit;
}
//print_r($wOpt);die();
?>
<script type="text/javascript">
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {