Browse Source

update

master
DengBiao 1 year ago
parent
commit
b0421a5226
9 changed files with 102 additions and 559 deletions
  1. +1
    -1
      src/applet/app/controllers/Alipay/DecryptController.php
  2. +11
    -12
      src/applet/app/controllers/Alipay/FaceCollectionController.php
  3. +5
    -5
      src/applet/app/controllers/Alipay/FaceScanPayController.php
  4. +32
    -40
      src/applet/app/controllers/Alipay/PayController.php
  5. +0
    -247
      src/applet/app/controllers/Alipay/SplitAccountController.php
  6. +0
    -71
      src/applet/app/controllers/Alipay/SystemOauthController.php
  7. +0
    -41
      src/applet/app/controllers/Alipay/SystemOauthTokenController.php
  8. +0
    -38
      src/applet/app/controllers/Alipay/TransferController.php
  9. +53
    -104
      src/applet/app/controllers/CallBackController.php

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

@@ -16,7 +16,7 @@ class DecryptController extends ControllerBase
public function indexAction()
{
$args = $this->request->getJsonRawBody(true);
$aesKey = "n1UenLsnSPxi2KsTv3y/0Q=="; //AES密钥
$aesKey = $args["aes_key"] ?? "n1UenLsnSPxi2KsTv3y/0Q=="; //AES密钥
$content = $args["content"] ?? "Ho5y3nixH0tSnYWw8p/HMTO1bIONKSYd7BfkbI+ww4qgJEXKMYFWnSwjXN2B9YwvsKBYykK2gva2v1jfnQVSNQ==";
$result = openssl_decrypt(base64_decode($content), 'AES-128-CBC', base64_decode($aesKey), OPENSSL_RAW_DATA);
if (!$result) {


+ 11
- 12
src/applet/app/controllers/Alipay/FaceCollectionController.php View File

@@ -20,12 +20,12 @@ class FaceCollectionController extends ControllerBase
public function EducateSceneTokenCreateAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
$result = (new AlipayK12Service([
"ali_app_id" => "2021004103604157",
"ali_private_key" => "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dm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Gkpb+4OA4vHkbKpvTUAHjjXnMW1ZwC5CugSAchdTXTeV1im4Yms4DqJqacwoQKBgQCocPd7An8qTDIBZMOC4oT29+TYvUO+yMkAHLmx1h4QkLCkWegB4g5QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W",
"ali_public_key" => "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB"
]))->alipayCommerceEducateSceneTokenCreateRequest($args["sub_code"] ?? "SCHOOL_FACE_PASS_QUERY",
$args = $this->request->getJsonRawBody(true);
$config["ali_app_id"] = $args["config"]["ali_app_id"] ?? "2021004103604157";
$config["ali_private_key"] = $args["config"]["ali_private_key"] ?? "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTR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iCaFS4P9dNCTpYttS+52gy+VlJhNjCT0RHfxlGkpb+4OA4vHkbKpvTUAHjjXnMW1ZwC5CugSAchdTXTeV1im4Yms4DqJqacwoQKBgQCocPd7An8qTDIBZMOC4oT29+TYvUO+yMkAHLmx1h4QkLCkWegB4g5QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W";
$config["ali_public_key"] = $args["config"]["ali_public_key"] ?? "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB";
$result = (new AlipayK12Service($config))->alipayCommerceEducateSceneTokenCreateRequest($args["sub_code"] ?? "SCHOOL_FACE_PASS_QUERY",
$args["cert_type"] ?? "1", $args["cert_no"], $args["school_std_code"], $args["student_name"], $args["parent_phone"] ?? "", $args["out_user_id"],
$args["operator_user_id"] ?? "");
if (!$result["status"]) {
@@ -40,12 +40,11 @@ class FaceCollectionController extends ControllerBase
public function EducateSceneTokenQueryAction()
{
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+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeBtOJxt3vrK7o/kCWNh/4h9oENFhDIuTvLQk9tirKw0BSiZedjbEHqnqM+bgeuvxazCp9uqoYXgC/dtIooy1P8aso+ZrroC/0vZV7TQBGBjbSSkKPn7ShZM2hfYQFpmLznwpel7KJbP6AJ8atv99wjB6uvqNf6fMU7IbQKBgQCsG3mj0amsYbS5ZQZpl2v65QnlkAxv0dxc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"
]))->alipayCommerceEducateSceneTokenQueryRequest($args["user_token"] ?? "");
$args = $this->request->getJsonRawBody(true);
$config["ali_app_id"] = $args["config"]["ali_app_id"] ?? "2021004103604157";
$config["ali_private_key"] = $args["config"]["ali_private_key"] ?? "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeBtOJxt3vrK7o/kCWNh/4h9oENFhDIuTvLQk9tirKw0BSiZedjbEHqnqM+bgeuvxazCp9uqoYXgC/dtIooy1P8aso+ZrroC/0vZV7TQBGBjbSSkKPn7ShZM2hfYQFpmLznwpel7KJbP6AJ8atv99wjB6uvqNf6fMU7IbQKBgQCsG3mj0amsYbS5ZQZp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b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB";
$result = (new AlipayK12Service($config))->alipayCommerceEducateSceneTokenQueryRequest($args["user_token"] ?? "");
if (!$result["status"]) {
$this->api(Msg::NewError(500, $result["msg"]));
}


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

@@ -21,11 +21,11 @@ class FaceScanPayController extends ControllerBase
{
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+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeBtOJxt3vrK7o/kCWNh/4h9oENFhDI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Gyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB"
]))->alipayCommerceEducateFacepayApplyRequest($args["face_uid"] ?? "",$args["face_open_id"] ?? "", $args["school_std_code"] ?? "");
$config["ali_app_id"] = $args["config"]["ali_app_id"] ?? "2021004103604157";
$config["ali_private_key"] = $args["config"]["ali_private_key"] ?? "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeBtOJ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jBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB";
$result = (new AlipayK12Service($config))->alipayCommerceEducateFacepayApplyRequest($args["face_uid"] ?? "",$args["face_open_id"] ?? "", $args["school_std_code"] ?? "");
if (!$result["status"]) {
$this->api(Msg::NewError($result["data"]["code"] ?? 500, $result["msg"]));
}


