我是靠谱客的博主 重要御姐,最近开发中收集的这篇文章主要介绍6.0 增加京东支付,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

给系统(只适合版本6.0)增加京东支付,系统原本是没有京东支付,

1、先在met_pay_config表中,增加京东支付参数,7=京东支付

2、在系统中,浏览器在手机状态下增加京东支付

路径:appsystempaywebincludeclass      interface_pay.class.php

  public function get_pay_list() {
    global $_M;
		$return = array();
		$query = "SELECT * FROM {$_M['table'][pay_config]} WHERE name='payment_type' and lang='{$_M['lang']}'";
		$payment_type = DB::get_one($query);
		$list = explode('|', $payment_type['value']);
		$url = "{$_M['url']['site']}pay/app.php?paytype=";
		if($this->is_weixin()){//微信端
			if(strstr($payment_type['value'], '6')){
				$openId = $this->weixinopenId();
				$return['weixin_h5']['have'] = 1;
				$return['weixin_h5']['url'] = $url.'6';
				$return['weixin_h5']['check_url'] = "{$_M['url']['site']}pay/orderquery.php?paytype=1&out_trade_no=";
			}
			if(strstr($payment_type['value'], '3')){
				$return['alipay']['have'] = 1;
				$return['alipay']['url'] = $url.'3';
			}
		}else if($this->is_mobile()){//是移动端,就出现下面这些支付方式1
			if(strstr($payment_type['value'], '3')){
				$return['alipay']['have'] = 1;
				$return['alipay']['url'] = $url.'3';
			}

			if(strstr($payment_type['value'], '5')){
				$return['paypal']['have'] = 1;
				$return['paypal']['url'] = $url.'5';
			}
			
			if(strstr($payment_type['value'], '4')){
				$return['upay']['have'] = 1;
				$return['upay']['url'] = $url.'4';
			}
			
			if(strstr($payment_type['value'], '7')){//京东支付
				$return['jd']['have'] = 1;
				$return['jd']['url'] = $url.'7';
			}
			
//			if(strstr($payment_type['value'], '6')){//微信公众号支付
//				//$openId = $this->weixinopenId();
//				$return['weixin_h5']['have'] = 1;
//				$return['weixin_h5']['url'] = $url.'6';
//				$return['weixin_h5']['check_url'] = "{$_M['url']['site']}pay/orderquery.php?paytype=1&out_trade_no=";
//			}
			if(strstr($payment_type['value'], '9')){//微信H5支付
				//$out_trade_no=date('YmdHis').rand(1, 100000);
				$return['weixin_jspay']['have'] = 1;
				$return['weixin_jspay']['url'] = $url.'9';
				//$return['weixin_jspay']['check_url'] = "{$_M['url']['site']}pay/orderquery.php?paytype=9&out_trade_no=";
			}
			
		}else{//其它端,比如PC
			if(strstr($payment_type['value'], '1')){
				$return['weixin']['have'] = 1;
				$return['weixin']['url'] = $url.'1';
				$return['weixin']['check_url'] = "{$_M['url']['site']}pay/orderquery.php?paytype=1&out_trade_no=";
			}

			if(strstr($payment_type['value'], '2')){
				$return['tenpay']['have'] = 1;
				$return['tenpay']['url'] = $url.'2';
			}

			if(strstr($payment_type['value'], '3')){
				$return['alipay']['have'] = 1;
				$return['alipay']['url'] = $url.'3';
			}

			if(strstr($payment_type['value'], '5')){
				$return['paypal']['have'] = 1;
				$return['paypal']['url'] = $url.'5';
			}

			if(strstr($payment_type['value'], '4')){
				$return['upay']['have'] = 1;
				$return['upay']['url'] = $url.'4';
			}

			if(strstr($payment_type['value'], '7')){
				$return['jd']['have'] = 1;
				$return['jd']['url'] = $url.'7';
			}
		}
		return $return;
    }

3、在前端模块中增加京东支付链接

appappshopwebtemplatesmet      shop_pay_order.php

<!--
EOT;
}
if($pay_list['paypal']){
echo <<<EOT
-->
						<li class="text-xs-center pay-order-union" data-toggle="modal" data-target="#pay-order-modal">
							<a class="block cover pay-online" href="javascript:;" data-url="{$pay_list['paypal']['url']}" target="_blank"><img src="{$_M[url][shop_ui]}static/img/paypal.png" class='img-fluid inline-block'/></a>
						</li>
<!--
EOT;
}
if($pay_list['jd']){
echo <<<EOT
-->
						<li class="text-xs-center pay-order-union" data-toggle="modal" data-target="#pay-order-modal">
							<a class="block cover pay-online" href="javascript:;" data-url="{$pay_list['jd']['url']}" target="_blank"><img src="{$_M[url][shop_ui]}static/img/jd.png" class='img-fluid inline-block'/></a>
						</li>
<!--
EOT;
}
$disabled = $user_have_balance?'':' disabled';
$balanceinput = $user_have_balance?'data-target="#balanceinput"':'';
$hide = $user_have_balance?' hidden':'';
$validation=$user_have_balance?' class="met-form-validation"':'';

$price=substr($order[tprice_str], 0, -3);
echo <<<EOT
-->

4、支付的时候转到H5支付

appsystempayweb    app.class.php

5、增加京东支付  路径:appsystempaywebapp.class

            case 7://京东
                return $this->Payment_jd($date);
				break;

增加Payment_jd函数

    public function Payment_jd($date) {//京东支付
		
        $jd = load::mod_class('pay/web/jd.class.php', 'new');      
        $jd->jd($date);
    }

6、新增加jd.class.php类文件。路径在:appsystempayweb

<?php

defined('IN_MET') or exit('No permission');
ini_set('date.timezone','Asia/Shanghai');
require_once "jd/common/ConfigUtil.php";
require_once "jd/common/SignUtil.php";
require_once "jd/common/TDESUtil.php";
require_once "jd/action/CallBack.php";
//require_once "jd/action/AsynNotifyAction.php";
load::mod_class('pay/web/pay');
class jd extends pay {
    public $jdpay_config;
    public function __construct() {
        global $_M;
        parent::__construct();
		 //这些参数都只能是字符形式,不能是数字
         //$jd_config = jsondecode($_M['config']['jdpay_config']);
//		 $this->jdpay_config['jd_version']          = "V2.0";
//         $this->jdpay_config['jd_merchant']          = "11000002305";
//         $this->jdpay_config['jd_currency']          = "CNY";
//         $this->jdpay_config['jd_callbackUrl'] = "";//支付成功后跳转的URL
//         $this->jdpay_config['jd_notifyUrl']   = "";//支付完成后,异步通知商户相关支付结果,此url外网必须能够访问
//         $this->jdpay_config['jd_userId'] = "sh0000da@163.com";//京东登录帐号
//		 $this->jdpay_config['jd_orderType'] = "1";//订单类型 0-实物,1-虚拟
//		 $this->jdpay_config['jd_saveUrl_pc'] = "https://wepay.jd.com/jdpay/saveOrder";//PC端调用地址
//		 $this->jdpay_config['jd_saveUrl_wap'] = "https://h5pay.jd.com/jdpay/saveOrder";//H5端调用地址
    }
    
