Browse Source

配置修改

yijia
v-Brocloni 3 years ago
parent
commit
99c2238a2f
6 changed files with 63 additions and 23 deletions
  1. +35
    -0
      addons/config/AliPayConfig.php
  2. +7
    -5
      addons/epay/config.php
  3. +3
    -2
      addons/epay/library/Yansongda/Pay/Gateways/Alipay/Alipay.php
  4. +6
    -5
      addons/nzf/AliPay.php
  5. +5
    -4
      addons/unishop/controller/Pay.php
  6. +7
    -7
      addons/unishop/extend/Ali.php

+ 35
- 0
addons/config/AliPayConfig.php View File

@@ -0,0 +1,35 @@
<?php


namespace addons\config;


class AliPayConfig
{
public static $env= "wendy";

private static $wendy=[
"ali_app_id"=>"2021001199650201",
"ali_notify_url"=>"http://internalsales.iicn.co/addons/unishop/pay/notify/type/alipay",
"ali_return_url"=>"http://internalsales.iicn.co/h5/#/pages/order/order?state=0",
"ali_public_key"=>"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ttBosJiuTgQkLBu03CgkJ0FHXiiN6iYnWof2U8Qzcg/oIJDdfeb7KnpjHRblqoD108GrsfU8pfHwuqt65OeH0e+gQPQj2GRaQ2XrWqp3kitbFRfWHAcAoE81kHkLjKtUKDgx1afOmiybRJMryNBy9uPn5bUZLSIlMDr/GD6Hq+Z6p0ZAswCBFpZs2GTlPaDXHM/oOPDZEzNkdI05CDTSDCyjg2jCfQHZb6ItM6Xc3fPjbMoSd4quw/z3uqbfnIx62Bc0j7DbLJeup/ItCjuHaZ5gd0ITQPPEQQSxrYCaRKctC88JyW/wmPT/onSuVX/WWUdPOMIS1sZdyecjKncPwIDAQAB",
"ali_private_key"=>"MIIEowIBAAKCAQEA0ttBosJiuTgQkLBu03CgkJ0FHXiiN6iYnWof2U8Qzcg/oIJDdfeb7KnpjHRblqoD108GrsfU8pfHwuqt65OeH0e+gQPQj2GRaQ2XrWqp3kitbFRfWHAcAoE81kHkLjKtUKDgx1afOmiybRJMryNBy9uPn5bUZLSIlMDr/GD6Hq+Z6p0ZAswCBFpZs2GT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+/peqraxWOkyBWN7jkQSebwp+i40denrIsGx6y2kv5GlsDn2Vu2q0t/ufVCXdl6Y6nmv7ke6jdikejLIA+9AChI/fe+O2W9Vxb65vn1I29+KNLWSYRHvhLsaxW/qRmQKBgHsLvFDC95PWDcWXxR10JjPb/QHhrZBEjXPYEsqPryrvFtuohG/D2vKPltKrEh5xGOW5Xx02vPkLL3mf+92DMKVZ6PXBQo/sX3IENT0kHL0XkqEuM6aEcitLi6fLRJyrVjqfdcyI+GY7Yy8AzJZkFJvV9H/cI0kotXxQNiA6lJnK",
"ali_sandbox"=>0
];
private static $Lan=[
"ali_app_id"=>"2021001199650201",
"ali_notify_url"=>"http://internalsales.iicn.co/addons/unishop/pay/notify/type/alipay",
"ali_return_url"=>"http://internalsales.iicn.co/h5/#/pages/order/order?state=0",
"ali_public_key"=>"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ttBosJiuTgQkLBu03CgkJ0FHXiiN6iYnWof2U8Qzcg/oIJDdfeb7KnpjHRblqoD108GrsfU8pfHwuqt65OeH0e+gQPQj2GRaQ2XrWqp3kitbFRfWHAcAoE81kHkLjKtUKDgx1afOmiybRJMryNBy9uPn5bUZLSIlMDr/GD6Hq+Z6p0ZAswCBFpZs2GTlPaDXHM/oOPDZEzNkdI05CDTSDCyjg2jCfQHZb6ItM6Xc3fPjbMoSd4quw/z3uqbfnIx62Bc0j7DbLJeup/ItCjuHaZ5gd0ITQPPEQQSxrYCaRKctC88JyW/wmPT/onSuVX/WWUdPOMIS1sZdyecjKncPwIDAQAB",
"ali_private_key"=>"MIIEowIBAAKCAQEA0ttBosJiuTgQkLBu03CgkJ0FHXiiN6iYnWof2U8Qzcg/oIJDdfeb7KnpjHRblqoD108GrsfU8pfHwuqt65OeH0e+gQPQj2GRaQ2XrWqp3kitbFRfWHAcAoE81kHkLjKtUKDgx1afOmiybRJMryNBy9uPn5bUZLSIlMDr/GD6Hq+Z6p0ZAswCBFpZs2GTlPaDXHM/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kyBWN7jkQSebwp+i40denrIsGx6y2kv5GlsDn2Vu2q0t/ufVCXdl6Y6nmv7ke6jdikejLIA+9AChI/fe+O2W9Vxb65vn1I29+KNLWSYRHvhLsaxW/qRmQKBgHsLvFDC95PWDcWXxR10JjPb/QHhrZBEjXPYEsqPryrvFtuohG/D2vKPltKrEh5xGOW5Xx02vPkLL3mf+92DMKVZ6PXBQo/sX3IENT0kHL0XkqEuM6aEcitLi6fLRJyrVjqfdcyI+GY7Yy8AzJZkFJvV9H/cI0kotXxQNiA6lJnK",
"ali_sandbox"=>0
];

public static function getByName($name){
if (static::$env=="wendy") {
return static::$wendy[$name];
}else{
return static::$Lan[$name];
}
}
}