+ 32
- 40
src/applet/app/controllers/Alipay/PayController.php View File

@@ -30,25 +30,22 @@ class PayController extends ControllerBase
public function tradeCreateAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
$config = $args["config"] ?? [
"pay_ali_app_id" => "2021004101651996",
"pay_ali_private_key" => "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15m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pay_ali_public_key" => "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB",
"ali_notify_url" => "http://pay.izhyin.com/CallBack/alipayAsyncNotifyCallBack",
];
$op_app_id = $args["op_app_id"] ?? "2021004103604157";
$args = $this->request->getJsonRawBody(true);
$config["pay_ali_app_id"] = $args["config"]["pay_ali_app_id"] ?? "2021004101651996";
$config["pay_ali_private_key"] = $args["config"]["pay_ali_private_key"] ?? "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtad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ep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W";
$config["pay_ali_public_key"] = $args["config"]["pay_ali_public_key"] ?? "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB";
$config["ali_notify_url"] = $args["config"]["pay_ali_public_key"] ?? "http://smart_canteen_pay.dengbiao.top//CallBack/alipayAsyncNotifyCallBack"; //异步回调

$op_app_id = $args["op_app_id"] ?? "";
$buyer_id = $args["buyer_id"] ?? "";
$total_amount = $args["total_amount"] ?? "";
$out_trade_no = $args["out_trade_no"] ?? "";
$subject = $args["subject"] ?? "";
$app_auth_token = $args["app_auth_token"] ?? "";

$result = (new AlipayService($config))->alipayTradeCreateRequest($op_app_id, $subject, $out_trade_no, $total_amount, $buyer_id, $app_auth_token);
$result = (new AlipayService($config))->alipayTradeCreateRequest($op_app_id, $subject, $out_trade_no, $total_amount, $buyer_id, $app_auth_token);
if (!$result["status"]) {
$this->api(["statusCode" => 500, "code" => $result["data"]["code"]*1, "msg" => $result["msg"] ?? $result["sub_msg"]]);
// $this->api(["code" => $result["code"], "msg" => $result["msg"] ?? $result["sub_msg"]]);

$this->api(["statusCode" => 500, "code" => $result["data"]["code"] * 1, "msg" => $result["msg"] ?? $result["sub_msg"]]);
}
$this->api($result["data"]);
}
@@ -58,26 +55,23 @@ class PayController extends ControllerBase
public function tradeCommonQueryAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
$config = $args["config"] ?? [
"pay_ali_app_id" => "2021004101651996",
"pay_ali_private_key" => "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeBtOJxt3vrK7o/kCWNh/4h9oENFhDIuTvLQk9tirKw0BSiZedjbEHqnqM+bgeuvxazCp9uqoYXgC/dtIooy1P8aso+ZrroC/0vZV7TQBGBjbSSkKPn7ShZM2hfYQFpmLznwpel7KJbP6AJ8atv99wjB6uvqNf6fMU7IbQKBgQCsG3mj0amsYbS5ZQZpl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c/LzLel6RuLQIDAQAB",
];
$out_trade_no = $args["out_trade_no"] ?? "";
$trade_no = $args["trade_no"] ?? "";
$app_auth_token = $args["app_auth_token"] ?? "";
$result = (new AlipayService($config))->tradeCommonQueryPay($out_trade_no, $trade_no, $app_auth_token);
if (!$result["status"]) {
$this->api(["statusCode" => 500, "code" => $result["data"]["code"]*1, "msg" => $result["msg"] ?? $result["sub_msg"]]);
// $this->api(["code" => $result["code"], "msg" => $result["msg"] ?? $result["sub_msg"]]);
$args = $this->request->getJsonRawBody(true);
$config["pay_ali_app_id"] = $args["config"]["pay_ali_app_id"] ?? "2021004101651996";
$config["pay_ali_private_key"] = $args["config"]["pay_ali_private_key"] ?? "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINM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obXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB";

$out_trade_no = $args["out_trade_no"] ?? "";
$trade_no = $args["trade_no"] ?? "";
$app_auth_token = $args["app_auth_token"] ?? "";
$result = (new AlipayService($config))->tradeCommonQueryPay($out_trade_no, $trade_no, $app_auth_token);
if (!$result["status"]) {
$this->api(["statusCode" => 500, "code" => $result["data"]["code"] * 1, "msg" => $result["msg"] ?? $result["sub_msg"]]);
}
$this->api([
"code" => $result["data"]["code"] ?? "",
"msg" => $result["data"]["msg"] ?? "",
"code" => $result["data"]["code"] ?? "",
"msg" => $result["data"]["msg"] ?? "",
"out_trade_no" => $result["data"]["out_trade_no"] ?? "",
"trade_no" => $result["data"]["trade_no"] ?? "",
"trade_no" => $result["data"]["trade_no"] ?? "",
"trade_status" => $result["data"]["trade_status"] ?? "",
]);
}
@@ -87,22 +81,20 @@ class PayController extends ControllerBase
public function tradeRefundAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
$config = $args["config"] ?? [
"pay_ali_app_id" => "2021004101651996",
"pay_ali_private_key" => "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0gar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kWegB4g5QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W",
"pay_ali_public_key" => "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB",
];
$args = $this->request->getJsonRawBody(true);
$config["pay_ali_app_id"] = $args["config"]["pay_ali_app_id"] ?? "2021004101651996";
$config["pay_ali_private_key"] = $args["config"]["pay_ali_private_key"] ?? "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjat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QkKkAGPWp3hshAj/KA0cXthFXVUG/SGZ2K6eB+nbon1N+9cDETdM4QXzN5gE/mUlupIxqRU1ouI27YYPbJSQNTrC7OkwNzfnpe/gshEj/gr5eHHvd4UrvMQKBgD2Toow7sfpV0R9rhO8aJ9njlbH15LqUK/AotK3E7zr73Uv5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W";
$config["pay_ali_public_key"] = $args["config"]["pay_ali_public_key"] ?? "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB";

