Browse Source

update

master
DengBiao 1 year ago
parent
commit
f10bdebe02
18 changed files with 1907 additions and 518 deletions
  1. +2
    -0
      src/applet/app/config/loader.php
  2. +2
    -1
      src/applet/app/controllers/Alipay/BPassController.php
  3. +18
    -0
      src/applet/app/controllers/Alipay/FaceScanPayController.php
  4. +13
    -255
      src/applet/app/controllers/CallBackController.php
  5. +35
    -50
      src/common/Service/AliBPass/AliEcoService.php
  6. +112
    -0
      src/common/Service/AliBPass/AliEcoServiceBack.php
  7. +167
    -0
      src/common/Service/AliBPass/demo/AliEcoService.php
  8. +68
    -68
      src/common/Service/AliBPass/demo/AopEncrypt.php
  9. +1
    -1
      src/common/Service/AliBPass/demo/EcoApiClient.php
  10. +9
    -9
      src/common/Service/AliBPass/demo/EncryptParseItem.php
  11. +7
    -7
      src/common/Service/AliBPass/demo/EncryptResponseData.php
  12. +7
    -7
      src/common/Service/AliBPass/demo/SignData.php
  13. +2
    -2
      src/common/Service/AliBPass/demo/test/Demo.php
  14. +28
    -0
      src/common/Service/Pay/AlipayK12Service.php
  15. +0
    -1
      src/vendor/alipay-sdk-php-all-master/aop/AopClient.php
  16. +2
    -2
      src/vendor/alipay-sdk-php-all-master/aop/AopEncrypt256.php
  17. +1319
    -0
      src/vendor/alipay-sdk-php-all-master/aop/EcoAopClient.php
  18. +115
    -115
      src/vendor/alipay-sdk-php-all-master/aop/request/AlipayPlanetEcocampusApiRosterSignUpInfo.php

+ 2
- 0
src/applet/app/config/loader.php View File

@@ -7,10 +7,12 @@ $loader->registerFiles([
DIR_VENDOR . 'alipay/AopClient.php',
DIR_VENDOR . 'alipay/AopCertClient.php',
DIR_VENDOR . 'alipay-sdk-php-all-master/aop/AopClient.php',
DIR_VENDOR . 'alipay-sdk-php-all-master/aop/EcoAopClient.php',
DIR_VENDOR . 'alipay-sdk-php-all-master/aop/request/AlipaySystemOauthTokenRequest.php',

// DIR_VENDOR . 'alipay-sdk-php-all-master/aop/AopCertClient.php',
// DIR_VENDOR . 'alipay-sdk-php-all-master/aop/AopEncrypt.php',
DIR_VENDOR . 'alipay-sdk-php-all-master/aop/request/AlipayCommerceEducateFacefeatureGroupkeyQueryRequest.php',
DIR_VENDOR . 'alipay-sdk-php-all-master/aop/request/AlipayTradeRefundRequest.php',
DIR_VENDOR . 'alipay-sdk-php-all-master/aop/request/AlipayTradeCreateRequest.php',
DIR_VENDOR . 'alipay-sdk-php-all-master/aop/request/AlipayTradeQueryRequest.php',


+ 2
- 1
src/applet/app/controllers/Alipay/BPassController.php View File

@@ -4,7 +4,7 @@ namespace SRVX\Api\Controllers\Alipay;

use SRVX\Api\Controllers\ControllerBase;
use SRVX\Msg;
use SRVX\Service\AliBPass\AliEcoService;
use SRVX\Service\AliBPass\demo\AliEcoService;


class BPassController extends ControllerBase
@@ -19,6 +19,7 @@ class BPassController extends ControllerBase
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);

$result = (new AliEcoService())->alipayPlanetEcocampusApiRosterSignUpInfo(
$args["face_uid"],$args["parent_uid"],
$args["parent_logon_id"], $args["roster_name"],


+ 18
- 0
src/applet/app/controllers/Alipay/FaceScanPayController.php View File

@@ -35,4 +35,22 @@ class FaceScanPayController extends ControllerBase
}
}

public function EducateFaceFeatureGroupKeyQueryAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
$result = (new AlipayK12Service([
"ali_app_id" => "2021004103604157",
"ali_private_key" => "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnab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upIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W",
"ali_public_key" => "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB"
]))->alipayCommerceEducateFaceFeatureGroupKeyQuery($args["school_std_code"] ?? "");
if (!$result["status"]) {
$this->api(Msg::NewError($result["data"]["code"] ?? 500, $result["msg"]));
}
$this->api($result["data"]);
} else {
$this->api(Msg::NewError(500, '提交方式错误!'));
}
}

}

+ 13
- 255
src/applet/app/controllers/CallBackController.php View File

@@ -24,268 +24,26 @@ class CallBackController extends \Phalcon\Mvc\Controller
$args = $this->request->get();
}

