软路由支付的支付宝
This commit is contained in:
@@ -17,7 +17,7 @@ class Alipay {
|
||||
|
||||
$ali = new AlipaySdk();
|
||||
|
||||
$flag = $ali->payVerify($_POST);
|
||||
$flag = $ali->payVerify2($_POST);
|
||||
|
||||
if($flag){
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ class Order extends Controller
|
||||
];
|
||||
|
||||
|
||||
$pay_html = Alipay::pay($param);
|
||||
$pay_html = Alipay::pay2($param);
|
||||
|
||||
$info = [
|
||||
'code'=>2,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/*
|
||||
* @Author: 万永康
|
||||
* @Date: 2020-10-11 12:32:50
|
||||
* @LastEditTime: 2022-03-22 14:52:50
|
||||
* @LastEditors: Please set LastEditors
|
||||
* @LastEditTime: 2023-11-11 14:15:28
|
||||
* @LastEditors: “wanyongkang” “937888580@qq.com”
|
||||
* @Description: In User Settings Edit
|
||||
* @FilePath: /phptest/alipay/Alipay.php
|
||||
*/
|
||||
@@ -65,6 +65,50 @@ class Alipay
|
||||
|
||||
|
||||
|
||||
$param = json_encode($param);
|
||||
|
||||
$request->setReturnUrl('http://www.juip.com/product/routeros');
|
||||
|
||||
$notifyUrl="http://php-api.juip.com/common/alipay/alipayverify";
|
||||
$request->setNotifyUrl($notifyUrl);
|
||||
|
||||
$request->setBizContent($param);
|
||||
$result = $aop->pageExecute ( $request);
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
/**
|
||||
*
|
||||
* web 付款
|
||||
* $param = [
|
||||
* 'body' => '123',
|
||||
* 'subject' => 'test',
|
||||
* 'total_amount' => '0.01',
|
||||
* 'out_trade_no' => '1231313123123',
|
||||
* 'product_code' => "FAST_INSTANT_TRADE_PAY",//QUICK_WAP_PAY
|
||||
* 'timeout_express'=>"15m"
|
||||
*];
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static function pay2($param)
|
||||
{
|
||||
global $config;
|
||||
$aop = new \AopClient ();
|
||||
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
||||
$aop->appId = $config['alipay2']['app_id'];;
|
||||
$aop->rsaPrivateKey = $config['alipay2']['private_key'] ;
|
||||
$aop->apiVersion = '1.0';
|
||||
$aop->signType = 'RSA2';
|
||||
$aop->postCharset='utf-8';
|
||||
$aop->format='json';
|
||||
$aop->alipayrsaPublicKey = $config['alipay2']['public_key'];
|
||||
|
||||
$request = new \AlipayTradePagePayRequest();
|
||||
|
||||
|
||||
|
||||
$param = json_encode($param);
|
||||
|
||||
$request->setReturnUrl('http://www.juip.com/product/routeros');
|
||||
@@ -108,6 +152,35 @@ class Alipay
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @description: 获取支付返回参数
|
||||
* @param {*} $post
|
||||
* @return {*}
|
||||
*/
|
||||
public static function payVerify2($post) {
|
||||
global $config;
|
||||
$aop = new \AopClient ();
|
||||
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
|
||||
$aop->appId = $config['alipay2']['app_id'];;
|
||||
$aop->rsaPrivateKey = $config['alipay2']['private_key'] ;
|
||||
$aop->apiVersion = '1.0';
|
||||
$aop->signType = 'RSA2';
|
||||
$aop->postCharset='utf-8';
|
||||
//签名方式
|
||||
$sign_type="RSA2";
|
||||
//输出拆分后的数据数据
|
||||
//验签代码
|
||||
$flag = $aop->rsaCheckV1($post, null, $sign_type);
|
||||
|
||||
if ($flag)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @description: 转帐到支付宝账户
|
||||
* @param {type}$param
|
||||
|
||||
Reference in New Issue
Block a user