    /**
     * 订单参数提交
     */
    public function jd($date) {
        global $_M;
		
		$tools = new SignUtil();
		$tetls = new TDESUtil();
		//var_dump($_M[config]["met_weburl"]);die;
			
		$version  = "V2.0";// 版本号
        $merchant = "11000012005";// 商户编号
		$device="";//商户门店号
		$tradeNum=$date['out_trade_no'];//订单号  商户提供的唯一交易流水号(字母和数字)
		$tradeName=$date['subject'];//商户提供的订单的标题/商品名称/关键字等
		$tradeDesc=$date['body'];//商户提供的订单的具体描述信息
		$tradeTime=date('YmdHis');//订单生成时间,格式为“yyyyMMddHHmmss”
		//$amount = $date['total_fee'];// 订单金额,系统价格单位:元,京东是分
		$amount = $date['total_fee']*100;// 订单金额,系统价格单位:元,京东是分
		  $amount=strval($amount);//转为字符串
		$currency = "CNY";// 币种
		$note="";//商户备注
        $callbackUrl= $_M[config]["met_weburl"]."pay/return.php";// 支付成功后跳转的URL
        $notifyUrl= $_M[config]["met_weburl"]."pay/notify.php";// 支付完成后,异步通知商户相关支付结果,此url外网必须能够访问
		$ip="";
		$userType="";
		$userId="shfgdgd000a@163.com";//京东金融登录用户名
		$expireTime="";
		$orderType= "1";//订单类型 0-实物,1-虚拟  
		$industryCategoryCode="";
		$specCardNo="";
		$specId="";
		$specName="";
		
		$unSignKeyList = array ("sign");
		$desKey = "RvLc3GEfdgdgdf45454dfgdg12c2KGZ5h";//商户DES密钥
		
	//组成数组,用来验证
		$param["version"]=$version;
		$param["merchant"]=$merchant;
		$param["device"]=$device;
		$param["tradeNum"]=$tradeNum;
		$param["tradeName"]=$tradeName;
		$param["tradeDesc"]=$tradeDesc;
		$param["tradeTime"]= $tradeTime;
		$param["amount"]= $amount;
		$param["currency"]= $currency;
		$param["note"]= $note;
		
		$param["callbackUrl"]= $callbackUrl;
		$param["notifyUrl"]= $notifyUrl;
		$param["ip"]= $ip;
		$param["specCardNo"]= $specCardNo;
		$param["specId"]= $specId;
		$param["specName"]= $specName;
		$param["userType"]= $userType;
		$param["userId"]= $userId;
		$param["expireTime"]= $expireTime;
		$param["orderType"]= $orderType;
		$param["industryCategoryCode"]= $industryCategoryCode;
		
		
        
        $sign  = $tools->signWithoutToHex($param, $unSignKeyList);
		//$sign = SignUtil::signWithoutToHex($param, $unSignKeyList);
		//$sign = SignUtil::signWithoutToHex($param, $unSignKeyList);
		
		//var_dump($sign);die;
		$keys = base64_decode($desKey);
		
		if($device != null && $device!=""){
			//$device_1=TDESUtil::encrypt2HexStr($keys, $device);
			$device  = $tetls->encrypt2HexStr($keys, $device);
		}
		//$tradeNum_1=TDESUtil::encrypt2HexStr($keys, $tradeNum);
		$tradeNum=$tetls->encrypt2HexStr($keys, $tradeNum);
		
		if($tradeName != null && $tradeName!=""){
			//$tradeName_1=TDESUtil::encrypt2HexStr($keys, $tradeName);
			$tradeName  = $tetls->encrypt2HexStr($keys, $tradeName);
		}
		if($tradeDesc != null && $tradeDesc!=""){
			//$tradeDesc_1=TDESUtil::encrypt2HexStr($keys, $param["tradeDesc"]);
			$tradeDesc  = $tetls->encrypt2HexStr($keys, $tradeDesc);
		}
		$tradeTime=$tetls->encrypt2HexStr($keys, $tradeTime);
		$amount=$tetls->encrypt2HexStr($keys, $amount);
		$currency=$tetls->encrypt2HexStr($keys, $currency);
		$callbackUrl=$tetls->encrypt2HexStr($keys, $callbackUrl);
		$notifyUrl=$tetls->encrypt2HexStr($keys, $notifyUrl);
		$ip=$tetls->encrypt2HexStr($keys, $ip);
		
		if($note != null && $note!=""){
			$note  = $tetls->encrypt2HexStr($keys, $note);
		}
		if($userType != null && $userType!=""){
			$userType  = $tetls->encrypt2HexStr($keys, $userType);
		}
		if($userId != null && $userId!=""){
			$userId  = $tetls->encrypt2HexStr($keys, $userId);
		}
		if($expireTime != null && $expireTime!=""){
			$expireTime  = $tetls->encrypt2HexStr($keys, $expireTime);
		}
		if($orderType != null && $orderType!=""){
			$orderType  = $tetls->encrypt2HexStr($keys, $orderType);
		}
		if($industryCategoryCode != null && $industryCategoryCode!=""){
			$industryCategoryCode  = $tetls->encrypt2HexStr($keys, $industryCategoryCode);
		}
		if($specCardNo != null && $specCardNo!=""){
			$specCardNo  = $tetls->encrypt2HexStr($keys, $specCardNo);
		}
		if($specId != null && $specId!=""){
			$specId  = $tetls->encrypt2HexStr($keys, $specId);
		}
		if($specName != null && $specName!=""){
			$specName  = $tetls->encrypt2HexStr($keys, $specName);
		}

		//var_dump($tradeName_1);die;
		
		 
		$v_saveUrl_pc       = "https://wepay.jd.com/jdpay/saveOrder";//PC端调用地址
		$v_saveUrl_wap      = "https://h5pay.jd.com/jdpay/saveOrder";//H5端调用地址
		if(is_mobile()){//移动
			$surl=$v_saveUrl_wap;//form提交表单网址
		}else{
			$surl=$v_saveUrl_pc;//form提交表单网址
		}
        //$surl=$v_saveUrl_pc;//form提交表单网址
		
        echo "支付中,请等待....";
		echo "<body onload='autosubmit()'>";
		echo "<form action='".$surl."' method='post' id='batchForm'>";
				echo "<input type='hidden' name='version' value='".$version."'/>";
				echo "<input type='hidden' name='merchant' value='".$merchant."'/>";
				echo "<input type='hidden' name='device' value='".$device."'/>";
				echo "<input type='hidden' name='tradeNum' value='".$tradeNum."'/>";
				echo "<input type='hidden' name='tradeName' value='".$tradeName."'/>";
				echo "<input type='hidden' name='tradeDesc' value='".$tradeDesc."'/>";
				echo "<input type='hidden' name='tradeTime' value='".$tradeTime."'/>";
				echo "<input type='hidden' name='amount' value='".$amount."'/>";
				echo "<input type='hidden' name='currency' value='".$currency."'/>";
				echo "<input type='hidden' name='note' value='".$note."'/>";
				echo "<input type='hidden' name='callbackUrl' value='".$callbackUrl."'/>";
				echo "<input type='hidden' name='notifyUrl' value='".$notifyUrl."'/>";
				echo "<input type='hidden' name='ip' value='".$ip."'/>";
				echo "<input type='hidden' name='userType' value='".$userType."'/>";
				echo "<input type='hidden' name='userId' value='".$userId."'/>";
				echo "<input type='hidden' name='expireTime' value='".$expireTime."'/>";
				echo "<input type='hidden' name='orderType' value='".$orderType."'/>";
				echo "<input type='hidden' name='industryCategoryCode' value='".$industryCategoryCode."'/>";
				echo "<input type='hidden' name='specCardNo' value='".$specCardNo."'/>";
				echo "<input type='hidden' name='specId' value='".$specId."'/>";
				echo "<input type='hidden' name='specName' value='".$specName."'/>";
				echo "<input type='hidden' name='sign' value='".$sign."'/>";
		echo "</form>";
		
		    //自动提交表单
				echo "<script>";
				echo "function autosubmit(){";
				echo "document.getElementById('batchForm').submit();";
				echo "}";
				echo "</script>";
		
//        $PayUrl = $url.$fields_string;
//        header("Location:".$PayUrl);
        exit;
    }
    
    
    /*
     * 同步通知
     * PayPal同步通知即为账单支付验证确认方法
     */
    function doreturn($date) {
        global $_M;
		
		$tools = new CallBack();
		$param['tradeNum']=trim($_POST['tradeNum']); 
		$param['amount']=trim($_POST['amount']); 
		$param['currency']=trim($_POST['currency']); 
		$param['tradeTime']=trim($_POST['tradeTime']);
		$param['note']=trim($_POST['note']); 
		$param['status']=trim($_POST['status']);
		$param['sign']=trim($_POST['sign']); 

		
		$tatus  = $tools->execute($param);
		
//        $key            = $this->jdpay_config['jd_key'];                        // 商户密钥
//        
//        $v_oid          =trim($_POST['v_oid']);                                 // 商户发送的v_oid定单编号   
//        $v_pmode        =trim($_POST['v_pmode']);                               // 支付方式(字符串)   
//        $v_pstatus      =trim($_POST['v_pstatus']);                             // 支付状态 :20(支付成功);30(支付失败)
//        $v_pstring      =trim($_POST['v_pstring']);                             // 支付结果信息 : 支付完成(当v_pstatus=20时);失败原因(当v_pstatus=30时,字符串); 
//        $v_amount       =trim($_POST['v_amount']);                              // 订单实际支付金额
//        $v_moneytype    =trim($_POST['v_moneytype']);                           // 订单实际支付币种    
//        $remark1        =trim($_POST['remark1' ]);                              // 备注字段1
//        $remark2        =trim($_POST['remark2' ]);                              // 备注字段2
//        $v_md5str       =trim($_POST['v_md5str' ]);                             // 拼凑后的MD5校验值 
        
        /**
         * 重新计算md5的值
         */

        //$md5string=strtoupper(md5($v_oid.$v_pstatus.$v_amount.$v_moneytype.$key));
        
        if($tatus)
        {
            return TRUE;
        }
        else
        {
            return FALSE;
        }
    }
    
