$_kernel
$_kernel
createImageTextContent(string $title, string $cover, string $content, string $contentComment, string $ctype, string $benefit, string $extTags, string $loginIds) : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageContentCreateResponse
string | $title | |
string | $cover | |
string | $content | |
string | $contentComment | |
string | $ctype | |
string | $benefit | |
string | $extTags | |
string | $loginIds |
modifyImageTextContent(string $contentId, string $title, string $cover, string $content, string $couldComment, string $ctype, string $benefit, string $extTags, string $loginIds) : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageContentModifyResponse
string | $contentId | |
string | $title | |
string | $cover | |
string | $content | |
string | $couldComment | |
string | $ctype | |
string | $benefit | |
string | $extTags | |
string | $loginIds |
sendText(string $text) : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageTotalSendResponse
string | $text |
sendImageText(\Alipay\EasySDK\Marketing\OpenLife\Models\Article[] $articles) : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageTotalSendResponse
\Alipay\EasySDK\Marketing\OpenLife\Models\Article[] | $articles |
sendSingleMessage(string $toUserId, \Alipay\EasySDK\Marketing\OpenLife\Models\Template $template) : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageSingleSendResponse
string | $toUserId | |
\Alipay\EasySDK\Marketing\OpenLife\Models\Template | $template |
recallMessage(string $messageId) : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicLifeMsgRecallResponse
string | $messageId |
setIndustry(string $primaryIndustryCode, string $primaryIndustryName, string $secondaryIndustryCode, string $secondaryIndustryName) : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicTemplateMessageIndustryModifyResponse
string | $primaryIndustryCode | |
string | $primaryIndustryName | |
string | $secondaryIndustryCode | |
string | $secondaryIndustryName |
getIndustry() : \Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicSettingCategoryQueryResponse
optional( $key, $value) : $this
设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
$key | String 业务请求参数名称(biz_content下的字段名,比如timeout_express) |
|
$value | object 业务请求参数的值,一个可以序列化成JSON的对象 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存 如果该字段是一个数值型类型(比如:Number),请使用Long储存 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值 如果该字段是一个数组,请使用array储存各个值 |
<?php
// This file is auto-generated, don't edit it. Thanks.
namespace Alipay\EasySDK\Marketing\OpenLife;
use Alipay\EasySDK\Kernel\EasySDKKernel;
use AlibabaCloud\Tea\Tea;
use AlibabaCloud\Tea\Request;
use AlibabaCloud\Tea\Exception\TeaError;
use \Exception;
use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
use Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageContentCreateResponse;
use AlibabaCloud\Tea\Response;
use Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageContentModifyResponse;
use Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageTotalSendResponse;
use Alipay\EasySDK\Marketing\OpenLife\Models\Text;
use Alipay\EasySDK\Marketing\OpenLife\Models\Article;
use Alipay\EasySDK\Marketing\OpenLife\Models\Template;
use Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicMessageSingleSendResponse;
use Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicLifeMsgRecallResponse;
use Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicTemplateMessageIndustryModifyResponse;
use Alipay\EasySDK\Marketing\OpenLife\Models\AlipayOpenPublicSettingCategoryQueryResponse;
class Client {
protected $_kernel;
public function __construct($kernel){
$this->_kernel = $kernel;
}
/**
* @param string $title
* @param string $cover
* @param string $content
* @param string $contentComment
* @param string $ctype
* @param string $benefit
* @param string $extTags
* @param string $loginIds
* @return AlipayOpenPublicMessageContentCreateResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function createImageTextContent($title, $cover, $content, $contentComment, $ctype, $benefit, $extTags, $loginIds){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.message.content.create",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"title" => $title,
"cover" => $cover,
"content" => $content,
"could_comment" => $contentComment,
"ctype" => $ctype,
"benefit" => $benefit,
"ext_tags" => $extTags,
"login_ids" => $loginIds
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.message.content.create");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicMessageContentCreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicMessageContentCreateResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $contentId
* @param string $title
* @param string $cover
* @param string $content
* @param string $couldComment
* @param string $ctype
* @param string $benefit
* @param string $extTags
* @param string $loginIds
* @return AlipayOpenPublicMessageContentModifyResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function modifyImageTextContent($contentId, $title, $cover, $content, $couldComment, $ctype, $benefit, $extTags, $loginIds){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.message.content.modify",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"content_id" => $contentId,
"title" => $title,
"cover" => $cover,
"content" => $content,
"could_comment" => $couldComment,
"ctype" => $ctype,
"benefit" => $benefit,
"ext_tags" => $extTags,
"login_ids" => $loginIds
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.message.content.modify");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicMessageContentModifyResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicMessageContentModifyResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $text
* @return AlipayOpenPublicMessageTotalSendResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function sendText($text){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.message.total.send",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$textObj = new Text([
"title" => "",
"content" => $text
]);
$bizParams = [
"msg_type" => "text",
"text" => $textObj
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.message.total.send");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicMessageTotalSendResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicMessageTotalSendResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param Article[] $articles
* @return AlipayOpenPublicMessageTotalSendResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function sendImageText($articles){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.message.total.send",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"msg_type" => "image-text",
"articles" => $articles
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.message.total.send");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicMessageTotalSendResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicMessageTotalSendResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $toUserId
* @param Template $template
* @return AlipayOpenPublicMessageSingleSendResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function sendSingleMessage($toUserId, $template){
$template->validate();
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.message.single.send",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"to_user_id" => $toUserId,
"template" => $template
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.message.single.send");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicMessageSingleSendResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicMessageSingleSendResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $messageId
* @return AlipayOpenPublicLifeMsgRecallResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function recallMessage($messageId){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.life.msg.recall",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"message_id" => $messageId
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.life.msg.recall");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicLifeMsgRecallResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicLifeMsgRecallResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @param string $primaryIndustryCode
* @param string $primaryIndustryName
* @param string $secondaryIndustryCode
* @param string $secondaryIndustryName
* @return AlipayOpenPublicTemplateMessageIndustryModifyResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function setIndustry($primaryIndustryCode, $primaryIndustryName, $secondaryIndustryCode, $secondaryIndustryName){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.template.message.industry.modify",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [
"primary_industry_code" => $primaryIndustryCode,
"primary_industry_name" => $primaryIndustryName,
"secondary_industry_code" => $secondaryIndustryCode,
"secondary_industry_name" => $secondaryIndustryName
];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.template.message.industry.modify");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicTemplateMessageIndustryModifyResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicTemplateMessageIndustryModifyResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* @return AlipayOpenPublicSettingCategoryQueryResponse
* @throws TeaError
* @throws Exception
* @throws TeaUnableRetryError
*/
public function getIndustry(){
$_runtime = [
"ignoreSSL" => $this->_kernel->getConfig("ignoreSSL"),
"httpProxy" => $this->_kernel->getConfig("httpProxy"),
"connectTimeout" => 15000,
"readTimeout" => 15000,
"retry" => [
"maxAttempts" => 0
]
];
$_lastRequest = null;
$_lastException = null;
$_now = time();
$_retryTimes = 0;
while (Tea::allowRetry(@$_runtime["retry"], $_retryTimes, $_now)) {
if ($_retryTimes > 0) {
$_backoffTime = Tea::getBackoffTime(@$_runtime["backoff"], $_retryTimes);
if ($_backoffTime > 0) {
Tea::sleep($_backoffTime);
}
}
$_retryTimes = $_retryTimes + 1;
try {
$_request = new Request();
$systemParams = [
"method" => "alipay.open.public.setting.category.query",
"app_id" => $this->_kernel->getConfig("appId"),
"timestamp" => $this->_kernel->getTimestamp(),
"format" => "json",
"version" => "1.0",
"alipay_sdk" => $this->_kernel->getSdkVersion(),
"charset" => "UTF-8",
"sign_type" => $this->_kernel->getConfig("signType"),
"app_cert_sn" => $this->_kernel->getMerchantCertSN(),
"alipay_root_cert_sn" => $this->_kernel->getAlipayRootCertSN()
];
$bizParams = [];
$textParams = [];
$_request->protocol = $this->_kernel->getConfig("protocol");
$_request->method = "POST";
$_request->pathname = "/gateway.do";
$_request->headers = [
"host" => $this->_kernel->getConfig("gatewayHost"),
"content-type" => "application/x-www-form-urlencoded;charset=utf-8"
];
$_request->query = $this->_kernel->sortMap(Tea::merge([
"sign" => $this->_kernel->sign($systemParams, $bizParams, $textParams, $this->_kernel->getConfig("merchantPrivateKey"))
], $systemParams, $textParams));
$_request->body = $this->_kernel->toUrlEncodedRequestBody($bizParams);
$_lastRequest = $_request;
$_response= Tea::send($_request, $_runtime);
$respMap = $this->_kernel->readAsJson($_response, "alipay.open.public.setting.category.query");
if ($this->_kernel->isCertMode()) {
if ($this->_kernel->verify($respMap, $this->_kernel->extractAlipayPublicKey($this->_kernel->getAlipayCertSN($respMap)))) {
return AlipayOpenPublicSettingCategoryQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
else {
if ($this->_kernel->verify($respMap, $this->_kernel->getConfig("alipayPublicKey"))) {
return AlipayOpenPublicSettingCategoryQueryResponse::fromMap($this->_kernel->toRespModel($respMap));
}
}
throw new TeaError([
"message" => "验签失败,请检查支付宝公钥设置是否正确。"
]);
}
catch (Exception $e) {
if (!($e instanceof TeaError)) {
$e = new TeaError([], $e->getMessage(), $e->getCode(), $e);
}
if (Tea::isRetryable($e)) {
$_lastException = $e;
continue;
}
throw $e;
}
}
throw new TeaUnableRetryError($_lastRequest, $_lastException);
}
/**
* ISV代商户代用,指定appAuthToken
*
* @param $appAuthToken String 代调用token
* @return $this 本客户端,便于链式调用
*/
public function agent($appAuthToken)
{
$this->_kernel->injectTextParam("app_auth_token", $appAuthToken);
return $this;
}
/**
* 用户授权调用,指定authToken
*
* @param $authToken String 用户授权token
* @return $this
*/
public function auth($authToken)
{
$this->_kernel->injectTextParam("auth_token", $authToken);
return $this;
}
/**
* 设置异步通知回调地址,此处设置将在本调用中覆盖Config中的全局配置
*
* @param $url String 异步通知回调地址,例如:https://www.test.com/callback
* @return $this
*/
public function asyncNotify($url)
{
$this->_kernel->injectTextParam("notify_url", $url);
return $this;
}
/**
* 将本次调用强制路由到后端系统的测试地址上,常用于线下环境内外联调,沙箱与线上环境设置无效
*
* @param $testUrl String 后端系统测试地址
* @return $this
*/
public function route($testUrl)
{
$this->_kernel->injectTextParam("ws_service_url", $testUrl);
return $this;
}
/**
* 设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
*
* @param $key String 业务请求参数名称(biz_content下的字段名,比如timeout_express)
* @param $value object 业务请求参数的值,一个可以序列化成JSON的对象
* 如果该字段是一个字符串类型(String、Price、Date在SDK中都是字符串),请使用String储存
* 如果该字段是一个数值型类型(比如:Number),请使用Long储存
* 如果该字段是一个复杂类型,请使用嵌套的array指定各下级字段的值
* 如果该字段是一个数组,请使用array储存各个值
* @return $this
*/
public function optional($key, $value)
{
$this->_kernel->injectBizParam($key, $value);
return $this;
}
/**
* 批量设置API入参中没有的其他可选业务请求参数(biz_content下的字段)
* optional方法的批量版本
*
* @param $optionalArgs array 可选参数集合,每个参数由key和value组成,key和value的格式请参见optional方法的注释
* @return $this
*/
public function batchOptional($optionalArgs)
{
foreach ($optionalArgs as $key => $value) {
$this->_kernel->injectBizParam($key, $value);
}
return $this;
}
}