$alipay['account'] = trim($alipay['account']); $alipay['partner'] = trim($alipay['partner']); $alipay['secret'] = trim($alipay['secret']); $delivery = array_elements(array('switch'), $_GPC['delivery']); $delivery['switch'] = $delivery['switch'] == 'true'; if ($alipay['switch'] && (empty($alipay['account']) || empty($alipay['partner']) || empty($alipay['secret']))) { message('请输入完整的支付宝接口信息.'); } if ($_GPC['alipay']['t'] == 'true') { $params = array(); $params['tid'] = md5(uniqid()); $params['user'] = '******'; $params['fee'] = '0.01'; $params['title'] = '测试支付接口'; require model('payment'); $ret = alipay_build($params, $alipay); if ($ret['url']) { header("location: {$ret['url']}"); } exit; } $wechat = array_elements(array('switch', 'appid', 'secret', 'signkey', 'partner', 'key', 'version', 'mchid'), $_GPC['wechat']); $wechat['switch'] = $wechat['switch'] == 'true'; $wechat['signkey'] = trim($wechat['signkey']); $wechat['partner'] = trim($wechat['partner']); $wechat['key'] = trim($wechat['key']); if ($wechat['switch'] && (empty($wechat['appid']) || empty($wechat['secret']))) { message('请输入完整的微信支付接口信息.'); } $payment = $_W['account']['payment']; if (!is_array($payment)) {
message('系统错误, 请稍后重试.'); } } $ps = array(); $ps['tid'] = $log['plid']; $ps['uniontid'] = $log['uniontid']; $ps['user'] = $_W['fans']['from_user']; $ps['fee'] = $log['card_fee']; $ps['title'] = $params['title']; if ($type == 'alipay') { if (!empty($plid)) { pdo_update('core_paylog', array('openid' => $_W['member']['uid']), array('plid' => $plid)); } load()->model('payment'); load()->func('communication'); $ret = alipay_build($ps, $setting['payment']['alipay']); if ($ret['url']) { echo '<script type="text/javascript" src="../payment/alipay/ap.js"></script><script type="text/javascript">_AP.pay("' . $ret['url'] . '")</script>'; exit; } } if ($type == 'wechat') { if (!empty($plid)) { $tag = array(); $tag['acid'] = $_W['acid']; $tag['uid'] = $_W['member']['uid']; pdo_update('core_paylog', array('openid' => $_W['openid'], 'tag' => iserializer($tag)), array('plid' => $plid)); } load()->model('payment'); load()->func('communication'); $sl = base64_encode(json_encode($ps));
} } else { if ($log['type'] != $type) { $record = array(); $record['type'] = $type; pdo_update('paylog', $record, array('plid' => $log['plid'])); } } $ps = array(); $ps['tid'] = $log['plid']; $ps['user'] = $_W['fans']['from_user']; $ps['fee'] = $log['fee']; $ps['title'] = $params['title']; if ($type == 'alipay') { require_once model('payment'); $ret = alipay_build($ps, $_W['account']['payment']['alipay']); if ($ret['url']) { header("location: {$ret['url']}"); exit; } } if ($type == 'wechat') { require_once model('payment'); $sl = base64_encode(json_encode($ps)); $auth = sha1($sl . $_W['weid'] . $_W['config']['setting']['authkey']); header("location: ./payment/wechat/pay.php?weid={$_W['weid']}&auth={$auth}&ps={$sl}"); exit; } if ($type == 'credit2') { $pars = array(':from_user' => $_W['fans']['from_user'], ':weid' => $_W['weid']); $row = pdo_fetch("SELECT * FROM " . tablename('card_members') . " WHERE from_user = :from_user AND weid = :weid", $pars);