$out_trade_no = $args["out_trade_no"] ?? "";
$refund_amount = $args["refund_amount"] ?? "";
$refund_reason = $args["refund_reason"] ?? "";
$out_request_no = $args["out_request_no"] ?? "";
$out_trade_no = $args["out_trade_no"] ?? "";
$refund_amount = $args["refund_amount"] ?? "";
$refund_reason = $args["refund_reason"] ?? "";
$out_request_no = $args["out_request_no"] ?? "";
$app_auth_token = $args["app_auth_token"] ?? "";

$result = (new AlipayService($config))->alipayTradeRefundRequest($out_trade_no, $refund_amount, $refund_reason, $out_request_no, $app_auth_token);
$result = (new AlipayService($config))->alipayTradeRefundRequest($out_trade_no, $refund_amount, $refund_reason, $out_request_no, $app_auth_token);
if (!$result["status"]) {
$this->api(["statusCode" => 500, "code" => $result["data"]["code"]*1, "msg" => $result["msg"] ?? $result["sub_msg"]]);
$this->api(["statusCode" => 500, "code" => $result["data"]["code"] * 1, "msg" => $result["msg"] ?? $result["sub_msg"]]);
}
$this->api($result["data"]);
}


+ 0
- 247
src/applet/app/controllers/Alipay/SplitAccountController.php View File

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

namespace SRVX\Api\Controllers\Alipay;

use SRVX\Api\Controllers\ControllerBase;
use SRVX\Msg;
use SRVX\Service\Common\SysCfgService;
use SRVX\Service\Pay\EasyAlipayService;
use SRVX\Service\Pay\ExtraAlipayService;
use SRVX\Service\Pay\PayService;
use App\constants\Common as ICommon;
use SRVX\Utils\Sredis;


class SplitAccountController extends ControllerBase
{

public function initialize()
{
parent::initialize();
}

public function indexAction()
{
$this->s->demo()->demo();
}

public function relationBindAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
$this->logger($args, "relationBindAction", true);
if (empty($args["app_id"]) || empty($args["merchant_id"]) || empty($args["out_request_no"]) || empty($args["receiver_list"])) {
$this->api(Msg::NewError(500, '缺少必要參數!'));
}
$uid = $this->userInfo["uid"];
$merchant_id = $args["merchant_id"] ?? "";
$app_id = $args["app_id"] ?? "";
$out_request_no = $args["out_request_no"] ?? "";
$receiver_list = $args["receiver_list"] ?? "";
$payService = new PayService();
$app = $payService->getPayConfig($app_id);
if ($app == false) $this->api(Msg::NewError(500, 'APP_ID有誤'));
//判斷app是否可用
if ($app->state != ICommon::APP_STATE_USE) $this->api(Msg::NewError(500, 'APP暫不可用'));
$config = [];
$notify_url = $this->redis->get(ICommon::ALI_PAY_NOTIFY_URL_CACHE_KEY);
if ($notify_url == false) $notify_url = (new SysCfgService())->getSet(['pay_ali_notify_url'])["pay_ali_notify_url"];
$appInfo = json_decode($app->alipay_configure, true);
if ($app->mode == ICommon::APP_MODE_INDEPENDENT) {
$config = [
"pay_ali_app_id" => $appInfo["app_id"],
"pay_ali_public_key" => $appInfo["public_key"],
"pay_ali_private_key" => $appInfo["private_key"],
];
}
//判斷店鋪號是否可以用
$merchantAlipayAuthorize = $payService->getAppAuthToken($merchant_id);
if ($merchantAlipayAuthorize == false) $this->api(Msg::NewError(500, '店鋪號有誤'));
if ($merchantAlipayAuthorize->state != ICommon::MERCHANT_STATE_USE) $this->api(Msg::NewError(500, '店鋪暫未授權'));
$app_auth_token = $merchantAlipayAuthorize->app_auth_token;
$result = (new EasyAlipayService($config))->splitAccountForRelationBind($out_request_no, $receiver_list, $app_auth_token);
if (!$result["status"]) {
//调用失败
$this->api(Msg::NewError(500, $result["msg"] ?? $result["sub_msg"]));
}
$this->api($result["data"]);
} else {
$this->api(Msg::NewError(500, '提交方式错误!'));
}
}

public function relationUnBindAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
if (empty($args["app_id"]) || empty($args["merchant_id"]) || empty($args["out_request_no"]) || empty($args["receiver_list"])) {
$this->api(Msg::NewError(500, '缺少必要參數!'));
}
$uid = $this->userInfo["uid"];
$merchant_id = $args["merchant_id"] ?? "";
$app_id = $args["app_id"] ?? "";
$out_request_no = $args["out_request_no"] ?? "";
$receiver_list = $args["receiver_list"] ?? "";
$payService = new PayService();
$app = $payService->getPayConfig($app_id);
if ($app == false) $this->api(Msg::NewError(500, 'APP_ID有誤'));
//判斷app是否可用
if ($app->state != ICommon::APP_STATE_USE) $this->api(Msg::NewError(500, 'APP暫不可用'));
$config = [];
$notify_url = $this->redis->get(ICommon::ALI_PAY_NOTIFY_URL_CACHE_KEY);
if ($notify_url == false) $notify_url = (new SysCfgService())->getSet(['pay_ali_notify_url'])["pay_ali_notify_url"];
$appInfo = json_decode($app->alipay_configure, true);
if ($app->mode == ICommon::APP_MODE_INDEPENDENT) {
$config = [
"pay_ali_app_id" => $appInfo["app_id"],
"pay_ali_public_key" => $appInfo["public_key"],
"pay_ali_private_key" => $appInfo["private_key"],
];
}
//判斷店鋪號是否可以用
$merchantAlipayAuthorize = $payService->getAppAuthToken($merchant_id);
if ($merchantAlipayAuthorize == false) $this->api(Msg::NewError(500, '店鋪號有誤'));
if ($merchantAlipayAuthorize->state != ICommon::MERCHANT_STATE_USE) $this->api(Msg::NewError(500, '店鋪暫未授權'));
$app_auth_token = $merchantAlipayAuthorize->app_auth_token;
$result = (new EasyAlipayService($config))->splitAccountForRelationUnbind($out_request_no, $receiver_list, $app_auth_token);
if (!$result["status"]) {
//调用失败
$this->api(Msg::NewError(500, $result["msg"] ?? $result["sub_msg"]));
}
$this->api($result["data"]);
}
$this->api(Msg::NewError(500, '提交方式错误!'));
}