/**
* Todo::支付宝 - 授权回调
*/
public function alipayAuthorizeCallBackAction()
{
$args = $this->request->get();
$this->logger($args, 'alipay_authorize_callBack_action', true);
if (empty($args['app_id']) || empty($args['app_auth_code']) || empty($args["state"])) {
dd(['msg' => '缺少参数', 'success' => -1]);
}
$result = (new AlipayService())->alipayOpenAuthTokenAppRequest($args['app_auth_code']);
if ($result["status"] != true) {
dd((['msg' => '授权失败', 'success' => -2, "result" => $result]));
}
$app_id = explode("=", base64_decode($args["state"]))[1];
$merchant_sn = explode("=", base64_decode($args["state"]))[0];
$uid = explode("_", $merchant_sn)[0];
$model = MerchantAlipayAuthorize::findFirst("uid = '{$uid}' AND app_id = '{$app_id}' AND merchant_sn = '{$merchant_sn}'");
$model = empty($model) ? new MerchantAlipayAuthorize() : $model;
$model->uid = $uid;
$model->app_id = $app_id;
$model->merchant_sn = $merchant_sn;
$model->app_auth_token = $result["data"]["tokens"][0]["app_auth_token"];
$model->app_refresh_token = $result["data"]["tokens"][0]["app_refresh_token"];
$model->ali_app_id = $args['app_id'];
$model->ali_auth_app_id = $result['data']["tokens"][0]["auth_app_id"];
$model->ali_user_id = $result["data"]["tokens"][0]["user_id"];
$model->created_at = date("Y-m-d H:i:s");
$model->updated_at = date("Y-m-d H:i:s");
$model->state = ICommon::MERCHANT_STATE_USE;
$model->save();
dd((['msg' => '授权成功!', 'success' => 0]));
}

/**
* 本系统自身支付回调 - 同步
* 支付宝 - 公共网关回调
*/
public function alipayOwnSyncReturnAction()
public function alipayCommonCallBackAction()
{
dump($_GET);
$args = $this->request->get();
logger(json_encode([
"msg" => "同步回调",
"data" => $args,
], 320), 'alipay_sync_return', true);
dd($args);
}

/**
* 本系统自身支付回调 - 异步
*/
public function alipayOwnSyncNotifyAction()
{
$this->logger($args, 'alipayCommonCallBack', true);
if ($this->request->isPost()) {
try {
$verify_result = (new EasyAlipayService())->verifyNotify($_POST);
logger(json_encode([
"msg" => "异步回调",
"data" => $_POST,
"res" => $verify_result
], 320), 'alipay_sync_notify', true);
if ($verify_result) {//验证成功
$out_trade_no = $_POST['out_trade_no'];
//支付宝交易号
$trade_no = $_POST['trade_no'];
//交易状态
$trade_status = $_POST['trade_status'];

//判断该笔订单是否在
$model = OwnOrder::findFirst("out_trade_no = '{$out_trade_no}'");
if (!$model) {
//未查到訂單
logger(json_encode([
"msg" => "异步回调失败-訂單未查到",
"data" => $_POST,
], 320), 'alipay_sync_notify_not_find', true);
//验证失败
echo "fail";
die();
}
$model->return_data = json_encode($_POST);
$model->trade_no = $trade_no;
$model->updated_at = date("Y-m-d H:i:s");

if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') {
//商户网站中已经做过处理
if ($model->status == IPay::PAY_STATE_FOR_ALREADY) {
logger(json_encode([
"msg" => "异步回调成功",
"data" => $_POST,
], 320), 'alipay_sync_notify_already', true);
echo "success";
die();
}
$model->status = IPay::PAY_STATE_FOR_ALREADY;
if ($model->save() == false) {
logger(json_encode([
"msg" => "异步回调-支付成功-更新訂單失敗",
"data" => $_POST,
], 320), 'alipay_sync_notify_success_update_fail', true);
echo "fail";
die();
}
logger(json_encode([
"msg" => "异步回调支付成功",
"data" => $_POST,
], 320), 'alipay_sync_notify_success', true);
} else {
$model->status = IPay::PAY_STATE_FOR_FAIL;
if ($model->save() == false) {
logger(json_encode([
"msg" => "异步回调-支付失敗-更新訂單失敗",
"data" => $_POST,
], 320), 'alipay_sync_notify_fail_update_fail', true);
echo "fail";
die();
}
logger(json_encode([
"msg" => "异步回调支付失敗",
"data" => $_POST,
], 320), 'alipay_sync_notify_fail', true);
}
echo "success";
die();
} else {
logger(json_encode([
"msg" => "异步回调驗證失败",
"data" => $_POST,
], 320), 'alipay_sync_notify_verify_fail', true);
//验证失败
echo "fail";
die();
}
} catch (\Exception $e) {
logger(json_encode([
"msg" => "异步回调處理异常",
"data" => $params ?? [],
"exception" => $e->getMessage()
], 320), 'alipay_sync_notify_exception', true);
//回調異常
echo "fail";
die();
}
$args = $this->request->getJsonRawBody(true);
$this->logger($args, 'alipayCommonCallBack_post', true);
}
}