+ 7
- 5
addons/epay/config.php View File

@@ -1,5 +1,7 @@
<?php

use addons\config\AliPayConfig;

return array (
0 =>
array (
@@ -38,11 +40,11 @@ return array (
),
'value' =>
array (
'app_id' => '2021001199650201',
'notify_url' => 'http://internalsales.iicn.co/addons/unishop/pay/notify/type/alipay',
'return_url' => 'http://internalsales.iicn.co/h5/#/pages/order/order?state=0',
'ali_public_key' => 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAq8N4o64A4Wt434t3n2ohBgkulg3DDshTjeiAjSe40R4hyhYtatw6zvVbLHkFedlv9H2xcO/gp4+2AdNlP2w8hskc5IowEfnslLyZlL9TK/Ye6kG7MExbywdmC/E8FI0QIsuD4LECrzPFCDOwf+zoi/7b6B7NA6GkEP05N2N02e2PjucD4QyN1I797DEA+FocpKm2/10WnCSBDfaEA56k/yLCwNyV+DOwxX1DAhm10Kdzew/0souOcmo0nsztg+ZWqDk64/CHco/n/fqFENNdLfm550OU5MtjWf+wsytSxRhcQ1MprSlmRAbgoaQ4fP6RakKMYgFc/7lL3sT3m6nIBQIDAQAB',
'private_key' => 'MIIEowIBAAKCAQEA0ttBosJiuTgQkLBu03CgkJ0FHXiiN6iYnWof2U8Qzcg/oIJDdfeb7KnpjHRblqoD108GrsfU8pfHwuqt65O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kUU8RgkSo3yNImgRBY3Bidcfr6oHwCXpAnUBO4NNqMDqZcdt4r3zLcDzkCgYAuheUPNdZyIQIFxdLUhl5opkPF5Rx1GQ6qon5cqWnDkBG+/peqraxWOkyBWN7jkQSebwp+i40denrIsGx6y2kv5GlsDn2Vu2q0t/ufVCXdl6Y6nmv7ke6jdikejLIA+9AChI/fe+O2W9Vxb65vn1I29+KNLWSYRHvhLsaxW/qRmQKBgHsLvFDC95PWDcWXxR10JjPb/QHhrZBEjXPYEsqPryrvFtuohG/D2vKPltKrEh5xGOW5Xx02vPkLL3mf+92DMKVZ6PXBQo/sX3IENT0kHL0XkqEuM6aEcitLi6fLRJyrVjqfdcyI+GY7Yy8AzJZkFJvV9H/cI0kotXxQNiA6lJnK',
'app_id' => AliPayConfig::getByName('ali_app_id'),
'notify_url' => AliPayConfig::getByName('ali_notify_url'),
'return_url' => AliPayConfig::getByName('ali_return_url'),
'ali_public_key' => AliPayConfig::getByName('ali_public_key'),
'private_key' => AliPayConfig::getByName('ali_private_key'),
'log' => '1',
),
'rule' => 'required',


+ 3
- 2
addons/epay/library/Yansongda/Pay/Gateways/Alipay/Alipay.php View File

@@ -2,6 +2,7 @@

namespace Yansongda\Pay\Gateways\Alipay;

use addons\config\AliPayConfig;
use Yansongda\Pay\Contracts\GatewayInterface;
use Yansongda\Pay\Exceptions\GatewayException;
use Yansongda\Pay\Exceptions\InvalidArgumentException;
@@ -53,8 +54,8 @@ abstract class Alipay implements GatewayInterface
'charset' => 'UTF-8',
'sign_type' => 'RSA2',
'version' => '1.0',
'notify_url' => \addons\unishop\model\Config::getByName('ali_notify_url')['value'],
'return_url' => \addons\unishop\model\Config::getByName('ali_return_url')['value'],
'notify_url' => AliPayConfig::getByName('ali_notify_url'),
'return_url' => AliPayConfig::getByName('ali_return_url'),
'timestamp' => date('Y-m-d H:i:s'),
'sign' => '',
'biz_content' => '',


+ 6
- 5
addons/nzf/AliPay.php View File

@@ -17,7 +17,8 @@
namespace addons\nzf;


use addons\unishop\model\Config;

use addons\config\AliPayConfig;

class AliPay
{
@@ -162,7 +163,7 @@ class AliPay
private static function getSysParams()
{
//组装系统参数
$sysParams["app_id"] = Config::getByName('ali_app_id')['value'];
$sysParams["app_id"] = AliPayConfig::getByName('ali_app_id');
$sysParams["version"] = '1.0';
$sysParams["format"] = 'json';
$sysParams["sign_type"] = 'RSA2';
@@ -170,8 +171,8 @@ class AliPay
$sysParams["timestamp"] = date("Y-m-d H:i:s");
$sysParams["alipay_sdk"] = 'alipay-sdk-php-20160411';
$sysParams["prod_code"] = '';
$sysParams["notify_url"] = Config::getByName('ali_notify_url')['value'];
$sysParams["return_url"] = Config::getByName('ali_return_url')['value'];
$sysParams["notify_url"] = AliPayConfig::getByName('ali_notify_url');
$sysParams["return_url"] = AliPayConfig::getByName('ali_return_url');
$sysParams["charset"] = "utf-8";
return $sysParams;
}
@@ -212,7 +213,7 @@ class AliPay
unset($params['sign']);
}
$content = self::getSignContent($params);
$priKey = Config::getByName('ali_private_key')['value'];
$priKey = AliPayConfig::getByName('ali_private_key');
// $res = "-----BEGIN RSA PRIVATE KEY-----\n" .
// wordwrap($priKey, 64, "\n", true) .
// "\n-----END RSA PRIVATE KEY-----";


+ 5
- 4
addons/unishop/controller/Pay.php View File

@@ -9,6 +9,7 @@

namespace addons\unishop\controller;

use addons\config\AliPayConfig;
use addons\epay\library\Service;
use addons\nzf\AliPay;
use addons\unishop\extend\Ali;
@@ -103,8 +104,8 @@ class Pay extends Base
'orderid' => $order->out_trade_no,
'type' => "wechat",
'title' => $body,
'notifyurl' => Config::getByName('notify_url')['value'],
'returnurl' => Config::getByName('ali_return_url')['value'],
'notifyurl' => AliPayConfig::getByName('notify_url'),
'returnurl' => AliPayConfig::getByName('ali_return_url'),
'trade_type' => $trade_type,

];
@@ -229,8 +230,8 @@ class Pay extends Base
'orderid' => $order->out_trade_no,
'type' => "alipay",
'title' => $body,
'notifyurl' => Config::getByName('ali_notify_url')['value'],
'returnurl' => Config::getByName('ali_return_url')['value'],
'notifyurl' => AliPayConfig::getByName('ali_notify_url'),
'returnurl' => AliPayConfig::getByName('ali_return_url'),
'method' => "wap",
];