public function relationBatchQueryAction()
{
if (!$this->request->isPost()) $this->api(Msg::NewError(500, '提交方式错误!'));
$args = $this->request->getJsonRawBody(true);
if (empty($args["app_id"]) || empty($args["merchant_id"]) || empty($args["out_request_no"]) || empty($args["page_num"]) || empty($args["page_size"])) {
$this->api(Msg::NewError(500, '缺少必要參數!'));
}
$uid = $this->userInfo["uid"];
$merchant_id = $args["merchant_id"] ?? "";
$app_id = $args["app_id"] ?? "";
$out_request_no = $args["out_request_no"] ?? "";
$page_num = $args["page_num"] ?? "";
$page_size = $args["page_size"] ?? "";
$payService = new PayService();
$app = $payService->getPayConfig($app_id);
if ($app == false) $this->api(Msg::NewError(500, 'APP_ID有誤'));
//判斷app是否可用
if ($app->state != ICommon::APP_STATE_USE) $this->api(Msg::NewError(500, 'APP暫不可用'));
$config = [];
$notify_url = $this->redis->get(ICommon::ALI_PAY_NOTIFY_URL_CACHE_KEY);
if ($notify_url == false) $notify_url = (new SysCfgService())->getSet(['pay_ali_notify_url'])["pay_ali_notify_url"];
$appInfo = json_decode($app->alipay_configure, true);
if ($app->mode == ICommon::APP_MODE_INDEPENDENT) {
$config = [
"pay_ali_app_id" => $appInfo["app_id"],
"pay_ali_public_key" => $appInfo["public_key"],
"pay_ali_private_key" => $appInfo["private_key"],
];
}
//判斷店鋪號是否可以用
$merchantAlipayAuthorize = $payService->getAppAuthToken($merchant_id);
if ($merchantAlipayAuthorize == false) $this->api(Msg::NewError(500, '店鋪號有誤'));
if ($merchantAlipayAuthorize->state != ICommon::MERCHANT_STATE_USE) $this->api(Msg::NewError(500, '店鋪暫未授權'));
$app_auth_token = $merchantAlipayAuthorize->app_auth_token;
$result = (new EasyAlipayService($config))->splitAccountForRelationBatchQuery($out_request_no, $page_num, $page_size, $app_auth_token);
if (!$result["status"]) {
//调用失败
$this->api(Msg::NewError(500, $result["msg"] ?? $result["sub_msg"]));
}
$this->api($result["data"]);
}

public function splitAccountForOrderSettleAction()
{
if (!$this->request->isPost()) $this->api(Msg::NewError(500, '提交方式错误!'));
$args = $this->request->getJsonRawBody(true);
$this->logger($args, "splitAccountForOrderSettle", true);
if (empty($args["app_id"]) || empty($args["merchant_id"]) || empty($args["out_request_no"]) || empty($args["trade_no"]) || empty($args["royalty_parameters"])) {
$this->api(Msg::NewError(500, '缺少必要參數!'));
}
$uid = $this->userInfo["uid"];
$merchant_id = $args["merchant_id"] ?? "";
$app_id = $args["app_id"] ?? "";
$out_request_no = $args["out_request_no"] ?? "";
$trade_no = $args["trade_no"] ?? "";
$royalty_parameters = $args["royalty_parameters"] ?? "";
$payService = new PayService();
$app = $payService->getPayConfig($app_id);
if ($app == false) $this->api(Msg::NewError(500, 'APP_ID有誤'));
//判斷app是否可用
if ($app->state != ICommon::APP_STATE_USE) $this->api(Msg::NewError(500, 'APP暫不可用'));
$config = [];
$notify_url = $this->redis->get(ICommon::ALI_PAY_NOTIFY_URL_CACHE_KEY);
if ($notify_url == false) $notify_url = (new SysCfgService())->getSet(['pay_ali_notify_url'])["pay_ali_notify_url"];
$appInfo = json_decode($app->alipay_configure, true);
if ($app->mode == ICommon::APP_MODE_INDEPENDENT) {
$config = [
"pay_ali_app_id" => $appInfo["app_id"],
"pay_ali_public_key" => $appInfo["public_key"],
"pay_ali_private_key" => $appInfo["private_key"],
];
}
//判斷店鋪號是否可以用
$merchantAlipayAuthorize = $payService->getAppAuthToken($merchant_id);
if ($merchantAlipayAuthorize == false) $this->api(Msg::NewError(500, '店鋪號有誤'));
if ($merchantAlipayAuthorize->state != ICommon::MERCHANT_STATE_USE) $this->api(Msg::NewError(500, '店鋪暫未授權'));
$app_auth_token = $merchantAlipayAuthorize->app_auth_token;
$result = (new EasyAlipayService($config))->splitAccountForOrderSettle($out_request_no, $trade_no, $royalty_parameters, $app_auth_token);
if (!$result["status"]) {
//调用失败
$this->api(Msg::NewError(500, $result["msg"] ?? $result["sub_msg"]));
}
$this->api($result["data"]);
}