/**
* 支付宝 - 公共网关回调
*/
public function alipayCommonCallBackAction()
{
// if ($this->request->isPost()) {
// try {
// $verify_result = (new EasyAlipayService())->verifyNotify($_POST);
// logger(json_encode([
// "msg" => "异步回调",
// "data" => $_POST,
// "res" => $verify_result
// ], 320), 'common_alipay_sync_notify', true);
// if ($verify_result) {//验证成功
// $self_order_sn = $_POST['out_trade_no'];
// //支付宝交易号
// $trade_no = $_POST['trade_no'];
// //交易状态
// $trade_status = $_POST['trade_status'];
// //判断该笔订单是否在
// $model = UserMerchantOrder::findFirst("self_trade_no = '{$self_order_sn}'");
// if (!$model) {
// //未查到訂單
// logger(json_encode([
// "msg" => "异步回调失败-訂單未查到",
// "data" => $_POST,
// ], 320), 'common_alipay_sync_notify_not_find', true);
// //验证失败
// echo "fail";
// die();
// }
// $model->return_data = json_encode($_POST);
// $model->trade_no = $trade_no;
// $model->updated_at = date("Y-m-d H:i:s");
//
// #TODO::回調第三方平台的 notify_url
// $passback_params = json_decode(urldecode($_POST["passback_params"]), true);
// $notify_url = $passback_params["notify_url"];
// $out_trade_no = $passback_params["out_trade_no"];
// $ext_info = $passback_params["ext_info"] ?? [];
// $isOk = (new GetPlatformCertificateService())->commonCurlNotifyUrl($notify_url, ["out_trade_no" => $out_trade_no,
// "trade_no" => $trade_no,
// "pay_trade_no" => $self_order_sn,
// "trade_status" => $trade_status,
// "ext_info" => $ext_info
// ]);
// if ($isOk) {
// if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') {
// //商户网站中已经做过处理
// if ($model->status == IPay::PAY_STATE_FOR_ALREADY) {
// logger(json_encode([
// "msg" => "异步回调成功",
// "data" => $_POST,
// ], 320), 'alipay_sync_notify_already', true);
// echo "success";
// die();
// }
// $model->status = IPay::PAY_STATE_FOR_ALREADY;
// if ($model->save() == false) {
// logger(json_encode([
// "msg" => "异步回调-支付成功-更新訂單失敗",
// "data" => $_POST,
// ], 320), 'alipay_sync_notify_success_update_fail', true);
// echo "fail";
// die();
// }
// logger(json_encode([
// "msg" => "异步回调支付成功",
// "data" => $_POST,
// ], 320), 'alipay_sync_notify_success', true);
// } else {
// $model->status = IPay::PAY_STATE_FOR_FAIL;
// if ($model->save() == false) {
// logger(json_encode([
// "msg" => "异步回调-支付失敗-更新訂單失敗",
// "data" => $_POST,
// ], 320), 'alipay_sync_notify_fail_update_fail', true);
// echo "fail";
// die();
// }
// logger(json_encode([
// "msg" => "异步回调支付失敗",
// "data" => $_POST,
// ], 320), 'alipay_sync_notify_fail', true);
// }
// echo "success";
// die();
// } else {
// logger(json_encode([
// "msg" => "异步回调 - 回調第三方平台失敗",
// "data" => $_POST,
// "isOk" => false
// ], 320), 'alipay_sync_notify_fail', true);
// echo "fail";
// die();
// }
// } else {
// logger(json_encode([
// "msg" => "异步回调驗證失败",
// "data" => $_POST,
// ], 320), 'alipay_sync_notify_verify_fail', true);
// //验证失败
// echo "fail";
// die();
// }
// } catch (\Exception $e) {
// logger(json_encode([
// "msg" => "异步回调處理异常",
// "data" => $params ?? [],
// "exception" => $e->getMessage()
// ], 320), 'alipay_sync_notify_exception', true);
// //回調異常
// echo "fail";
// die();
// }
// }
exit(json_encode(
[
"alipay_commerce_educate_facefeature_groupkey_query_response" => [
"code" => "10000",
"msg" => "Success",
"group_key" => "K12_2088323332233424",
]]
));
}

