www.gusucode.com > Destoon B2B仿淘宝电子商务网站 UTF8 v6.0源码程序 > destoon/api/pay/chinabank/notify.php
<?php $_SERVER['REQUEST_URI'] = ''; $_DPOST = $_POST; $_DGET = $_GET; require '../../../common.inc.php'; $_POST = $_DPOST; $_GET = $_DGET; if(!$_POST && !$_GET) exit('error'); $bank = 'chinabank'; $PAY = cache_read('pay.php'); if(!$PAY[$bank]['enable']) exit('error'); if(strlen($PAY[$bank]['keycode']) < 7) exit('error'); $key = $PAY[$bank]['keycode']; $v_oid =trim($_POST['v_oid']); $v_pmode =trim($_POST['v_pmode']); $v_pstatus =trim($_POST['v_pstatus']); $v_pstring =trim($_POST['v_pstring']); $v_amount =trim($_POST['v_amount']); $v_moneytype =trim($_POST['v_moneytype']); $remark1 =trim($_POST['remark1' ]); $remark2 =trim($_POST['remark2' ]); $v_md5str =trim($_POST['v_md5str' ]); $md5string = strtoupper(md5($v_oid.$v_pstatus.$v_amount.$v_moneytype.$key)); if($v_md5str == $md5string) { if($v_pstatus == "20") { $v_oid = intval($v_oid); $r = $db->get_one("SELECT * FROM {$DT_PRE}finance_charge WHERE itemid='$v_oid'"); if($r) { if($r['status'] == 0) { $charge_orderid = $r['itemid']; $charge_money = $r['amount'] + $r['fee']; $charge_amount = $r['amount']; $editor = 'N'.$bank; if($v_amount == $charge_money) { $db->query("UPDATE {$DT_PRE}finance_charge SET status=3,money=$charge_money,receivetime='$DT_TIME',editor='$editor' WHERE itemid=$charge_orderid"); require DT_ROOT.'/include/module.func.php'; money_add($r['username'], $r['amount']); money_record($r['username'], $r['amount'], $PAY[$bank]['name'], 'system', '在线充值', '流水号:'.$charge_orderid); $MOD = cache_read('module-2.php'); if($MOD['credit_charge'] > 0) { $credit = intval($r['amount']*$MOD['credit_charge']); if($credit > 0) { credit_add($r['username'], $credit); credit_record($r['username'], $credit, 'system', '充值奖励', '充值'.$r['amount'].$DT['money_unit']); } } exit('ok'); } else { $note = '充值金额不匹配S:'.$charge_money.'R:'.$v_amount; $db->query("UPDATE {$DT_PRE}finance_charge SET status=1,receivetime='$DT_TIME',editor='$editor',note='$note' WHERE itemid=$charge_orderid");//支付失败 log_write($note, 'nchinabank'); exit('error'); } } else if($r['status'] == 1) { exit('error'); } else if($r['status'] == 2) { exit('error'); } else { exit('ok'); } } else { log_write('通知订单号不存在R:'.$v_oid, 'nchinabank'); exit('error'); } } } exit('error'); ?>