Пример #1
0
 $cfg['timediff'] = '0';
 $fr_time = time();
 define('FR_ROOT', str_replace("\\", '/', dirname(__FILE__)));
 define('CACHE_ROOT', $cfg['cache_dir'] ? $cfg['cache_dir'] : FR_ROOT . '/cache');
 define('DATA_ROOT', FR_ROOT . '/data');
 include '../mysql.class.php';
 $db = new db_mysql();
 $db->halt = $cfg['sqlerr'];
 $db->connect($dbconfig['DB_HOST'], $dbconfig['DB_USER'], $dbconfig['DB_PWD'], $dbconfig['DB_NAME'], 0);
 if ($_GET['trade_status'] == 'TRADE_FINISHED' || $_GET['trade_status'] == 'TRADE_SUCCESS') {
     //判断该笔订单是否在商户网站中已经做过处理
     //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
     //如果有做过处理,不执行商户的业务程序
     $inquery = "UPDATE `{$cfg['tb_pre']}member_operation` SET sta=1 WHERE buyid='" . $out_trade_no . "'";
     $db->query($inquery);
     $operation = $db->get_one("SELECT mid,`money`,pname  FROM `{$cfg['tb_pre']}member_operation`  where  buyid='" . $out_trade_no . "' ");
     $mid = $operation['mid'];
     $pname = $operation['pname'];
     $score = $operation['money'] * $infoconfig['cfg_recharge'];
     $inquery = "UPDATE `{$cfg['tb_pre']}member` SET scores=scores+" . $score . " WHERE mid='" . $mid . "'";
     $db->query($inquery);
     //insert log
     $inquery = "INSERT INTO  `{$cfg['tb_pre']}score_log`(mid,score,typeid,summary,addtime) VALUES('" . $mid . "','" . $score . "','4','" . $pname . "(" . $operation['money'] . ")'," . time() . ")  ";
     $db->query($inquery);
     echo "支付成功,请刷新付款页.";
 } else {
     echo "trade_status=" . $_GET['trade_status'];
     echo '支付失败,请联系管理员。';
 }
 //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////