/**


+ 35
- 50
src/common/Service/AliBPass/AliEcoService.php View File

@@ -3,62 +3,28 @@
namespace SRVX\Service\AliBPass;

use SRVX\Service\BaseService;
use AopClient;
use EcoAopClient;


class AliEcoService extends BaseService
{

public $config = \AlipayConfig::class;
static private $aopClient;

public $gatewayUrl = 'https://openapi.alipay.com/gateway.do';
public $apiVersion = '1.0';
public $signType = 'RSA2';
public $postCharset = 'UTF-8';
public $format = 'json';

public $serverUrl = 'https://cloudpaygw.alipay-eco.com';
public $appId = '';
public $serverUrl = "https://cloudpaygw.alipay-eco.com";
public $appId = '20230803121700004722802100016020';
public $privateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em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yms4DqJqacwoQKBgQCocPd7An8qTDIBZMOC4oT29+TYvUO+yMkAHLmx1h4QkLCkWegB4g5QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W'; //企业私钥
public $alipayPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWFuSpwY/2llLhy5Hxkqcc0qQFQOvemkYOI4S43L4qArX4x+DQN1RFuvfGuwOLScBKaoDYHsu9PSoTtcIj4obhhexbWHfelcsouV7Pj4YChrOkOLHAMLDQhGRXaZyXQAJdk2DoBkJ0vBDD/b1gZT8QznPopvuT4Y0rx/a2vK+5B/XV0wUuP2PnpWoPxNSwr7neFWvUdkC7yJJg4zJ1INLYy9TgHH3LKYrsEDbQzPJyMPFhD0zDb36b62q3tQYc1w8JknS6XeXMkX1Tu4zZbAxyIiv3J1FK8y7dtoRi9gLgo0uLsXWDn5AwAlzqfOERgLMWD2r6FE8tOXVbMha6IImQIDAQAB'; //平台公钥
public $aesKey = 'HOrPS0V4BthAPfgSdbHWwy0TwPnC8TQAQZIOjc8vOzI='; //加密密钥

public function __construct()
{
if ((APP_ENV == 'dev')) {
$this->serverUrl = 'https://dev-cloudpaygw.alipay-eco.com';
}
$this->getConfig();
$this->aopClient();
}


private function aopClient()
{
if (!self::$aopClient instanceof AopClient) {
self::$aopClient = new AopClient($this->config);
}
}


private function getConfig()
{
$alipayConfig = new \AlipayConfig();
$alipayConfig->setServerUrl($this->serverUrl);
$alipayConfig->setAppId($this->appId);
$alipayConfig->setPrivateKey($this->privateKey);
$alipayConfig->setFormat($this->format);
$alipayConfig->setAlipayPublicKey($this->alipayPublicKey);
$alipayConfig->setCharset($this->postCharset);
$alipayConfig->setSignType($this->signType);
$this->config = $alipayConfig;
// if ((APP_ENV == 'dev')) {
// $this->serverUrl = 'https://dev-cloudpaygw.alipay-eco.com';
// }
}

/**
* alipay.planet.ecocampus.api.roster.signUpInfo(签约信息同步)
* @param $face_uid string 学生刷脸编号(不可修改)
* @param $parent_uid string 家长uid(可修改) 2088122417040252
* @param $parent_uid string 家长uid(可修改) 2088122417040252
* @param $parent_logon_id string 家长支付宝账号脱敏信息(可修改)
* @param $roster_name string 学生姓名(可修改)
* @param $out_roster_code string 外部花名册编号(不可修改)
@@ -71,22 +37,41 @@ class AliEcoService extends BaseService

public function alipayPlanetEcocampusApiRosterSignUpInfo($face_uid, $parent_uid, $parent_logon_id, $roster_name, $out_roster_code, $school_code, $school_name, $face_open_status = "OFF", $scan_face_pay_status = "OFF"): array
{
$privateKey = $this->privateKey;
$alipayPublicKey = $this->alipayPublicKey;
$alipayConfig = new \AlipayConfig();
$alipayConfig->setServerUrl($this->serverUrl); //行业云接口地址
$alipayConfig->setAppId($this->appId); //行业云上的服务商isv_app_id
$alipayConfig->setPrivateKey($privateKey);
$alipayConfig->setFormat("json");
$alipayConfig->setAlipayPublicKey($alipayPublicKey);
$alipayConfig->setCharset("UTF-8");
$alipayConfig->setSignType("RSA2");

$alipayClient = new EcoAopClient($alipayConfig);
//加密密钥,仅在接口内容需要加密时生效
$alipayClient->encryptKey = $this->aesKey;
$alipayClient->encryptType = "AES";

try {
$request = new \AlipayPlanetEcocampusApiRosterSignUpInfo();
$params = [
"face_uid" => $face_uid,
"face_open_status" => $parent_uid,
"parent_uid" => $parent_logon_id,
"parent_logon_id" => $roster_name,
"roster_name" => $out_roster_code,
"out_roster_code" => $school_code,
"school_code" => $school_name,
"school_name" => $face_open_status,
"face_open_status" => $face_open_status,
"parent_uid" => $parent_uid,
"parent_logon_id" => $parent_logon_id,
"roster_name" => $roster_name,
"out_roster_code" => $out_roster_code,
"school_code" => $school_code,
"school_name" => $school_name,
"scan_face_pay_status" => $scan_face_pay_status,
];

$request->setBizContent(json_encode($params));
$response = self::$aopClient->execute($request);

//加密开关,仅在接口内容需要加密时生效
$request->setNeedEncrypt(true);

$response = $alipayClient->execute($request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$responseData = json_decode(json_encode($response->$responseNode), true);
if ($responseData['code'] == 10000) {


+ 112
- 0
src/common/Service/AliBPass/AliEcoServiceBack.php View File

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

namespace SRVX\Service\AliBPass;

use SRVX\Service\BaseService;
use EcoAopClient;


class AliEcoService extends BaseService
{

static private $config = [];
static private $aopClient;

// public $gatewayUrl = 'https://openapi.alipay.com/gateway.do';
public $apiVersion = '1.0';
public $signType = 'RSA2';
public $postCharset = 'UTF-8';
public $format = 'json';

public $serverUrl = 'https://cloudpaygw.alipay-eco.com';
public $appId = '20230803121700004722802100016020';
public $privateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKu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xrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W'; //企业私钥
public $alipayPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWFuSpwY/2llLhy5Hxkqcc0qQFQOvemkYOI4S43L4qArX4x+DQN1RFuvfGuwOLScBKaoDYHsu9PSoTtcIj4obhhexbWHfelcsouV7Pj4YChrOkOLHAMLDQhGRXaZyXQAJdk2DoBkJ0vBDD/b1gZT8QznPopvuT4Y0rx/a2vK+5B/XV0wUuP2PnpWoPxNSwr7neFWvUdkC7yJJg4zJ1INLYy9TgHH3LKYrsEDbQzPJyMPFhD0zDb36b62q3tQYc1w8JknS6XeXMkX1Tu4zZbAxyIiv3J1FK8y7dtoRi9gLgo0uLsXWDn5AwAlzqfOERgLMWD2r6FE8tOXVbMha6IImQIDAQAB'; //平台公钥
public $aesKey = 'HOrPS0V4BthAPfgSdbHWwy0TwPnC8TQAQZIOjc8vOzI='; //加密密钥

public function __construct()
{
if ((APP_ENV == 'dev')) {
$this->serverUrl = 'https://dev-cloudpaygw.alipay-eco.com';
}
$this->getConfig();
$this->aopClient();
}


private function aopClient()
{
if (!self::$aopClient instanceof EcoAopClient) {
self::$aopClient = new EcoAopClient(self::$config);
self::$aopClient->appId = self::$config['ali_app_id'];
//支付宝私钥值
self::$aopClient->rsaPrivateKey = self::$config['ali_private_key'];
//支付宝公钥值
self::$aopClient->alipayrsaPublicKey = self::$config['ali_public_key'];
}
// self::$aopClient->gatewayUrl = $this->gatewayUrl;
self::$aopClient->gatewayUrl = $this->serverUrl;
// self::$aopClient->apiVersion = $this->apiVersion;
self::$aopClient->signType = $this->signType;
self::$aopClient->postCharset = $this->postCharset;
self::$aopClient->format = $this->format;
}


private function getConfig()
{
if (empty(self::$config)) {
self::$config = [
"ali_app_id" => $this->appId,
"ali_private_key" => $this->privateKey,
"ali_public_key" => $this->alipayPublicKey
];
}
}

/**
* alipay.planet.ecocampus.api.roster.signUpInfo(签约信息同步)
* @param $face_uid string 学生刷脸编号(不可修改)
* @param $parent_uid string 家长uid(可修改) 2088122417040252
* @param $parent_logon_id string 家长支付宝账号脱敏信息(可修改)
* @param $roster_name string 学生姓名(可修改)
* @param $out_roster_code string 外部花名册编号(不可修改)
* @param $school_code string 学校内标(不可修改)
* @param $school_name string 学校名称(不可修改)
* @param $face_open_status string 刷脸开通状态(可修改)
* @param $scan_face_pay_status string 刷脸支付开通状态(可修改)
* @return array
*/