+ 7
- 7
addons/unishop/extend/Ali.php View File

@@ -10,7 +10,7 @@
namespace addons\unishop\extend;


use addons\unishop\model\Config;
use addons\config\AliPayConfig;
use Yansongda\Pay\Pay;

class Ali
@@ -18,12 +18,12 @@ class Ali
public static function initAliPay()
{
$config = [
'app_id' => Config::getByName('ali_app_id')['value'],
'notify_url' => Config::getByName('ali_notify_url')['value'],
'return_url' => Config::getByName('ali_return_url')['value'],
'ali_public_key' => Config::getByName('ali_public_key')['value'],
'app_id' => AliPayConfig::getByName('ali_app_id'),
'notify_url' => AliPayConfig::getByName('ali_notify_url'),
'return_url' => AliPayConfig::getByName('ali_return_url'),
'ali_public_key' => AliPayConfig::getByName('ali_public_key'),
// 加密方式: **RSA2**
'private_key' => Config::getByName('ali_private_key')['value'],
'private_key' => AliPayConfig::getByName('ali_private_key'),
// 'log' => [ // optional
// 'file' => './logs/alipay.log',
// 'level' => 'info', // 建议生产环境等级调整为 info,开发环境为 debug
@@ -38,7 +38,7 @@ class Ali
//'mode' => 'dev', // optional,设置此参数,将进入沙箱模式
];

if (Config::getByName('ali_sandbox')['value'] == 1) {
if (AliPayConfig::getByName('ali_sandbox') == 1) {
$config['mode'] = 'dev';
}



Loading…
Cancel
Save