如何为Web API AppTrackerContainer.getSortedAppColumns(appList)
添加自定义参数
我们尝试了
etc / extension_attributes.xml
V1/integration/customer/token
di.xml
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Integration\Api\CustomerTokenServiceInterface">
<attribute code="devicetoken" type="string"/>
</extension_attributes>
现在放在
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="Magento\Integration\Model\CustomerTokenService">
<plugin name="Drc_Pushnotification_Plugin" type="Drc\Pushnotification\Plugin\ModifyToken" sortOrder="10" disabled="false" />
</type>
</config>
无法检索发布数据,我们如何在类public function aroundCreateCustomerAccessToken(\Magento\Integration\Model\CustomerTokenService $subject, callable $proceed,$username, $password)
{
$this->validatorHelper->validate($username, $password);
$this->getRequestThrottler()->throttle($username, RequestThrottler::USER_TYPE_CUSTOMER);
try {
$customerDataObject = $this->accountManagement->authenticate($username, $password);
} catch (\Exception $e) {
$this->getRequestThrottler()->logAuthenticationFailure($username, RequestThrottler::USER_TYPE_CUSTOMER);
$modifiedresult=array();
$modifiedresult['token']=null;
$modifiedresult['status']=404;
$modifiedresult['success']=false;
$modifiedresult['message']="Please check credentials";
echo json_encode($modifiedresult);
exit;
}
$result = $proceed($username, $password);
return $result;
}
内检索新添加的参数
预期输出:
ModifyToken
应该在请求参数中进行验证:
device token