public function alipayPlanetEcocampusApiRosterSignUpInfo($face_uid, $parent_uid, $parent_logon_id, $roster_name, $out_roster_code, $school_code, $school_name, $face_open_status = "OFF", $scan_face_pay_status = "OFF"): array
{
try {
$request = new \AlipayPlanetEcocampusApiRosterSignUpInfo();
$params = [
"face_uid" => $face_uid,
"face_open_status" => $parent_uid,
"parent_uid" => $parent_logon_id,
"parent_logon_id" => $roster_name,
"roster_name" => $out_roster_code,
"out_roster_code" => $school_code,
"school_code" => $school_name,
"school_name" => $face_open_status,
"scan_face_pay_status" => $scan_face_pay_status,
];

$request->setBizContent(json_encode($params));
$response = self::$aopClient->execute($request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
dd($responseNode);
$responseData = json_decode(json_encode($response->$responseNode), true);
if ($responseData['code'] == 10000) {
return $this->returnRes(true, $responseData['msg'], $responseData);
} else {
return $this->returnRes(false, ($responseData['sub_msg'] ?? $responseData['msg']), $responseData);
}
} catch (\Exception $exception) {
return $this->returnRes(false, $exception->getMessage());
}
}

}

+ 167
- 0
src/common/Service/AliBPass/demo/AliEcoService.php View File

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

namespace SRVX\Service\AliBPass\demo;


require_once 'EcoApiClient.php';

use SRVX\Service\BaseService;