public function splitAccountForRefundAction()
{
if (!$this->request->isPost()) $this->api(Msg::NewError(500, '提交方式错误!'));
$args = $this->request->getJsonRawBody(true);
$this->logger($args, "splitAccountForRefund", true);
if (empty($args["app_id"]) || empty($args["merchant_id"]) || empty($args["out_trade_no"]) || empty($args["trade_no"]) || empty($args["refund_amount"])
|| empty($args["refund_reason"]) || empty($args["out_request_no"]) || empty($args["refund_royalty_parameters"])) {
$this->api(Msg::NewError(500, '缺少必要參數!'));
}
$uid = $this->userInfo["uid"];
$merchant_id = $args["merchant_id"] ?? "";
$app_id = $args["app_id"] ?? "";
$out_trade_no = $args["out_trade_no"] ?? "";
$trade_no = $args["trade_no"] ?? "";
$refund_amount = $args["refund_amount"] ?? "";
$refund_reason = $args["refund_reason"] ?? "";
$out_request_no = $args["out_request_no"] ?? "";
$refund_royalty_parameters = $args["refund_royalty_parameters"] ?? "";
$payService = new PayService();
$app = $payService->getPayConfig($app_id);
if ($app == false) $this->api(Msg::NewError(500, 'APP_ID有誤'));
//判斷app是否可用
if ($app->state != ICommon::APP_STATE_USE) $this->api(Msg::NewError(500, 'APP暫不可用'));
$config = [];
$notify_url = $this->redis->get(ICommon::ALI_PAY_NOTIFY_URL_CACHE_KEY);
if ($notify_url == false) $notify_url = (new SysCfgService())->getSet(['pay_ali_notify_url'])["pay_ali_notify_url"];
$appInfo = json_decode($app->alipay_configure, true);
if ($app->mode == ICommon::APP_MODE_INDEPENDENT) {
$config = [
"pay_ali_app_id" => $appInfo["app_id"],
"pay_ali_public_key" => $appInfo["public_key"],
"pay_ali_private_key" => $appInfo["private_key"],
];
}
//判斷店鋪號是否可以用
$merchantAlipayAuthorize = $payService->getAppAuthToken($merchant_id);
if ($merchantAlipayAuthorize == false) $this->api(Msg::NewError(500, '店鋪號有誤'));
if ($merchantAlipayAuthorize->state != ICommon::MERCHANT_STATE_USE) $this->api(Msg::NewError(500, '店鋪暫未授權'));
$app_auth_token = $merchantAlipayAuthorize->app_auth_token;
$result = (new EasyAlipayService($config))->splitAccountForRefund($out_trade_no, $trade_no, $refund_amount, $refund_reason, $out_request_no, $refund_royalty_parameters, $app_auth_token);
if (!$result["status"]) {
//调用失败
$this->api(Msg::NewError(500, $result["msg"] ?? $result["sub_msg"]));
}
$this->api($result["data"]->httpBody);
}
}

+ 0
- 71
src/applet/app/controllers/Alipay/SystemOauthController.php View File

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

namespace SRVX\Api\Controllers\Alipay;

use App\constants\Common as ICommon;
use SRVX\Api\Controllers\ControllerBase;
use SRVX\Msg;
use SRVX\Service\Pay\AlipayService;
use SRVX\Service\Pay\EasyAlipayService;
use SRVX\Service\Pay\PayService;


class SystemOauthController extends ControllerBase
{

public function initialize()
{
parent::initialize();
}

public function authorizationCodeAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
if (empty($args["code"])) {
$this->api(Msg::NewError(500, '缺少必要參數!'));
}
$code = $args["code"];
$config = [
"pay_ali_app_id" => "2021002188623414",
"pay_ali_public_key" => "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzEC7+3O/Ej/gkXug6EgcCM3LjWzz11RR6ESo0KshGg3ODgM8DfdKDHD5b1T6VbcRGFobXQBqVtW008ocUnSOZzE67a73l6mKT3FbmhRsbrgwcUuOHEJUZaLFxPibJgFl7fkOjBcIiz+Wc+9VDTt8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfX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bF9XCIXhAKxzxGQLn3xNuGSJywYds3TNzcNwB8HU64zMWwb/nZmatJ2ZKmiPlP19FBgZCuvu4XzYe58oQ2R77l7Exfug2PJrS0gP26vBo7xuvKevrBx+MfkXzjAM+Iu2gadYgHfA67x6B8CgYBdHcPsdV+Vs3ut9xc5SeLZSMOrS6XP9LybKA5pO0vRnyQelWc/VURX89BKTf4tP6zbYndLnB2dowX/IuJE8l7l5SUnwlX+Q1S/SnfqdtoakLUy9kdwZG21/KJ+WAMKXlfMYgVFs1itzXO6WvQKaHepWLfH5jxIgSRbGRh9N0qo+QKBgQCYQmVwMYCfkwz1DUqe1reMVNSKqIcdeTiFEKwV5t2oaQgsrcD2zbH5AXmwzEaUktbKckwv30oveOn582C9fxex+1EOmBD+fqew40dQQURSsIaHZJdXBc/NcblBuUjxk6goiXQdWMqDclKsYqk/i/xvdzwvEXAVVQ7gY9Tz8dXUBQKBgCUrvC3WcnErwzK6RmayjMAA5G15nKgMdeQU+SZXQih8DHx0peCsmJN1LJdiggZqxu5zB+L6v77kiN3rRBs5p8cb7izWQWAn4J8/504tn/oyvFSyBxLIlLByBqcr35QtWb5qgJPlIj9COGAsVagXr3KA/weq1rnbX1LGf2ww1ONi",
];

$app_auth_token = (isset($args["app_auth_token"]) AND !empty($args["app_auth_token"])) ? $args["app_auth_token"] :"202111BB0c1ab02eb52f4d07a7b842d7ee7a3C30";
$result = (new EasyAlipayService($config))->systemOauthTokenOrRefreshToken($app_auth_token, $code);
if (!$result["status"]) {
//调用失败
$this->api(Msg::NewError(500, $result["msg"] ?? $result["sub_msg"]));
}
$this->api($result);
}
$this->api(Msg::NewError(500, '提交方式错误!'));
}