    /**
     * 异步通知验证
     */
    public function donotify($date) {
        global $_M;
		
		$tools = new AsynNotifyAction();
		$param['tradeNum']=trim($_POST['tradeNum']); 
		$param['amount']=trim($_POST['amount']); 
		$param['currency']=trim($_POST['currency']); 
		$param['tradeTime']=trim($_POST['tradeTime']);
		$param['note']=trim($_POST['note']); 
		$param['status']=trim($_POST['status']);
		$param['sign']=trim($_POST['sign']); 

		
		$tatus  = $tools->execute($param);
		
//        $key            = $this->jdpay_config['jd_key'];                        // 商户密钥
//        
//        $v_oid          =trim($_POST['v_oid']);                                 // 商户发送的v_oid定单编号   
//        $v_pmode        =trim($_POST['v_pmode']);                               // 支付方式(字符串)   
//        $v_pstatus      =trim($_POST['v_pstatus']);                             // 支付状态 :20(支付成功);30(支付失败)
//        $v_pstring      =trim($_POST['v_pstring']);                             // 支付结果信息 : 支付完成(当v_pstatus=20时);失败原因(当v_pstatus=30时,字符串); 
//        $v_amount       =trim($_POST['v_amount']);                              // 订单实际支付金额
//        $v_moneytype    =trim($_POST['v_moneytype']);                           // 订单实际支付币种    
//        $remark1        =trim($_POST['remark1' ]);                              // 备注字段1
//        $remark2        =trim($_POST['remark2' ]);                              // 备注字段2
//        $v_md5str       =trim($_POST['v_md5str' ]);                             // 拼凑后的MD5校验值 
//        
//        /**
//         * 重新计算md5的值
//         */
//
//        $md5string=strtoupper(md5($v_oid.$v_pstatus.$v_amount.$v_moneytype.$key));
        
        if($v_pstatus ==="20" && $v_md5str==$md5string)
        {
            return TRUE;
        }
        else
        {
            return FALSE;
        }
    }
}

?>

6、同步、异步通知   路径:appsystempaywebpay.class.php

6-1:同步通知 处理

		if($date['pay_type']==='7') {//京东支付
			//var_dump($date);
			//var_dump($date['callback_url']);
            if($status==="0") {//0-成功
                 var_dump($date['callback_url']);
					echo "支付成功!";
					//$url3=$_M[config]["met_weburl"]."shop/order.php?lang=cn&a=docheck&id=";
                    header("Location: {$date['callback_url']}");
                    die();
            }else{
                    require_once $return_url;

            }
        }

6-2:异步通知 处理