class AliEcoService extends BaseService
{

public $serverUrl = "https://cloudpaygw.alipay-eco.com";
public $appId = 'app-230801DJKNnkE66EP582nUi9zt6i';
public $privateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4Y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ERTfeN3Z+9asSjs1TqzZSAtoQQ1EiCaFS4P9dNCTpYttS+52gy+VlJhNjCT0RHfxlGkpb+4OA4vHkbKpvTUAHjjXnMW1ZwC5CugSAchdTXTeV1im4Yms4DqJqacwoQKBgQCocPd7An8qTDIBZMOC4oT29+TYvUO+yMkAHLmx1h4QkLCkWegB4g5QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W'; //企业私钥
public $alipayPublicKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWFuSpwY/2llLhy5Hxkqcc0qQFQOvemkYOI4S43L4qArX4x+DQN1RFuvfGuwOLScBKaoDYHsu9PSoTtcIj4obhhexbWHfelcsouV7Pj4YChrOkOLHAMLDQhGRXaZyXQAJdk2DoBkJ0vBDD/b1gZT8QznPopvuT4Y0rx/a2vK+5B/XV0wUuP2PnpWoPxNSwr7neFWvUdkC7yJJg4zJ1INLYy9TgHH3LKYrsEDbQzPJyMPFhD0zDb36b62q3tQYc1w8JknS6XeXMkX1Tu4zZbAxyIiv3J1FK8y7dtoRi9gLgo0uLsXWDn5AwAlzqfOERgLMWD2r6FE8tOXVbMha6IImQIDAQAB'; //平台公钥
public $aesKey = 'HOrPS0V4BthAPfgSdbHWwy0TwPnC8TQAQZIOjc8vOzI='; //加密密钥
public $signType = 'RSA2';
public $format = 'json';
public $charset = 'UTF-8';



/**
* alipay.planet.ecocampus.api.roster.signUpInfo(签约信息同步)
* @param $face_uid string 学生刷脸编号(不可修改)
* @param $parent_uid string 家长uid(可修改) 2088122417040252
* @param $parent_logon_id string 家长支付宝账号脱敏信息(可修改)
* @param $roster_name string 学生姓名(可修改)
* @param $out_roster_code string 外部花名册编号(不可修改)
* @param $school_code string 学校内标(不可修改)
* @param $school_name string 学校名称(不可修改)
* @param $face_open_status string 刷脸开通状态(可修改)
* @param $scan_face_pay_status string 刷脸支付开通状态(可修改)
* @return array
*/

public function alipayPlanetEcocampusApiRosterSignUpInfo($face_uid, $parent_uid, $parent_logon_id, $roster_name, $out_roster_code, $school_code, $school_name, $face_open_status = "OFF", $scan_face_pay_status = "OFF"): array
{

// cleint初始
$client = new \EcoApiClient();

// 根据环境,选择行星OPENAPI网关地址
$client->gatewayUrl = $this->serverUrl;
$client->rsaPrivateKey = $this->privateKey;
$client->alipayrsaPublicKey = $this->alipayPublicKey;
$client->signType = $this->signType;
$client->format = $this->format;

// 业务参数
$bizContent["face_uid"] = $face_uid;
$bizContent["parent_uid"] = $parent_uid;
$bizContent["parentLoginId"] = $parent_logon_id;
$bizContent["roster_name"] = $roster_name;
$bizContent["out_roster_code"] = $out_roster_code;
$bizContent["school_code"] = $school_code;
$bizContent["school_name"] = $school_name;
$bizContent["face_open_status"] = $face_open_status;
$bizContent["scan_face_pay_status"] = $scan_face_pay_status;

// 指定需要调用的service接口
$params["service"] = "alipay.planet.ecocampus.api.roster.signUpInfo";
$params["request_id"] = "" . uuid();
$params["biz_content"] = json_encode($bizContent);
$params["version"] = "1.0";

// 其他参数
$params["charset"] = $this->charset;
$params["isv_app_id"] = $this->appId;
$params["utc_timestamp"] = "" . msectime();

//获取签名
// $sign = $client->generateSign($params, $this->signType);

// 调用ECOAPI
$result = $client->call($params);

var_dump($result);


$jsonStr = json_encode($result);


// 响应的签名验证 转成Array 而非 Object
$resMapData = json_decode($jsonStr, true);

// 验签
$verifyRes = checkResponse($resMapData, $client->alipayrsaPublicKey);

if ($verifyRes) {
echo "响应验签成功";
} else {
echo "响应验签失败";
}

return [];
}

}


/**
* 验签 仅支持 RSA2
*/
function checkResponse($res, $pubKey)
{

$resSignType = $res['sign_type'];
if($resSignType != "RSA2"){
return false;
}

$resSign = $res['sign'];

$data = $res["response"];
nestKsort($data);
$data = json_encode($data,JSON_UNESCAPED_UNICODE);
$data = str_replace("[]", "{}", $data);

$pubKey = "-----BEGIN PUBLIC KEY-----\n" .
wordwrap($pubKey, 64, "\n", true) .
"\n-----END PUBLIC KEY-----";
$pubKey = openssl_get_publickey($pubKey);

$resSign = base64_decode($resSign);
$result = (bool)openssl_verify($data, $resSign, $pubKey, OPENSSL_ALGO_SHA256);
return $result;
}

/**
* 返回值json字段排序
*/
function nestKsort(&$data)
{
foreach ($data as $key => &$item) {
if (is_array($item)) {
nestKsort($item);
}
}
ksort($data);
}


/**
* 返回当前的毫秒时间戳
*/
function msectime()
{
list($s1, $s2) = explode(' ', microtime());
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
}

/**
* 生成UUID
*/
function uuid()
{
$chars = md5(uniqid(mt_rand(), true));
$uuid = substr($chars, 0, 8) . '-'
. substr($chars, 8, 4) . '-'
. substr($chars, 12, 4) . '-'
. substr($chars, 16, 4) . '-'
. substr($chars, 20, 12);
return $uuid;
}

+ 68
- 68
src/common/Service/AliBPass/demo/AopEncrypt.php View File

@@ -8,71 +8,71 @@
*/