public function refreshTokenAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);
if (empty($args["refresh_token"])) {
$this->api(Msg::NewError(500, '缺少必要參數!'));
}

$refresh_token = $args["refresh_token"];
$config = [
"pay_ali_app_id" => "2021002188623414",
"pay_ali_public_key" => "MIIBIjANBgkqhkiG9w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3AMyfZjTs6IN1bEda0Rel2R6kCgYEA+lSmsxTQYKTXq1jKTOxHsagNJfHFm9g6Ikh5qQaANYuqCKCFSjUXTfvtlP65UYfC9OyvTxxC4/fjoJLdUrGYi1TRvasrCl4/v87YgQbU8ExyYFqsFLUFog8rO8dOw3bVilzkACytKDNDJKK1+vb4OiOXE+kb8O9lYb11qNZPA60CgYEApUIajSSKfUFroPkWg2J7FQnzMasHCbF9XCIXhAKxzxGQLn3xNuGSJywYds3TNzcNwB8HU64zMWwb/nZmatJ2ZKmiPlP19FBgZCuvu4XzYe58oQ2R77l7Exfug2PJrS0gP26vBo7xuvKevrBx+MfkXzjAM+Iu2gadYgHfA67x6B8CgYBdHcPsdV+Vs3ut9xc5SeLZSMOrS6XP9LybKA5pO0vRnyQelWc/VURX89BKTf4tP6zbYndLnB2dowX/IuJE8l7l5SUnwlX+Q1S/SnfqdtoakLUy9kdwZG21/KJ+WAMKXlfMYgVFs1itzXO6WvQKaHepWLfH5jxIgSRbGRh9N0qo+QKBgQCYQmVwMYCfkwz1DUqe1reMVNSKqIcdeTiFEKwV5t2oaQgsrcD2zbH5AXmwzEaUktbKckwv30oveOn582C9fxex+1EOmBD+fqew40dQQURSsIaHZJdXBc/NcblBuUjxk6goiXQdWMqDclKsYqk/i/xvdzwvEXAVVQ7gY9Tz8dXUBQKBgCUrvC3WcnErwzK6RmayjMAA5G15nKgMdeQU+SZXQih8DHx0peCsmJN1LJdiggZqxu5zB+L6v77kiN3rRBs5p8cb7izWQWAn4J8/504tn/oyvFSyBxLIlLByBqcr35QtWb5qgJPlIj9COGAsVagXr3KA/weq1rnbX1LGf2ww1ONi",
];
$app_auth_token = "202111BB0c1ab02eb52f4d07a7b842d7ee7a3C30";
$result = (new EasyAlipayService($config))->systemOauthTokenOrRefreshToken($app_auth_token, "", $refresh_token,"refresh_token");
if (!$result["status"]) {
//调用失败
$this->api(Msg::NewError(500, $result["msg"] ?? $result["sub_msg"]));
}
$this->api($result);
}
$this->api(Msg::NewError(500, '提交方式错误!'));
}

}

+ 0
- 41
src/applet/app/controllers/Alipay/SystemOauthTokenController.php View File

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

namespace SRVX\Api\Controllers\Alipay;

use SRVX\Api\Controllers\ControllerBase;
use SRVX\Msg;
use SRVX\Service\Pay\AlipayServiceToSystemOauthToken;
use SRVX\Service\Pay\AlipayServiceToTransfer;


class SystemOauthTokenController extends ControllerBase
{

public function initialize()
{
parent::initialize();
}

public function indexAction()
{
try {
$data = $this->request->getJsonRawBody(true);
$config = [
"pay_ali_app_id" => "2021004103604157",
"pay_ali_private_key" => "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1MC7QX9tSqUFyAevMpgZ6P7JZM1nLfECzfwzwqjAES/Nn1mDVYTCmXvu+XcRtadnWMxUAaHcwGIwgqZa8xnLa220OKuHETOhQIcgWFL+WAakS6gRgT4Y2BJqWV1aJqsFpPR15mZ3SO8JqXhznolsknqw8sO+DBJu+QXn1HdntSGWrLU4GblPlYAs64y/MzPMUWfA4ShDRn9MZK6ypnh2GB5ezgnFxx1jRGOy96IqikI8f+M/CVdgzErLIl+qTd/IbfL8B6Gccb4ZwimL/x1H1bqYCA6xINMZLo5eDHCvBTU4AW7sItw1Q7MQ8l3wBl7hW62gQKBgQDZT1SEaeB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t8O4YxIZhAL6L6ppXcrVrCkOaiIiuHGyp7FjQ+5s3Lk3NLSO3TfXw1WEX2F+IHnw32ZN/FlC8rF8HVlgM0w/PZJ9RuadoLqn5H6z/iqrurbtxscnx0Qbdt8CBzREabJnWxHjxO936AXu9njIPvsXkTfaJJIXxRGGb0b8peSiCljwi8UEODe8mjl2c/LzLel6RuLQIDAQAB"
];
$code = $data["code"] ?? "";
$refresh_token = $data["refresh_token"] ?? "";
$this->logger($data, 'SystemOauthTokenController', true);
$AlipayServiceToTransfer = new AlipayServiceToSystemOauthToken($config);
$result = $AlipayServiceToTransfer->systemOauthToken($code, $refresh_token);
if (!$result["status"]) {
$this->api(["code" => "500", "sub_msg" => $result["msg"] ?? $result["sub_msg"]]);
}
$this->api($result['data']);
} catch (\Exception $exception) {
$this->api(Msg::NewError(500, $exception->getMessage()));
}
}
}

+ 0
- 38
src/applet/app/controllers/Alipay/TransferController.php View File

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

namespace SRVX\Api\Controllers\Alipay;

use SRVX\Api\Controllers\ControllerBase;
use SRVX\Msg;
use SRVX\Service\Pay\AlipayServiceToTransfer;


