浏览代码

update

master
DengBiao 11 个月前
父节点
当前提交
47df4ef889
共有 2 个文件被更改,包括 128 次插入29 次删除
  1. +28
    -4
      src/applet/app/controllers/Alipay/BPassController.php
  2. +100
    -25
      src/common/Service/AliBPass/demo/AliEcoService.php

+ 28
- 4
src/applet/app/controllers/Alipay/BPassController.php 查看文件

@@ -21,7 +21,7 @@ class BPassController extends ControllerBase
$args = $this->request->getJsonRawBody(true);

$result = (new AliEcoService())->alipayPlanetEcocampusApiRosterSignUpInfo(
$args["face_uid"],$args["parent_uid"],
$args["face_uid"], $args["parent_uid"],
$args["parent_logon_id"], $args["roster_name"],
$args["out_roster_code"], $args["school_code"], $args["school_name"],
$args["face_open_status"], $args["scan_face_pay_status"]
@@ -42,7 +42,7 @@ class BPassController extends ControllerBase
$args = $this->request->getJsonRawBody(true);

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

if (!$result["status"]) {
@@ -78,7 +78,7 @@ class BPassController extends ControllerBase
$args = $this->request->getJsonRawBody(true);

$result = (new AliEcoService())->alipayPlanetEcocampusApiDebtRepay(
$args["out_order_no"],$args["merchant_code"]
$args["out_order_no"], $args["merchant_code"]
);

if (!$result["status"]) {
@@ -96,7 +96,7 @@ class BPassController extends ControllerBase
$args = $this->request->getJsonRawBody(true);

$result = (new AliEcoService())->alipayPlanetEcocampusApiDebtCancel(
$args["out_order_no"],$args["merchant_code"]
$args["out_order_no"], $args["merchant_code"]
);

if (!$result["status"]) {
@@ -126,4 +126,28 @@ class BPassController extends ControllerBase
}
}

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

$result = (new AliEcoService())->alipayPlanetEcocampusApiRosterSingleConsumeLimitSync(
$args["school_code"] ?? "",
$args["face_uid"] ?? "",
$args["roster_name"] ?? "",
$args["daily_consume_limit"] ?? "100",
$args["single_consume_limit"] ?? "20",
$args["daily_max_consume_times"] ?? "10",
$args["roster_period_consume_limit_config_list"] ?? [],
);

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

}

+ 100
- 25
src/common/Service/AliBPass/demo/AliEcoService.php 查看文件

@@ -122,11 +122,11 @@ class AliEcoService extends BaseService
$client->format = $this->format;

// 业务参数
$bizContent["req"] = [
"face_uid" => $face_uid,
$bizContent["req"] = [
"face_uid" => $face_uid,
"school_code" => $school_code,
];
$bizContent["page_no"] = $page_no;
$bizContent["page_no"] = $page_no;
$bizContent["page_size"] = $page_size;

// 指定需要调用的service接口
@@ -158,12 +158,12 @@ class AliEcoService extends BaseService
//
// 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);
}
$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, "响应验签失败", []);
@@ -192,11 +192,11 @@ class AliEcoService extends BaseService
$client->format = $this->format;

// 业务参数
$bizContent["req"] = [
"black_type" => "DEBT",
$bizContent["req"] = [
"black_type" => "DEBT",
"school_code" => $school_code,
];
$bizContent["page_no"] = $page_no;
$bizContent["page_no"] = $page_no;
$bizContent["page_size"] = $page_size;

// 指定需要调用的service接口
@@ -228,12 +228,12 @@ class AliEcoService extends BaseService
//
// 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);
}
$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, "响应验签失败", []);
@@ -261,8 +261,8 @@ class AliEcoService extends BaseService
$client->format = $this->format;

// 业务参数
$bizContent["merchant_code"] = $merchant_code;
$bizContent["out_order_no"] = $out_order_no;
$bizContent["merchant_code"] = $merchant_code;
$bizContent["out_order_no"] = $out_order_no;

// 指定需要调用的service接口
$params["service"] = "alipay.planet.ecocampus.api.debt.repay";
@@ -326,8 +326,8 @@ class AliEcoService extends BaseService
$client->format = $this->format;

// 业务参数
$bizContent["merchant_code"] = $merchant_code;
$bizContent["out_order_no"] = $out_order_no;
$bizContent["merchant_code"] = $merchant_code;
$bizContent["out_order_no"] = $out_order_no;

// 指定需要调用的service接口
$params["service"] = "alipay.planet.ecocampus.api.debt.cancel";
@@ -392,9 +392,9 @@ class AliEcoService extends BaseService
$client->format = $this->format;

// 业务参数
$bizContent["consume_limit_sync_info"] = $consume_limit_sync_info;
$bizContent["school_code"] = $school_code;
$bizContent["school_name"] = $school_name;
$bizContent["consume_limit_sync_info"] = $consume_limit_sync_info;
$bizContent["school_code"] = $school_code;
$bizContent["school_name"] = $school_name;

// 指定需要调用的service接口
$params["service"] = "alipay.planet.ecocampus.api.roster.consumeLimit";
@@ -438,6 +438,81 @@ class AliEcoService extends BaseService
}
}

/**
* alipay.planet.ecocampus.api.roster.singleConsumeLimitSync(用户消费限制同步)
* @param $school_code string 学校内标
* @param $face_uid string 学生刷脸编号
* @param $roster_name string 花名册名称
* @param $daily_consume_limit string 单日金额上限,上限999
* @param $single_consume_limit string 单笔金额上限,上限99
* @param $daily_max_consume_times string 单日最大消费次数,上限99,如需设置需要大于餐段次数之和,否则,可能会导致餐段消费次数不足
* @param $roster_period_consume_limit_config_list array 餐段设置,如需设置支持2-4个餐段。餐段时间不能有重叠
* @return array
*/
public function alipayPlanetEcocampusApiRosterSingleConsumeLimitSync($school_code, $face_uid, $roster_name, $daily_consume_limit, $single_consume_limit, $daily_max_consume_times, $roster_period_consume_limit_config_list = []): 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["school_code"] = $school_code;
$bizContent["face_uid"] = $face_uid;
$bizContent["roster_name"] = $roster_name;
$bizContent["daily_consume_limit"] = $daily_consume_limit;
$bizContent["single_consume_limit"] = $single_consume_limit;
$bizContent["daily_max_consume_times"] = $daily_max_consume_times;
$bizContent["roster_period_consume_limit_config_list"] = $roster_period_consume_limit_config_list;

// 指定需要调用的service接口
$params["service"] = "alipay.planet.ecocampus.api.roster.singleConsumeLimitSync";
$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, 'alipayPlanetEcocampusApiRosterSingleConsumeLimitSync', 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, "响应验签失败", []);

}
}

}




正在加载...
取消
保存