/**
* 加密方法
* @param string $str
* @return string
*/
function encrypt($str, $screct_key)
{
//AES, 128 模式加密数据 CBC
$screct_key = base64_decode($screct_key);
$str = trim($str);
$str = addPKCS7Padding($str);
//设置全0的IV
$iv = str_repeat("\0", 16);
$encrypt_str = openssl_encrypt($str, 'aes-128-cbc', $screct_key, OPENSSL_NO_PADDING, $iv);
return base64_encode($encrypt_str);
}
/**
* 解密方法
* @param string $str
* @return string
*/
function decrypt($str, $screct_key)
{
//AES, 128 模式加密数据 CBC
$str = base64_decode($str);
$screct_key = base64_decode($screct_key);
//设置全0的IV
$iv = str_repeat("\0", 16);
$decrypt_str = openssl_decrypt($str, 'aes-128-cbc', $screct_key, OPENSSL_NO_PADDING, $iv);
$decrypt_str = stripPKSC7Padding($decrypt_str);
return $decrypt_str;
}
/**
* 填充算法
* @param string $source
* @return string
*/
function addPKCS7Padding($source)
{
$source = trim($source);
$block = 16;
$pad = $block - (strlen($source) % $block);
if ($pad <= $block) {
$char = chr($pad);
$source .= str_repeat($char, $pad);
}
return $source;
}
/**
* 移去填充算法
* @param string $source
* @return string
*/
function stripPKSC7Padding($source)
{
$char = substr($source, -1);
$num = ord($char);
if ($num == 62) return $source;
$source = substr($source, 0, -$num);
return $source;
}
///**
// * 加密方法
// * @param string $str
// * @return string
// */
//function EcoEncrypt($str, $screct_key)
//{
// //AES, 128 模式加密数据 CBC
// $screct_key = base64_decode($screct_key);
// $str = trim($str);
// $str = addPKCS7Padding($str);
//
// //设置全0的IV
//
// $iv = str_repeat("\0", 16);
// $encrypt_str = openssl_encrypt($str, 'aes-128-cbc', $screct_key, OPENSSL_NO_PADDING, $iv);
// return base64_encode($encrypt_str);
//}
//
///**
// * 解密方法
// * @param string $str
// * @return string
// */
//function decrypt($str, $screct_key)
//{
// //AES, 128 模式加密数据 CBC
// $str = base64_decode($str);
// $screct_key = base64_decode($screct_key);
//
// //设置全0的IV
// $iv = str_repeat("\0", 16);
// $decrypt_str = openssl_decrypt($str, 'aes-128-cbc', $screct_key, OPENSSL_NO_PADDING, $iv);
// $decrypt_str = stripPKSC7Padding($decrypt_str);
// return $decrypt_str;
//}
//
///**
// * 填充算法
// * @param string $source
// * @return string
// */
//function addPKCS7Padding($source)
//{
// $source = trim($source);
// $block = 16;
//
// $pad = $block - (strlen($source) % $block);
// if ($pad <= $block) {
// $char = chr($pad);
// $source .= str_repeat($char, $pad);
// }
// return $source;
//}
//
///**
// * 移去填充算法
// * @param string $source
// * @return string
// */
//function stripPKSC7Padding($source)
//{
// $char = substr($source, -1);
// $num = ord($char);
// if ($num == 62) return $source;
// $source = substr($source, 0, -$num);
// return $source;
//}

src/common/Service/AliBPass/demo/EcoapiClient.php → src/common/Service/AliBPass/demo/EcoApiClient.php View File

@@ -5,7 +5,7 @@ require_once 'EncryptParseItem.php';
require_once 'EncryptResponseData.php';
require_once 'SignData.php';

class EcoapiClient
class EcoApiClient
{
//应用ID
public $appId;

+ 9
- 9
src/common/Service/AliBPass/demo/EncryptParseItem.php View File

@@ -7,12 +7,12 @@
* Time: 下午8:55
*/

class EncryptParseItem
{
public $startIndex;
public $endIndex;
public $encryptContent;
}
//class EncryptParseItem
//{
// public $startIndex;
//
// public $endIndex;
//
// public $encryptContent;
//
//}

+ 7
- 7
src/common/Service/AliBPass/demo/EncryptResponseData.php View File

@@ -7,10 +7,10 @@
* Time: 下午8:51
*/

class EncryptResponseData
{
public $realContent;
public $returnContent;
}
//class EncryptResponseData
//{
// public $realContent;
//
// public $returnContent;
//
//}

+ 7
- 7
src/common/Service/AliBPass/demo/SignData.php View File

@@ -6,10 +6,10 @@
* Time: 下午6:21
*/

class SignData
{
public $signSourceData = null;
public $sign = null;
}
//class SignData
//{
// public $signSourceData = null;
//
// public $sign = null;
//
//}

+ 2
- 2
src/common/Service/AliBPass/demo/test/Demo.php View File

@@ -1,9 +1,9 @@
<?php

require_once '../EcoapiClient.php';
require_once '../EcoApiClient.php';

// cleint初始
$client = new EcoapiClient();
$client = new EcoApiClient();
// 根据环境,选择行星OPENAPI网关地址
$client->gatewayUrl = 'http://dev-apigw.alipay-eco.com';
$client->rsaPrivateKey = '更换为应用私钥';


+ 28
- 0
src/common/Service/Pay/AlipayK12Service.php View File

@@ -179,4 +179,32 @@ class AlipayK12Service extends BaseService
}
}

/**
* alipay.commerce.educate.facepay.apply(人脸开通支付申请)
* @param $school_stdcode string 学校外标
* @return array
*/
public function alipayCommerceEducateFaceFeatureGroupKeyQuery($school_stdcode): array
{
try {
$request = new \AlipayCommerceEducateFacefeatureGroupkeyQueryRequest();
$params = [
"school_stdcode" => $school_stdcode,
"biz_code" => "SCHOOL_PAYMENT",
];
$request->setBizContent(json_encode($params));
$response = self::$aopClient->execute($request, null);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$responseData = json_decode(json_encode($response->$responseNode), true);
// dd($responseData);
if ($responseData['code'] == 10000) {
return $this->returnRes(true, $responseData['msg'], $responseData);
} else {
return $this->returnRes(false, ($responseData['sub_msg'] ?? $responseData['msg']), $responseData);
}
} catch (\Exception $exception) {
return $this->returnRes(false, $exception->getMessage());
}
}

}

