'seller_id' => '' //卖家商户号
);
ksort($parameter);
reset($parameter);
$param = '';
$sign = '';
foreach ($parameter AS $key => $val)
{
$param .= "$key=" .urlencode($val). "&";
if("" != $val && "sign" != $key) {
$sign .= "$key=$val&";
}
}
$param = substr($param, 0, -1);
$sign .= "key=".$payment['tenpay_key'];
$sign = strtolower(md5($sign));
$button = '<div style="text-align:center"><a
href="https://gw.tenpay.com/gateway/pay.htm?'.$param.
'&sign='.$sign.'"><button>立即使用财付通支付</button></a></div>';
return $button;
/* 清空购物车 */
require_once DEDEINC.'/shopcar.class.php';
$cart = new MemberShops();
$cart->clearItem();
$cart->MakeOrders();
return $button;
}
/**
* 响应操作
*/
function respond()
{
/* 引入配置文件 */
$code = preg_replace( "#[^0-9a-z-]#i", "", $_GET['code'] );
require_once DEDEDATA.'/payment/'.$code.'.php';
$attach = $_GET['attach'];
$trade_state = $_GET['trade_state'];
$total_fee = $_GET['total_fee'];
$out_trade_no = trim($_GET['out_trade_no']);
if(preg_match ("/S-P[0-9]+RN[0-9]/",$order_sn)) {
//检查支付金额是否相符
$row = $this->dsql->GetOne("SELECT * FROM ym_shops_orders WHERE oid = '{$order_sn}'");
if ($row['priceCount'] != $_GET['total_fee'])
{
return $msg = "支付失败,支付金额与商品总价不相符!";
}
$this->mid = $row['userid'];
/* 检查数字签名是否正确 */
ksort($_GET);
reset($_GET);
$sign = '';
foreach ($_GET AS $key => $val)
{