123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- require_once("alipay.config.php");
- require_once("lib/alipay_notify.class.php");
- $alipayNotify = new AlipayNotify($alipay_config);
- $verify_result = $alipayNotify->verifyNotify();
- if($verify_result) {
-
-
-
-
-
-
-
-
-
- $out_trade_no = $_POST['out_trade_no'];
-
- $trade_no = $_POST['trade_no'];
-
- $trade_status = $_POST['trade_status'];
-
-
- $total_fee = (int)$_POST['total_fee'];
- if($_POST['trade_status'] == 'TRADE_FINISHED') {
-
-
-
-
-
-
-
-
-
-
- }
- else if ($_POST['trade_status'] == 'TRADE_SUCCESS') {
-
-
-
-
-
-
-
-
-
-
-
-
- $link = mysql_connect("127.0.0.1","","");
- if($link){
- mysql_select_db("",$link);
- mysql_query("set names utf8");
- $result = mysql_query("select * from cmf_user_charge where orderno='$out_trade_no' and money='$total_fee' and status='0' and type='1'");
- $row = mysql_fetch_assoc($result);
- $str = json_encode($row);
- if($row){
-
- mysql_query("update cmf_user set coin=coin+{$row['coin']} where id='$row[touid]'");
- mysql_query("update cmf_user_charge set status='1',trade_no='$trade_no' where id={$row['id']}");
-
- file_put_contents('./logali.txt',date('y-m-d h:i:s').' msg:'."支付成功:\r\n",FILE_APPEND);
-
- }else{
- file_put_contents('./logali.txt',date('y-m-d h:i:s').' msg:'."orderno:".$out_trade_no.' 订单信息不存在'."\r\n",FILE_APPEND);
- }
-
- }
-
-
- }
- echo "success";
-
-
- }
- else {
- file_put_contents('./logali.txt',date('y-m-d h:i:s').' msg:'.' 验证失败'."\r\n",FILE_APPEND);
-
- echo "fail";
-
-
- }
- ?>
|