+ 0
- 1
src/vendor/alipay-sdk-php-all-master/aop/AopClient.php View File

@@ -616,7 +616,6 @@ class AopClient

//返回的HTTP文本不是标准JSON或者XML,记下错误日志
if (false === $respWellFormed) {
var_dump(333);
$this->logCommunicationError($sysParams["method"], $requestUrl, "HTTP_RESPONSE_NOT_WELL_FORMED", $resp);
return false;
}


+ 2
- 2
src/vendor/alipay-sdk-php-all-master/aop/AopEncrypt256.php View File

@@ -5,7 +5,7 @@
* @param string $str
* @return string
*/
function encrypt($str, $screct_key)
function encrypt256($str, $screct_key)
{
//AES, 128 模式加密数据 CBC
$screct_key = base64_decode($screct_key);
@@ -24,7 +24,7 @@ function encrypt($str, $screct_key)
* @param string $str
* @return string
*/
function decrypt($str, $screct_key)
function decrypt256($str, $screct_key)
{
//AES, 128 模式加密数据 CBC
$str = base64_decode($str);


+ 1319
- 0
src/vendor/alipay-sdk-php-all-master/aop/EcoAopClient.php
File diff suppressed because it is too large
View File


+ 115
- 115
src/vendor/alipay-sdk-php-all-master/aop/request/AlipayPlanetEcocampusApiRosterSignUpInfo.php View File

@@ -1,118 +1,118 @@
<?php
/**
* ALIPAY API: alipay.commerce.educate.facepay.apply request
*
* @author auto create
* @since 1.0, 2023-07-05 15:51:58
*/

class AlipayPlanetEcocampusApiRosterSignUpInfo
{
/**
* 人脸开通支付申请
**/
private $bizContent;

private $apiParas = array();
private $terminalType;
private $terminalInfo;
private $prodCode;
private $apiVersion="1.0";
private $notifyUrl;
private $returnUrl;
private $needEncrypt=false;

public function setBizContent($bizContent)
{
$this->bizContent = $bizContent;
$this->apiParas["biz_content"] = $bizContent;
}

public function getBizContent()
{
return $this->bizContent;
}

public function getApiMethodName()
{
return "alipay.planet.ecocampus.api.roster.signUpInfo";
}

public function setNotifyUrl($notifyUrl)
{
$this->notifyUrl=$notifyUrl;
}

public function getNotifyUrl()
{
return $this->notifyUrl;
}

public function setReturnUrl($returnUrl)
{
$this->returnUrl=$returnUrl;
}

public function getReturnUrl()
{
return $this->returnUrl;
}

public function getApiParas()
{
return $this->apiParas;
}

public function getTerminalType()
{
return $this->terminalType;
}

public function setTerminalType($terminalType)
{
$this->terminalType = $terminalType;
}

public function getTerminalInfo()
{
return $this->terminalInfo;
}

public function setTerminalInfo($terminalInfo)
{
$this->terminalInfo = $terminalInfo;
}

public function getProdCode()
{
return $this->prodCode;
}

public function setProdCode($prodCode)
{
$this->prodCode = $prodCode;
}

public function setApiVersion($apiVersion)
{
$this->apiVersion=$apiVersion;
}

public function getApiVersion()
{
return $this->apiVersion;
}

public function setNeedEncrypt($needEncrypt)
{

$this->needEncrypt=$needEncrypt;

}

public function getNeedEncrypt()
{
return $this->needEncrypt;
}

}

private $apiParas = array();

private $terminalType;
private $terminalInfo;
private $prodCode;
private $apiVersion="1.0";
private $notifyUrl;
private $returnUrl;
private $needEncrypt=true;
private $bizContent;

/**
* @return mixed
*/
public function getBizContent()
{
return $this->bizContent;
}

/**
* @param mixed $bizContent
*/
public function setBizContent($bizContent)
{
$this->apiParas["biz_content"] = $bizContent;
$this->apiParas["service"] = $this->getApiMethodName();
$this->bizContent = $bizContent;
}


public function getApiMethodName()
{
return "alipay.planet.ecocampus.api.roster.signUpInfo";
}

public function setNotifyUrl($notifyUrl)
{
$this->notifyUrl=$notifyUrl;
}

public function getNotifyUrl()
{
return $this->notifyUrl;
}

public function setReturnUrl($returnUrl)
{
$this->returnUrl=$returnUrl;
}

public function getReturnUrl()
{
return $this->returnUrl;
}

public function getApiParas()
{
return $this->apiParas;
}

public function getTerminalType()
{
return $this->terminalType;
}

public function setTerminalType($terminalType)
{
$this->terminalType = $terminalType;
}

public function getTerminalInfo()
{
return $this->terminalInfo;
}

public function setTerminalInfo($terminalInfo)
{
$this->terminalInfo = $terminalInfo;
}

public function getProdCode()
{
return $this->prodCode;
}

public function setProdCode($prodCode)
{
$this->prodCode = $prodCode;
}

public function setApiVersion($apiVersion)
{
$this->apiVersion=$apiVersion;
}

public function getApiVersion()
{
return $this->apiVersion;
}

public function setNeedEncrypt($needEncrypt)
{

$this->needEncrypt=$needEncrypt;

}

public function getNeedEncrypt()
{
return $this->needEncrypt;
}

}

Loading…
Cancel
Save