修改1

    /**
     * 异步通知 处理
     */
    public function donotify() {
        global $_M;
        //=======【微信异步通知验证】==========================
        $xml   = $GLOBALS['HTTP_RAW_POST_DATA'];
        if(!$xml){
        	$xml = file_get_contents("php://input");
			//$resultData = file_get_contents("php://input");//京东支付专用
        }
        $array = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
        if($array && $array['out_trade_no']) {
            $date = $this->GetOeder($array['out_trade_no']);
                 $this->doNotify_wxpay($date);
           
        }
		//=======【京东异步通知验证】==========================
		if($xml) {

				require_once "jd/common/TDESUtil.php";
			    $tetls = new TDESUtil();
			    require_once "jd/common/RSAUtils.php";
				$rstl = new RSAUtils();
			    require_once "jd/common/SignUtil.php";
				$tools = new SignUtil();
			    
			
				$resultXml = simplexml_load_string($xml);
				$resultObj = json_decode(json_encode($resultXml),TRUE);
				$encryptStr = $resultObj["encrypt"];
				$encryptStr=base64_decode($encryptStr);
				//$desKey = ConfigUtil::get_val_by_key("desKey");
				$desKey = "RvLc3Gfgdghg445fhfdgfdgfd11KGZ5h";//商户DES密钥
				$keys = base64_decode($desKey);
				//$reqBody = TDESUtil::decrypt4HexStr($keys, $encryptStr);
				$reqBody=$tetls->decrypt4HexStr($keys, $encryptStr);//3DES 解密 进行了补位的16进制表示的字符串数据

				$bodyXml = simplexml_load_string($reqBody);
				//echo "请求返回encrypt Des解密后:".$bodyXml->saveXML()."n";
				$resData = json_decode(json_encode($bodyXml),TRUE);

				$inputSign = $resData["sign"];
					$inputSign2 = $resData["sign"];

				$startIndex = strpos($reqBody,"<sign>");
				$endIndex = strpos($reqBody,"</sign>");
				$xml2;

				if($startIndex!=false && $endIndex!=false){
					$xmls = substr($reqBody, 0,$startIndex);
					$xmle = substr($reqBody,$endIndex+7,strlen($reqBody));
					$xml2=$xmls.$xmle;
				}

				//echo "本地摘要原串:".$xml."n";
				$sha256SourceSignString = hash("sha256", $xml2);
				//echo "本地摘要:".$sha256SourceSignString."n";

				//$decryptStr = RSAUtils::decryptByPublicKey($inputSign);
				 $decryptStr=$rstl->decryptByPublicKey($inputSign);
				//echo "解密后摘要:".$decryptStr."n";
				$flag;
				$array2 = json_decode(json_encode(simplexml_load_string($xml2, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
			//通过订单号取得参数,然后生成sign,再对返回的SIGN作对比,相等证明数据正确
			    $tradeNum =$array2['tradeNum'];
			    $merchant =$array2['merchant'];
			    $desc=$array2['result']['desc'];//<code>000000</code><desc>success</desc>
                $amount1 =$array2['amount'];
			    $status =$array2['status'];//=2 成功
			      //判断价格是否整数,如果是,要补两零,因为系统保存价格是保存两位小数的
			       $amount2 = explode('.',$amount1);
					if(!$amount2[1]){
						$amount=$amount1.".00";
					}else{
						$amount=$amount1;
					}
			    
			    $date5 = $this->GetOeder($tradeNum);
			    $total_fee =$date5['total_fee']*100;//京东价格单位分,在转到京东支付的时候,价格已经*100,所以也要*100才能相等
			    $ss=$merchant.",".$desc.",".$amount.",".$total_fee.",".$status;
//			      if($tradeNum){
//			           $date5 = $this->GetOeder($out_trade_no);
//						$unSignKeyList = array ("sign");		
//					//组成数组,用来验证
//						$param["version"]="V2.0";
//						$param["merchant"]="110263145005";
//						$param["device"]="";
//						$param["tradeNum"]=$tradeNum;
//						$param["tradeName"]=$date5['subject'];
//						$param["tradeDesc"]=$date5['body'];
//						$param["tradeTime"]= $array2['tradeTime'];
//						$param["amount"]= $date5['total_fee'];
//						$param["currency"]= "CNY";
//						$param["note"]= "";
//
//						$param["callbackUrl"]= $_M[config]["met_weburl"]."pay/return.php";// 支付成功后跳转的URL
//						$param["notifyUrl"]= $_M[config]["met_weburl"]."pay/notify.php";// 支付完成后,异步通知商户相关支付结果,此url外网必须能够访问
//						$param["ip"]= "";
//						$param["specCardNo"]= "";
//						$param["specId"]= "";
//						$param["specName"]= "";
//						$param["userType"]= "";
//						$param["userId"]= "shidehaoda@163.com";//京东金融登录用户名
//						$param["expireTime"]= "";
//						$param["orderType"]= "1";//订单类型 0-实物,1-虚拟  
//						$param["industryCategoryCode"]=  "";
//
//						$sign5  = $tools->signWithoutToHex($param, $unSignKeyList); 
//				  }
			
				 if($array2['version']=="V2.0" && $merchant=="11045541221005" && $desc=="success" && $amount==$total_fee && $status=='2'){
				//if($decryptStr==$sha256SourceSignString){
						//$tradeNum2="1,".$array2['tradeNum'];
						//$query8    = "UPDATE {$_M['table']['product_note']} SET content='$ss' WHERE id=255";
						//DB::query($query8);
					//echo "验签成功<br/>";
					$flag=true;
				}else{
//						//$tradeNum2=$decryptStr.",|,".$inputSign2.",|,".$sign5.",|,".$sha256SourceSignString;
//					    $tradeNum2=$version.",|,".$array2['merchant'].",|,".$array2['desc'].",|,".$array2['amount'].",|,".$date5['total_fee'];
//						$query8    = "UPDATE {$_M['table']['product_note']} SET content='$ss' WHERE id=255";
//						DB::query($query8);
					//echo "验签失败<br/>";
					$flag=false;
				}
			   
			   

		}

修改二

            if($date['pay_type'] === '7') {
                $this->doNotify_jd($date,$flag);
            }

修改3

    public function doNotify_jd($date,$flag) {
		if($date['out_trade_no'] && $flag){
			$this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
			return "success";
		}else{
			return "失败";
		}

整个pay.class.php文件代码

<?php 
defined('IN_MET') or exit('No permission');
/**
 * 支付基类
 * 集成支付:微信、财付通、支付宝、网银、PayPal
 */
ini_set('date.timezone','Asia/Shanghai');
load::sys_class('web');
load::sys_func('admin');
load::sys_func('str');
load::sys_func('array');
class pay extends web{

    protected $uid;
    public function __construct() {
        global $_M;
        //定义一些可以预定义的变量值
        parent::__construct();
        $this->uid = get_met_cookie('id') ? : 0;
    }
    
    /**
     * 购物车订单提交入口
     */
    public function doindex(){
        global $_M;

		// $this->check();
       $date = array(
            'body'          =>  $_M['form']['body'],                              //商品描述
            'subject'       =>  $_M['form']['subject'],                           //商品名称
            'out_trade_no'  =>  $_M['form']['out_trade_no'],                      //订单编号
            'attach'        =>  $_M['form']['attach'],                            //附加数据
            'goods_tag'     =>  $_M['form']['goods_tag'],                         //商品标记
            'product_id'    =>  $_M['form']['product_id'],                        //产品编号
            'total_fee'     =>  $_M['form']['total_fee'],                         //订单金额
            'no'            =>  $_M['form']['no'] ? : '1111111111'  //调用接口的应用编号(存在于applist)
        );
        if($date['out_trade_no'] && $date['total_fee'] && $date['subject']) {
            $this->CreateOrder($date);                                          //创建账单 存储订单信息到数据库
            $title = '选择在线支付方式';
            $paymentlist = $this->GetPaymentList();                             //获取处于开启状态的支付接口
            if(in_array('7', $paymentlist))
            {
                $bank_array = load::mod_class('pay/web/include/class/china_bank', 'new')->bank_array();
                /*
                 * 收款支付类型
                 * 1|储蓄卡
                 * 2|信用卡
                 */
                $jd_payment_type = jsondecode($_M['config']['jdpay_config']);
                $jd_payment_type = explode('|', $jd_payment_type['jd_payment_type']);

                
            }
            require_once $this->template('own/index');
        }else{
            echo "<script type="text/javascript">alert("订单参数异常!请重新下单");location.href="{$_M['url']['site']}member"</script>";
        }
		
    }
    /**
     * 订单支付跳转
     */
    public function dopay() {
        global $_M;
        $out_trade_no = $_M['form']['out_trade_no'];
        $type         = $_M['form']['paytype']?$_M['form']['paytype']:(empty($_GET["code"])?'':'6');
        $date         = $this->GetOeder($out_trade_no);
        $status       = $this->CheckOrderPayStatus($out_trade_no);
        $paymentlist  = $this->GetPaymentList();                                //获取处于开启状态的支付接口
        //Paypal回调参数
        if(!$_M['form']['paytype'] && !empty($_GET["token"]) && !empty($_GET["PayerID"])) { $type = '5'; }
        //if(!$_M['form']['paytype'] && !empty($_GET["PayerID"])) { $type = '5'; }

        //京东网银在线
        if(is_numeric($type) && $type > 7)
        {
            $banklist_cash = jsondecode($_M['config']['jdpay_config']);
            $banklist_cash   = explode("|", $banklist_cash['banklist_cash']);
            $banklist_credit = jsondecode($_M['config']['jdpay_config']);
            $banklist_credit = explode("|", $banklist_credit['banklist_credit']);
            if(in_array($type, $banklist_cash) || in_array($type, $banklist_credit))
            {
                $date['bank'] = $type;                                          //选择的银行编码$_M['form']['paytype']:
                $type = '7';
            }
        }
        if(!$this->GetPayOpen()) {
            //获取接口开关状态,关闭时直接跳转至网站首页
            echo "<script type="text/javascript">alert("未开启支付接口,请联系网站管理员。");location.href="{$_M['url']['site']}"</script>"; 
            //header("Location:{$_M['url']['site']}member");
        } else if(!$out_trade_no && $type != '6' && $type != '5') {
            var_dump($_REQUEST);
            die();
            echo "<script type="text/javascript">alert("订单异常,请重新下单支付!");location.href="{$_M['url']['site']}member"</script>";
            //header("Location:{$_M['url']['site']}member");
        } else if(!$status && in_array($type, $paymentlist)) {                  //检测订单支付状态,并检测传入支付方式开启状态
            $this->UpadteOrderPaymentType($type, $out_trade_no);                //更新订单支付类型
            switch ($type) {
                case 1://微信扫码支付
                    $wxpay     = load::mod_class('pay/web/wxpay.class.php', 'new'); //加载微信支付处理类
                    $code_url  = $wxpay->wxpay($date);                          //调用微信支付接口
                    require_once $this->template('own/wxpay');
                    break;
                case 2://财付通支付tenpay
                    $tenpay   = load::mod_class('pay/web/tenpay.class.php', 'new'); //加载财付通支付处理类
                    $code_url = $tenpay->tenpay($date);                         //调用财付通支付接口
                    break;
                case 3://支付宝支付
                    $alipay = load::mod_class('pay/web/alipay.class.php', 'new');   //加载支付宝支付处理类
                    $alipay->alipay($date);                                     //调用支付宝支付接口
                    break;
                case 4://网银支付
                    $unionpay = load::mod_class('pay/web/unionpay.class.php', 'new');  //加载银联支付处理类
                    $unionpay->unionpay($date);                                 //调用银联支付接口
                    break;
                case 5://PayPal支付
                    $paypal = load::mod_class('pay/web/paypal.class.php', 'new');   //加载PayPal支付处理类
                    //没有 PayreID
                    if(!$_GET['PayerID']){
                        $paypal->paypal($date);                                 //调用paypal支付接口
                    }else{
                        $paypal->ConfirmPayment();
                    }
                    break;
                case 6://微信H5-JsApiPay支付
                    $wxpay     = load::mod_class('pay/web/wxpay.class.php', 'new'); //加载微信支付处理类
                    if($_GET['code']){
                        session_start();
                        $date           = $_SESSION["temp"];
                        $date['openId'] = $wxpay->GetOpen_ID();
                        $return         = $wxpay->JsApiPay($date);              //调用微信支付接口
                        require_once $this->template('own/jsapi');
                    }else{
                        //session 存储订单信息,备用
                        session_start();
                        $_SESSION["temp"] = $date;
                        $wxpay->GetOpen_ID();
                    }
                    break;
                case 7://网银在线支付
                    $chinabank = load::mod_class('pay/web/chinabank.class.php', 'new');//加载网银在线支付处理类
                    $chinabank->chinabank($date);                                  //调用网银在线支付接口
                    break;
                default:
                    break;
            }
        } else {
            // echo "<script type="text/javascript">alert("非法操作!");location.href="{$_M['url']['site']}member"</script>";
        }
    }
    
    /**
     * 订单查询
     */
    public function doquery() {
        global $_M;
        $pay_type = $_M['form']['paytype'];
        switch ($pay_type) {
            case 1://微信订单查询
                $wxpay  = load::mod_class('pay/web/wxpay.class.php', 'new');
                $pay    = $wxpay->wxpayQuery();
				echo json_encode($pay);
                break;
            case 2://财付通订单查询
                $pay = $this->tenpayQuery(); 
                break;
            case 3://支付宝订单查询
                $pay = $this->alipayQuery(); 
                break;
            case 4://网银订单查询
                $pay = $this->unionpayQuery(); 
                break;
            case 5://PayPal订单查询
                $pay = $this->paypalQuery(); 
                break;
            default:
                break;
        }
    }
    
    /**
     * 创建订单存储至数据库
     */
    public function CreateOrder($date) {
        global $_M;
        //根据订单号进行重复订单查询
        if(!$order = $this->GetOeder($date['out_trade_no'])) {//订单不存在且订单数据不为空时进行订单信息存储,并返回订单号
            $date['order_time']   = date("YmdHis");
            $query = "INSERT INTO {$_M['table']['pay_order']} SET no={$date['no']},callback_url='{$date['return_url']}',out_trade_no='{$date['out_trade_no']}',subject='{$date['subject']}',product_id='{$date['product_id']}',body='{$date['body']}',goods_tag='{$date['goods_tag']}',attach='{$date['attach']}',show_url='{$date['show_url']}',total_fee='{$date['total_fee']}',order_time='{$date['order_time']}',pay_time='',pay_type='',callback='0',status='0',uid={$this->uid}";
           if(DB::query($query)){
                return DB::insert_id();
           }else{
                return false;
           }
        }
    }
    /**
     * 异步通知 处理
     */
    public function donotify() {
        global $_M;
        //=======【微信异步通知验证】==========================
        $xml   = $GLOBALS['HTTP_RAW_POST_DATA'];
        if(!$xml){
        	$xml = file_get_contents("php://input");
			//$resultData = file_get_contents("php://input");//京东支付专用
        }
        $array = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
        if($array && $array['out_trade_no']) {
            $date = $this->GetOeder($array['out_trade_no']);
                 $this->doNotify_wxpay($date);
           
        }
		//=======【京东异步通知验证】==========================
		if($xml) {

				require_once "jd/common/TDESUtil.php";
			    $tetls = new TDESUtil();
			    require_once "jd/common/RSAUtils.php";
				$rstl = new RSAUtils();
			    require_once "jd/common/SignUtil.php";
				$tools = new SignUtil();
			    
			
				$resultXml = simplexml_load_string($xml);
				$resultObj = json_decode(json_encode($resultXml),TRUE);
				$encryptStr = $resultObj["encrypt"];
				$encryptStr=base64_decode($encryptStr);
				//$desKey = ConfigUtil::get_val_by_key("desKey");
				$desKey = "RvLc3fd54454fdsfs45452KGZ5h";//商户DES密钥
				$keys = base64_decode($desKey);
				//$reqBody = TDESUtil::decrypt4HexStr($keys, $encryptStr);
				$reqBody=$tetls->decrypt4HexStr($keys, $encryptStr);//3DES 解密 进行了补位的16进制表示的字符串数据

				$bodyXml = simplexml_load_string($reqBody);
				//echo "请求返回encrypt Des解密后:".$bodyXml->saveXML()."n";
				$resData = json_decode(json_encode($bodyXml),TRUE);

				$inputSign = $resData["sign"];
					$inputSign2 = $resData["sign"];

				$startIndex = strpos($reqBody,"<sign>");
				$endIndex = strpos($reqBody,"</sign>");
				$xml2;

				if($startIndex!=false && $endIndex!=false){
					$xmls = substr($reqBody, 0,$startIndex);
					$xmle = substr($reqBody,$endIndex+7,strlen($reqBody));
					$xml2=$xmls.$xmle;
				}

				//echo "本地摘要原串:".$xml."n";
				$sha256SourceSignString = hash("sha256", $xml2);
				//echo "本地摘要:".$sha256SourceSignString."n";

				//$decryptStr = RSAUtils::decryptByPublicKey($inputSign);
				 $decryptStr=$rstl->decryptByPublicKey($inputSign);
				//echo "解密后摘要:".$decryptStr."n";
				$flag;
				$array2 = json_decode(json_encode(simplexml_load_string($xml2, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
			//通过订单号取得参数,然后生成sign,再对返回的SIGN作对比,相等证明数据正确
			    $tradeNum =$array2['tradeNum'];
			    $merchant =$array2['merchant'];
			    $desc=$array2['result']['desc'];//<code>000000</code><desc>success</desc>
                $amount1 =$array2['amount'];
			    $status =$array2['status'];//=2 成功
			      //判断价格是否整数,如果是,要补两零,因为系统保存价格是保存两位小数的
			       $amount2 = explode('.',$amount1);
					if(!$amount2[1]){
						$amount=$amount1.".00";
					}else{
						$amount=$amount1;
					}
			    
			    $date5 = $this->GetOeder($tradeNum);
			    $total_fee =$date5['total_fee']*100;//京东价格单位分,在转到京东支付的时候,价格已经*100,所以也要*100才能相等
			    $ss=$merchant.",".$desc.",".$amount.",".$total_fee.",".$status;
//			      if($tradeNum){
//			           $date5 = $this->GetOeder($out_trade_no);
//						$unSignKeyList = array ("sign");		
//					//组成数组,用来验证
//						$param["version"]="V2.0";
//						$param["merchant"]="110545454005";
//						$param["device"]="";
//						$param["tradeNum"]=$tradeNum;
//						$param["tradeName"]=$date5['subject'];
//						$param["tradeDesc"]=$date5['body'];
//						$param["tradeTime"]= $array2['tradeTime'];
//						$param["amount"]= $date5['total_fee'];
//						$param["currency"]= "CNY";
//						$param["note"]= "";
//
//						$param["callbackUrl"]= $_M[config]["met_weburl"]."pay/return.php";// 支付成功后跳转的URL
//						$param["notifyUrl"]= $_M[config]["met_weburl"]."pay/notify.php";// 支付完成后,异步通知商户相关支付结果,此url外网必须能够访问
//						$param["ip"]= "";
//						$param["specCardNo"]= "";
//						$param["specId"]= "";
//						$param["specName"]= "";
//						$param["userType"]= "";
//						$param["userId"]= "s55455454@163.com";//京东金融登录用户名
//						$param["expireTime"]= "";
//						$param["orderType"]= "1";//订单类型 0-实物,1-虚拟  
//						$param["industryCategoryCode"]=  "";
//
//						$sign5  = $tools->signWithoutToHex($param, $unSignKeyList); 
//				  }
			
				 if($array2['version']=="V2.0" && $merchant=="110440005" && $desc=="success" && $amount==$total_fee && $status=='2'){
				//if($decryptStr==$sha256SourceSignString){
						//$tradeNum2="1,".$array2['tradeNum'];
						//$query8    = "UPDATE {$_M['table']['product_note']} SET content='$ss' WHERE id=255";
						//DB::query($query8);
					//echo "验签成功<br/>";
					$flag=true;
				}else{
//						//$tradeNum2=$decryptStr.",|,".$inputSign2.",|,".$sign5.",|,".$sha256SourceSignString;
//					    $tradeNum2=$version.",|,".$array2['merchant'].",|,".$array2['desc'].",|,".$array2['amount'].",|,".$date5['total_fee'];
//						$query8    = "UPDATE {$_M['table']['product_note']} SET content='$ss' WHERE id=255";
//						DB::query($query8);
					//echo "验签失败<br/>";
					$flag=false;
				}
			   
			   

		}

				//$query9    = "UPDATE {$_M['table']['product_note']} SET content='{$ss}' WHERE id=256";
				//DB::query($query9);

        $out_trade_no = $_M['form']['out_trade_no'] ? : $_POST['orderId'];
        if($_POST['remark1' ])
        {
            $out_trade_no = trim($_POST['remark1']);
        }
		//=京东支付
		if($tradeNum){
			$out_trade_no=$tradeNum;
		}
        if($out_trade_no) {
            $date = $this->GetOeder($out_trade_no);
            //=======【支付宝异步通知验证】==========================
            if($date['pay_type'] === '3') {
                $this->doNotify_alipay($date);
            }
            //=======【银联异步通知验证】==========================
            if($date['pay_type'] === '4') {
                $this->doNotify_unionpay($date);
            }

            //=======【财付通异步通知验证】==========================
            if($date['pay_type'] === '2') {
                $this->doNotify_tenpay($date);
            }
            //=======【网银在线异步通知验证】==========================
//            if($date['pay_type'] === '7') {
//                $this->doNotify_chinabank($date);
//            }
            if($date['pay_type'] === '7') {
                $this->doNotify_jd($date,$flag);
            }
			
            //=======【paypal支付验证】 by:rabbbbit 20171103===============
            if($date['pay_type'] === '5') {
                $this->doNotify_paypal($date);
            }
        }
    }
    
    public function doNotify_wxpay($date) {
        $wxpay = load::mod_class('pay/web/wxpay.class.php', 'new');
        if($wxpay->donotify($date['out_trade_no'])) {                           //异步通知验证
            $this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
        }
    }
    public function doNotify_alipay($date) {
        global $_M;
        $alipay = load::mod_class('pay/web/alipay.class.php', 'new');
        //异步通知验证
        if($alipay->donotify()&&!$date['status']&&($_M['form']['trade_status']==='TRADE_SUCCESS'||$_M['form']['trade_status']==='TRADE_FINISHED')) {
            $this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
        }
    }
    public function doNotify_unionpay($date) {
        $unionpay = load::mod_class('pay/web/unionpay.class.php', 'new');   //同步通知验证
        if($unionpay->donotify($date)) {
            $this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
        }
    }

     public function doNotify_tenpay($date) {
        $tenpay = load::mod_class('pay/web/tenpay.class.php', 'new');               //异步通知验证
        if($tenpay->donotify($date)) {
            $this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
        }
    }
	//京东支付
//    public function doNotify_chinabank($date) {
//        $chinabank = load::mod_class('pay/web/chinabank.class.php', 'new');               //异步通知验证
//        if($chinabank->donotify($date)) {
//            $this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
//        }
//    }
    public function doNotify_jd($date,$flag) {
		if($date['out_trade_no'] && $flag){
			$this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
			return "success";
		}else{
			return "失败";
		}
//        $jd = load::mod_class('pay/web/jd.class.php', 'new');               //异步通知验证
//        if($jd->donotify($date)) {
//            $this->UpadteOrder($date['pay_type'],$date['out_trade_no']);
//        }
    }
	
	
    public function doNotify_paypal($date){
        global $_M;
        $this->UpadteOrder($date['pay_type'],$date['out_trade_no']);        //paypal同步通知
        header("Location:{$_M['url']['site']}shop/order.php");
    }



    /**
     * 同步通知 处理
     */
    public function doreturn() {
        global $_M;
        $out_trade_no = $_M['form']['out_trade_no'] ? : ($_POST['orderId']?:($_POST['remark1']?trim($_POST['remark1']):''));
		
		//京东支付
			$tradeNum=trim($_POST['tradeNum']);//交易流水号 京东支付  商户唯一交易流水号。格式:字母&数字
			if($tradeNum){
				require_once "jd/common/TDESUtil.php";
				$tetls = new TDESUtil();
				$desKey = "RvLc3G45gfdgdg5454542KGZ5h";//商户DES密钥
				$keys = base64_decode($desKey);
				$out_trade_no=$tetls->decrypt4HexStr($keys, $tradeNum);//3DES 解密 进行了补位的16进制表示的字符串数据
				$amount=$tetls->decrypt4HexStr($keys,trim($_POST['amount']));
				$currency=$tetls->decrypt4HexStr($keys,trim($_POST['currency']));
				$tradeTime=$tetls->decrypt4HexStr($keys,trim($_POST['tradeTime']));
				$note=$tetls->decrypt4HexStr($keys,trim($_POST['note']));
				$status=$tetls->decrypt4HexStr($keys,trim($_POST['status']));
				$sign=trim($_POST['sign']); 
				
				//$out_trade_no = $tradeNum;
			}
		var_dump($status);
		
        $date         = $this->GetOeder($out_trade_no);
		//var_dump($date['pay_type']);
        //var_dump($date);die;
		
        $title        = '订单支付成功';
        $this->UpadteOrderReturnType($out_trade_no);                            //接收到同步通知后根据订单号更改【同步通知】状态
        $return_url   = $date['callback_url']?:$this->template('own/return');
                //获取自定义同步通知返回地址,为自定义则使用默认地址
        if($date['pay_type']==='1' || $date['pay_type']==='6') {
            $wxpay = load::mod_class('pay/web/wxpay.class.php', 'new');
            if($wxpay->OrderQuery($out_trade_no)) {
				if($date['callback_url']){
					header("Location: {$date['callback_url']}");
					die();
				}else{
					require_once $return_url;
				}
            }
        }
        if($date['pay_type'] === '3' && $_M['form']['total_fee'] === $date['total_fee']) {
			
			//var_dmup($date);die;
            $alipay = load::mod_class('pay/web/alipay.class.php', 'new');           //同步通知验证
            if($alipay->doreturn()&&($_GET['trade_status']==='TRADE_SUCCESS'||$_GET['trade_status']==='TRADE_FINISHED')) {
				if($date['callback_url']){
					header("Location: {$date['callback_url']}");
					die();
				}else{
					require_once $return_url;
				}
            }
        }
        if($date['pay_type']==='4') {
            $unionpay = load::mod_class('pay/web/unionpay.class.php', 'new');       //同步通知验证
            if($unionpay->donotify($date)) {
                if($date['callback_url']){
					header("Location: {$date['callback_url']}");
					die();
				}else{
					require_once $return_url;
				}
            }
        }

         if($date['pay_type']==='2') {
            $unionpay = load::mod_class('pay/web/tempay.class.php', 'new');         //同步通知验证
            if($unionpay->doreturn($date)) {
                if($date['callback_url']){
                    header("Location: {$date['callback_url']}");
                    die();
                }else{
                    require_once $return_url;
                }
            }
        }
        if($date['pay_type']==='5') {
            $paypal = load::mod_class('pay/web/paypal.class.php', 'new');           //同步通知验证
             
            if($_GET['token'])
            {
                //if($paypal->doreturn($_GET['token'])) {
                $payerid = $paypal->doreturn($_GET['token']);
                if($payerid) {
                       if($date['callback_url']){
                    header("Location: {$date['callback_url']}.PayerID={$payerid}");
                    die();
                    }else{
                        require_once $return_url;
                    }
                }
            }
        }
//        if($date['pay_type']==='7') {
//            $chinabank = load::mod_class('pay/web/chinabank.class.php', 'new');           //同步通知验证
//            if($chinabank->doreturn($date)) {
//                if($date['callback_url']){
//                    header("Location: {$date['callback_url']}");
//                    die();
//                }else{
//                    require_once $return_url;
//                }
//            }
//        }
		if($date['pay_type']==='7') {//京东支付
			//var_dump($date);
			//var_dump($date['callback_url']);
            if($status==="0") {//0-成功
                 var_dump($date['callback_url']);
					echo "支付成功!";
					//$url3=$_M[config]["met_weburl"]."shop/order.php?lang=cn&a=docheck&id=";
                    header("Location: {$date['callback_url']}");
                    die();
            }else{
                    require_once $return_url;

            }
        }
    }
    /**
     * 根据订单号out_trade_no更新订单【支付状态】
     */
    public function UpadteOrder($pay_type,$out_trade_no) {
        global $_M;
        $pay_time = date("YmdHis");
        $query    = "UPDATE {$_M['table']['pay_order']} SET pay_time='{$pay_time}',pay_type='{$pay_type}',status='1' WHERE out_trade_no='{$out_trade_no}'";
        DB::query($query);
       
        $this->toapp($out_trade_no);
    }
	
    public function toapp($out_trade_no) {	
        global $_M;
        $query = "SELECT * FROM {$_M['table']['pay_order']} WHERE out_trade_no='{$out_trade_no}'";
        $pay   = DB::get_one($query);

        load::plugin('dopay', 0, array('pay'=>$pay));//加载插件
        
    }
	
    /**
     * 根据订单号out_trade_no更新订单【开始时间】、【支付类型】
     */
    public function UpadteOrderPaymentType($pay_type,$out_trade_no) {
        global $_M;
        $pay_time = date("YmdHis");
        $query    = "UPDATE {$_M['table']['pay_order']} SET pay_time='{$pay_time}',pay_type='{$pay_type}' WHERE out_trade_no='{$out_trade_no}'";
        DB::query($query);
    }
    /**
     * 根据订单号out_trade_no更新订单【同步通知状态】
     * 1|已接收到通知
     * 0|默认为未接收到通知
     */
    public function UpadteOrderReturnType($out_trade_no) {
        global $_M;
        $query    = "UPDATE {$_M['table']['pay_order']} SET callback='1' WHERE out_trade_no='{$out_trade_no}' AND uid={$this->uid}";
        DB::query($query);
    }
    /**
     * 根据订单号out_trade_no获取订单支付状态
	 *  TRUE|已支付
	 * FALSE|未支付
     */
    public function CheckOrderPayStatus($out_trade_no) {
        $order = $this->GetOeder($out_trade_no);
        if($order['status']) {
            return TRUE;
        } else {
            return FALSE;
        }
    }
    /**
     * 根据out_trade_no查询订单
     * 返回订单信息
     */
    public function GetOeder($out_trade_no) {
        global $_M;
		
        if($out_trade_no) {
            $query = "SELECT * FROM {$_M['table']['pay_order']} WHERE out_trade_no='{$out_trade_no}' ";
            $array = DB::get_one($query);
			//var_dump($array);die;
            return $array;
        } else {
            return FALSE;
        }
    }
    /**
     * 根据接口类型获取接口参数
     */
    public function GetAPI($type, $name) {
        global $_M;
        if($type&&$name) {
            $table = $_M['config']['tablepre'].'pay_api';
            $query = "SELECT value FROM {$table} WHERE name='{$name}'AND paytype='{$type}';";
            $arr   = DB::get_one($query);
            $value = $arr['value'];
        }else{
            $value = 'Fail!';
        }
        return $value;
    }
    /**
     * 获取接口开关
     */
    public function GetPayOpen() {
        global $_M;
        $table = $_M['config']['tablepre'].'pay_config';
        $query = "SELECT value FROM {$table} WHERE name='payment_open'";
        $arr   = DB::get_one($query);
        $value = $arr['value'];
        return $value;
    }
    /**
     * 获取已开启的支付接口
     */
    public function GetPaymentList() {
        global $_M;
        $table = $_M['config']['tablepre'].'pay_config';
        $query = "SELECT value FROM {$table} WHERE name='payment_type'";
        $arr   = DB::get_one($query);
        $value = stringto_array($arr['value'],'|');
        return $value;
    }
    protected function template($path){
        global $_M;
        list($postion, $file) = explode('/',$path);
        if ($postion == 'own') {
            return PATH_OWN_FILE."templates/met/{$file}.php";
        }
        if ($postion == 'ui') {
            return PATH_SYS."include/public/ui/web/{$file}.php";
        }
        if($postion == 'tem'){
            if($_M['custom_template']['sys_content']){
                $flag = 1;
            }else{
                $flag = 0;
            }
            if (file_exists(PATH_TEM."pay/{$file}.php")) {
                $_M['custom_template']['sys_content'] = PATH_TEM."pay/{$file}.php";
            }else{	
                if (file_exists(PATH_SYS."web/pay/templates/met/{$file}.php")) {
                    $_M['custom_template']['sys_content'] = PATH_SYS."web/pay/templates/met/{$file}.php";
                }
            }
            if($flag == 1){
                return $_M['custom_template']['sys_content'];
            }else{
                return $this->template('ui/compatible');
            }
			
        }			
    }
    
    


    
    /**
      * 重写web类的load_url_unique方法,获取前台特有URL
      */
    protected function load_url_unique() {
        global $_M;
        parent::load_url_unique();
        $_M['url']['own_func'] = $_M['url']['site'].'app/system/pay/web/include/function/';
        $_M['url']['own_class'] = $_M['url']['site'].'app/system/pay/web/include/class/';
        //$_M['url']['own_func'] = $_M['url']['site'].'app/system/web/pay/include/function/';
        //$_M['url']['own_class'] = $_M['url']['site'].'app/system/web/pay/include/class/';
        $_M['url']['pay_notify'] = $_M['url']['site'].'pay/notify.php';
        $_M['url']['pay_return'] = $_M['url']['site'].'pay/return.php';
        
		$_M['url']['tem'] = $_M['url']['site'].'app/system/pay/web/templates/met/';
        //$_M['url']['tem'] = $_M['url']['site'].'app/system/web/pay/templates/met/';
        if($_M['lang'] != $_M['config']['met_index_type']){
            $lang = "?lang={$_M['lang']}";
        }
        $lang = "?lang={$_M['lang']}";
        $_M['url']['login'] = $_M['url']['site']."member/login.php{$lang}";
        $_M['url']['register'] = $_M['url']['site']."member/register_include.php{$lang}";
        $_M['url']['register_userok'] = $_M['url']['site']."member/register_include.php?lang={$_M['lang']}&a=douserok";
        $_M['url']['getpassword'] = $_M['url']['site']."member/getpassword.php";
        $_M['url']['profile'] = $_M['url']['site']."member/basic.php{$lang}"; 
        $_M['url']['profile_safety'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dosafety"; 
        $_M['url']['pass_save'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dopasssave"; 
        $_M['url']['mailedit'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=doemailedit"; 
        $_M['url']['maileditok'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=doemailok"; 
        $_M['url']['profile_safety_emailadd'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dosafety_emailadd"; 
        $_M['url']['profile_safety_telok'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dosafety_telok"; 
        $_M['url']['profile_safety_telvalid'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dosafety_telvalid"; 
        $_M['url']['profile_safety_teladd'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dosafety_teladd"; 
        $_M['url']['profile_safety_teledit'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dosafety_teledit"; 
        $_M['url']['info_save'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=doinfosave";
        $_M['url']['valid_email_repeat'] = $_M['url']['site']."member/basic.php?lang={$_M['lang']}&a=dovalid_email"; 
        $_M['url']['valid_email'] = $_M['url']['site']."member/register_include.php?lang={$_M['lang']}&a=doemailvild"; 
        $_M['url']['valid_phone'] = $_M['url']['site']."member/register_include.php?lang={$_M['lang']}&a=dophonecode"; 
        $_M['url']['login_check'] = $_M['url']['site']."member/login.php?lang={$_M['lang']}&a=dologin";	
        $_M['url']['register_save'] = $_M['url']['site']."member/register_include.php?lang={$_M['lang']}&a=dosave";	
        $_M['url']['password_email'] = $_M['url']['site']."member/getpassword.php?lang={$_M['lang']}&a=doemail";
        $_M['url']['password_valid'] = $_M['url']['site']."member/getpassword.php?lang={$_M['lang']}&a=dovalid";
        $_M['url']['password_telvalid'] = $_M['url']['site']."member/getpassword.php?lang={$_M['lang']}&a=dotelvalid";
        $_M['url']['password_valid_phone'] = $_M['url']['site']."member/getpassword.php?lang={$_M['lang']}&a=dophonecode";
        $_M['url']['login_out'] = $_M['url']['site']."member/login.php?lang={$_M['lang']}&a=dologout";	
        $_M['url']['login_other'] = $_M['url']['site']."member/login.php?lang={$_M['lang']}&a=doother";	
        $_M['url']['login_other_register'] = $_M['url']['site']."member/login.php?lang={$_M['lang']}&a=dologin_other_register";	
        $_M['url']['login_other_info'] = $_M['url']['site']."member/login.php?lang={$_M['lang']}&a=dologin_other_info";	
    }
    
}
?>

 

京东支付文件放到这个文件夹:appsystempaywebjd

京东文件修改包:https://download.csdn.net/download/haibo0668/10606694

 

最后

以上就是重要御姐为你收集整理的6.0 增加京东支付的全部内容,希望文章能够帮你解决6.0 增加京东支付所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(49)

评论列表共有 0 条评论

立即
投稿
返回
顶部