Esempio n. 1
0
 if (empty($payment_notice)) {
     echo "订单不存在";
     exit;
 }
 if ($payment_notice['is_paid'] == 1) {
     echo "订单已经收款";
     exit;
 }
 $trade_no = $_REQUEST['transaction_id'];
 $out_trade_no = $payment_notice['notice_sn'];
 if ($wx_config['type'] == 'V2') {
     $request = $_REQUEST;
     $sign = $request['sign'];
     unset($request['order_id'], $request['sign']);
     ksort($request);
     if ($notify->md5_verifySignature($notify->formatBizQueryParaMap($request, false), $sign, $notify->trimString($wx_config['partnerkey']))) {
         $pay_result = $request['trade_state'];
         if ($pay_result == 0) {
             require_once APP_ROOT_PATH . "system/libs/cart.php";
             $rs = payment_paid($out_trade_no, $trade_no);
             if ($rs) {
                 $GLOBALS['db']->query("update " . DB_PREFIX . "payment_notice set outer_notice_sn = '" . $trade_no . "' where id = " . $payment_notice['id']);
             }
             echo "success";
             //此处应该更新一下订单状态,商户自行增删操作
             $log_->log_result($log_name, "【支付成功】:\n" . $xml . "\n");
         } else {
             echo 'fail';
             exit;
         }
     } else {