DengBiao пре 1 година
родитељ
комит
0012a8cd0c
2 измењених фајлова са 88 додато и 0 уклоњено
  1. +18
    -0
      src/applet/app/controllers/Alipay/BPassController.php
  2. +70
    -0
      src/common/Service/AliBPass/demo/AliEcoService.php

+ 18
- 0
src/applet/app/controllers/Alipay/BPassController.php Прегледај датотеку

@@ -54,6 +54,24 @@ class BPassController extends ControllerBase
}
}

public function AlipayPlanetEcocampusApiRosterPageQueryBlackListAction()
{
if ($this->request->isPost()) {
$args = $this->request->getJsonRawBody(true);

$result = (new AliEcoService())->alipayPlanetEcocampusApiRosterPageQueryBlackList(
$args["school_code"], $args["page_no"], $args["page_size"]
);

if (!$result["status"]) {
$this->api(Msg::NewError($result["data"]["code"] ?? 500, $result["msg"]));
}
$this->api($result["data"]);
} else {
$this->api(Msg::NewError(500, '提交方式错误!'));
}
}

public function AlipayPlanetEcocampusApiDebtRepayAction()
{
if ($this->request->isPost()) {


+ 70
- 0
src/common/Service/AliBPass/demo/AliEcoService.php Прегледај датотеку

@@ -171,6 +171,76 @@ class AliEcoService extends BaseService
// }
}


/**
* alipay.planet.ecocampus.api.roster.pageQueryBlacklist(黑名单列表分页查询)
* @param $school_code string 学校内标
* @param $page_no int
* @param $page_size int
* @return array
*/
public function alipayPlanetEcocampusApiRosterPageQueryBlackList($school_code, $page_no, $page_size): 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["req"] = [
"black_type" => "DEBT",
"school_code" => $school_code,
];
$bizContent["page_no"] = $page_no;
$bizContent["page_size"] = $page_size;

// 指定需要调用的service接口
$params["service"] = "alipay.planet.ecocampus.api.roster.pageQueryBlacklist";
$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);

$jsonStr = json_encode($result);


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

// 验签
// $verifyRes = checkResponse($resMapData, $client->alipayrsaPublicKey);
//
// if ($verifyRes) {
// echo "响应验签成功";
$responseData = $resMapData["response"];
if ($responseData['code'] == 10000) {
return $this->returnRes(true, $responseData["msg"], $responseData);
} else {
return $this->returnRes(false, ($responseData['sub_msg'] ?? $responseData['msg']), $resMapData);
}
// } else {
//// echo "响应验签失败";
// return $this->returnRes(false, "响应验签失败", []);
//
// }
}

/**
* alipay.planet.ecocampus.api.debt.repay(支付欠款)
* @param $out_order_no string 外部订单号


Loading…
Откажи
Сачувај