class TransferController extends ControllerBase
{

public function initialize()
{
parent::initialize();
}

public function indexAction()
{
try {
$data = $this->request->getJsonRawBody(true);

if ($data["config"]["pay_ali_use_type"] == "1") {//新接口
$data["config"]["pay_ali_new_app_cert_sn"] = base64_decode($data["config"]["pay_ali_new_app_cert_sn"]);
$data["config"]["pay_ali_new_alipayrsa_public_key"] = base64_decode($data["config"]["pay_ali_new_alipayrsa_public_key"]);
} else {
$data["config"]["pay_ali_public_key"] = base64_decode($data["config"]["pay_ali_public_key"]);
}

$AlipayServiceToTransfer = new AlipayServiceToTransfer($data["config"]);
$result = $AlipayServiceToTransfer->transfer($data["args"]);
logger($result, 'alipay_Transfer_index', true);
$this->api($result['data']);
} catch (\Exception $exception) {
$this->api(Msg::NewError(500, $exception->getMessage()));
}
}
}

+ 53
- 104
src/applet/app/controllers/CallBackController.php View File

@@ -3,12 +3,10 @@
namespace SRVX\Api\Controllers;

use App\constants\Pay as IPay;
use App\constants\Common as ICommon;
use SRVX\Model\MerchantAlipayAuthorize;
use SRVX\Model\OwnOrder;
use SRVX\Model\UserMerchantOrder;
use SRVX\Msg;
use SRVX\Service\Pay\AlipayService;
use SRVX\Service\Pay\EasyAlipayService;
use SRVX\Service\Pay\PayService;
use SRVX\Service\Pay\Wx\PayService as WxPayService;
@@ -39,7 +37,8 @@ class CallBackController extends \Phalcon\Mvc\Controller
}


protected function RSA2($data,$pikey){
protected function RSA2($data, $pikey)
{
$res = "-----BEGIN RSA PRIVATE KEY-----\n" . wordwrap($pikey, 64, "\n", true) . "\n-----END RSA PRIVATE KEY-----";
// 请注意密钥 是不是有带 -----BEGIN RSA PRIVATE KEY----- -----END RSA PRIVATE KEY-----
$piKey = openssl_pkey_get_private($res);
@@ -52,6 +51,7 @@ class CallBackController extends \Phalcon\Mvc\Controller
return $sign;
}
}

/**
* 支付宝 - 公共网关回调
*/
@@ -69,24 +69,24 @@ class CallBackController extends \Phalcon\Mvc\Controller
$secretKey = "HOrPS0V4BthAPfgSdbHWwy0TwPnC8TQAQZIOjc8vOzI=";
//配置应用公私钥 中生成的私钥
$privateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCSGJ9ob4kmGy6y4YeynjKJc/LSg02EXjLErPZSfVrAOy69FTRfBDbazlxpfl6YCAxDdT5ZcspB5kS2XYOY4dmqqPmF4VywmcjmZM8IxZFl1p7YC8BOlP6JrzDPwVl3hn4z3Em1byj8ANLY/AxAaW9W43FSIX+cSfdJThTlxGcbHZFM3kqu++hgFc/E+ar1nB0garqh03ESjatO4b6tuHM57ou7M+fXsoIf3gaL1IDZpeAoRh5sLCBLIbLz55tF0DcOaFsK7NUImnabJDRtrM1IN0lDZkQYAzL+JFsAq+ncRJm60Vd1jq/pXML/cFVHQQgdnjUd2u2NJTSMiCKCftmdAgMBAAECggEARzt+LduEEXJbeJiCI1M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v5j/BIKS4dVC7T56L2khEUbM/y8+Rig6CdyFf3A4i4GKfbp56Sap/Haa9OP6jfep6VW7Aa1AJxPvIPgPZ2U+EuRxrwrP1EBcL5z6Cern9c9Zzs8BPUacU+Q5e8c87W';
$publicKey = "xxxxxxx";
$iv = "";
$publicKey = "xxxxxxx";
$iv = "";

$response = [
"code" => "10000",
"msg" => "Success",
"code" => "10000",
"msg" => "Success",
"face_group_key" => "K12_2088323332233424",
];

// 3、业务处理结果加签,业务返回结果需要进行排序
ksort($response);//数组排序
$contentToSign = json_encode($response);//数组转json
$contentToSign = json_encode($response);//数组转json
$responseSecretText = $this->encrypt($contentToSign, $secretKey, $iv);//加密方法,只有当前调用的业务接口需要加解密时才需要

//用 接入准备 > 3.配置应用公私钥 中生成的私钥,对第4步的加密字符串进行加签,放到 sign 参数里。
$sign1 = $this->RSA2($responseSecretText, $privateKey);//加签
$sign1 = $this->RSA2($responseSecretText, $privateKey);//加签
$result = [
"sign" => $sign1,
"sign" => $sign1,
"response" => $responseSecretText
];

