Merge branch 'feature/new_wms' into 'master'

增加奇门自测验签方法

See merge request composer/php-wms-client!2
This commit is contained in:
郑翀 2020-07-17 12:01:23 +08:00
commit 714a1aecb9

View File

@ -451,7 +451,7 @@ class QimenWms extends BaseWms implements WmsInterface
'stockout.confirm' => 'stockOutConfirm', 'stockout.confirm' => 'stockOutConfirm',
]; ];
public function callback($params) public function callback($params, $onlyCheckSign = false)
{ {
if (!isset($params['method']) || empty($params['method'])) { if (!isset($params['method']) || empty($params['method'])) {
return $this->response('缺少参数method', false); return $this->response('缺少参数method', false);
@ -474,9 +474,6 @@ class QimenWms extends BaseWms implements WmsInterface
if (!isset($params['sign_method']) || empty($params['sign_method'])) { if (!isset($params['sign_method']) || empty($params['sign_method'])) {
return $this->response('缺少加密方式', false); return $this->response('缺少加密方式', false);
} }
if (!isset($params['customerId']) || empty($params['customerId'])) {
return $this->response('缺少参数customerId', false);
}
if (empty(($params['body']))) { if (empty(($params['body']))) {
return $this->response('缺少消息body', false); return $this->response('缺少消息body', false);
} }
@ -488,6 +485,10 @@ class QimenWms extends BaseWms implements WmsInterface
if (!$this->checkSign($params)) { if (!$this->checkSign($params)) {
return $this->response('签名错误', false); return $this->response('签名错误', false);
} }
// 用于阿里云自测验签
if ($onlyCheckSign) {
return $this->response();
}
$body = XML2Array::createArray($params['body']); $body = XML2Array::createArray($params['body']);
if (!isset($body['request']) || empty($body['request'])) { if (!isset($body['request']) || empty($body['request'])) {
return $this->response('消息body错误', false); return $this->response('消息body错误', false);
@ -496,6 +497,14 @@ class QimenWms extends BaseWms implements WmsInterface
return $result; return $result;
} }
/**
* 奇门自测,仅验签
*/
public function onlyCheckSign($params)
{
return $this->callback($params, true);
}
/** /**
* 发货单确认 * 发货单确认
* @param $params * @param $params