@@ -104,22 +104,21 @@ class CallBackController extends \Phalcon\Mvc\Controller
try {
$verify_result = (new EasyAlipayService())->verifyNotify($_POST);
logger(json_encode([
"msg" => "异步回调",
"msg" => "异步回调",
"data" => $_POST,
"res" => $verify_result
"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'];
$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" => "异步回调失败-訂單未查到",
"msg" => "异步回调失败-訂單未查到",
"data" => $_POST,
], 320), 'common_alipay_sync_notify_not_find', true);
//验证失败
@@ -129,7 +128,7 @@ class CallBackController extends \Phalcon\Mvc\Controller
//商户网站中已经做过处理
if ($model->status != IPay::PAY_STATE_FOR_WAIT) {
logger(json_encode([
"msg" => "异步回调已处理",
"msg" => "异步回调已处理",
"data" => $_POST,
], 320), 'alipay_sync_notify_already', true);
echo "success";
@@ -137,64 +136,14 @@ class CallBackController extends \Phalcon\Mvc\Controller
}

$model->return_data = json_encode($_POST);
$model->trade_no = $trade_no;
$model->updated_at = date("Y-m-d H:i:s");
$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 PayService())->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') {
$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();
}
echo "success";
die();
} else {
logger(json_encode([
"msg" => "异步回调驗證失败",
"msg" => "异步回调驗證失败",
"data" => $_POST,
], 320), 'alipay_sync_notify_verify_fail', true);
//验证失败
@@ -203,8 +152,8 @@ class CallBackController extends \Phalcon\Mvc\Controller
}
} catch (\Exception $e) {
logger(json_encode([
"msg" => "异步回调處理异常",
"data" => $params ?? [],
"msg" => "异步回调處理异常",
"data" => $params ?? [],
"exception" => $e->getMessage()
], 320), 'alipay_sync_notify_exception', true);
//回調異常
@@ -227,13 +176,13 @@ class CallBackController extends \Phalcon\Mvc\Controller
}
$inWechatpaySignature = $_SERVER["HTTP_WECHATPAY_SIGNATURE"] ?? "";
$inWechatpayTimestamp = $_SERVER["HTTP_WECHATPAY_TIMESTAMP"] ?? "";
$inWechatpaySerial = $_SERVER["HTTP_WECHATPAY_SERIAL"] ?? ""; //暫時未用到
$inWechatpayNonce = $_SERVER["HTTP_WECHATPAY_NONCE"] ?? "";
$inWechatpaySerial = $_SERVER["HTTP_WECHATPAY_SERIAL"] ?? ""; //暫時未用到
$inWechatpayNonce = $_SERVER["HTTP_WECHATPAY_NONCE"] ?? "";
$this->logger([
"inWechatpaySignature" => $inWechatpaySignature,
"inWechatpayTimestamp" => $inWechatpayTimestamp,
"inWechatpaySerial" => $inWechatpaySerial,
"inWechatpayNonce" => $inWechatpayNonce,
"inWechatpaySerial" => $inWechatpaySerial,
"inWechatpayNonce" => $inWechatpayNonce,
], 'wx_pay_async_notify_call_back', true);

if (empty($post) || $post == null || $post == '') {
@@ -284,7 +233,7 @@ class CallBackController extends \Phalcon\Mvc\Controller
if (!$model) {
//未查到訂單
logger(json_encode([
"msg" => "异步回调失败-訂單未查到",
"msg" => "异步回调失败-訂單未查到",
"data" => $_POST,
], 320), 'common_wx_sync_notify_not_find', true);
//验证失败
@@ -293,64 +242,64 @@ class CallBackController extends \Phalcon\Mvc\Controller
//商户网站中已经做过处理
if ($model->status != IPay::PAY_STATE_FOR_WAIT) {
logger(json_encode([
"msg" => "异步回调已处理",
"msg" => "异步回调已处理",
"data" => $_POST,
], 320), 'wxpay_sync_notify_already', true);
$this->wxApi(Msg::WxSuc);
}

$model->return_data = json_encode($data);
$model->trade_no = $trade_no;
$model->updated_at = date("Y-m-d H:i:s");
$model->trade_no = $trade_no;
$model->updated_at = date("Y-m-d H:i:s");

#TODO::回調第三方平台的 notify_url
$notify_url = $data["attach"];
$notify_url = $data["attach"];
$out_trade_no = $model->out_trade_no;
$ext_info = json_decode($model->ext, true) ?? [];
$isOk = (new PayService())->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
$ext_info = json_decode($model->ext, true) ?? [];
$isOk = (new PayService())->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 == 'FINISHED' || $trade_status == 'TRADE_SUCCESS') {
$model->status = IPay::PAY_STATE_FOR_ALREADY;
if ($model->save() == false) {
logger(json_encode([
"msg" => "异步回调-支付成功-更新訂單失敗",
"msg" => "异步回调-支付成功-更新訂單失敗",
"data" => $_POST,
], 320), 'wxpay_sync_notify_success_update_fail', true);
$this->wxApi(Msg::WxErr);
}
logger(json_encode([
"msg" => "异步回调支付成功",
"msg" => "异步回调支付成功",
"data" => $_POST,
], 320), 'wxpay_sync_notify_success', true);
} else {
$model->status = IPay::PAY_STATE_FOR_FAIL;
if ($model->save() == false) {
logger(json_encode([
"msg" => "异步回调-支付失敗-更新訂單失敗",
"msg" => "异步回调-支付失敗-更新訂單失敗",
"data" => $_POST,
], 320), 'wxpay_sync_notify_fail_update_fail', true);
$this->wxApi(Msg::WxErr);
}
logger(json_encode([
"msg" => "异步回调支付失敗",
"msg" => "异步回调支付失敗",
"data" => $_POST,
], 320), 'wxpay_sync_notify_fail', true);
}
$this->wxApi(Msg::WxSuc);
} else {
logger(json_encode([
"msg" => "异步回调 - 回調第三方平台失敗",
"url" => $notify_url,
"msg" => "异步回调 - 回調第三方平台失敗",
"url" => $notify_url,
"data" => ["out_trade_no" => $out_trade_no,
"trade_no" => $trade_no,
"pay_trade_no" => $self_order_sn,
"trade_status" => $trade_status,
"ext_info" => $ext_info
"trade_no" => $trade_no,
"pay_trade_no" => $self_order_sn,
"trade_status" => $trade_status,
"ext_info" => $ext_info
],
"isOk" => false
], 320), 'wxpay_sync_notify_fail', true);
@@ -358,7 +307,7 @@ class CallBackController extends \Phalcon\Mvc\Controller
}
} else {
logger(json_encode([
"msg" => "异步回调驗證失败",
"msg" => "异步回调驗證失败",
"data" => $_POST,
], 320), 'wxpay_sync_notify_verify_fail', true);
//验证失败
@@ -366,8 +315,8 @@ class CallBackController extends \Phalcon\Mvc\Controller
}
} catch (\Exception $e) {
logger(json_encode([
"msg" => "异步回调處理异常",
"data" => $params ?? [],
"msg" => "异步回调處理异常",
"data" => $params ?? [],
"exception" => $e->getMessage()
], 320), 'wxpay_sync_notify_exception', true);
//回調異常


Loading…
Cancel
Save