作者 竞泽

alter:index

... ... @@ -7,14 +7,13 @@ namespace Lackoxygen\TopWarehouse\Contracts;
interface RequestInterface
{
/**
* app value to array
*
* @param string $name
* @param $key
* @param $value
*
* @return mixed
*/
public function append(string $name, $value);
public function append(string $name, $key, $value);
/**
* @return array
... ...
... ... @@ -304,6 +304,22 @@ class OrdersB2cAddRequest extends Request
public $index = [];
/**
* 商品集合
* @param $goods_id
* @param $good_name
* @param $price
* @param $num
* @param $dec_total
* @param $deliveryItemId
*
* @return bool|mixed
*/
public function appendIndex($goods_id, $good_name, $price, $num, $dec_total, $deliveryItemId)
{
return parent::append('index', count($this->index), get_defined_vars());
}
public function initialize()
{
$this->contentType = 'application/json';
... ...
... ... @@ -43,7 +43,7 @@ abstract class Request implements RequestInterface
/**
* @inheritDoc
*/
public function append(string $name, $value): bool
public function append(string $name, $key, $value): bool
{
if (!property_exists($this, $name)) {
return false;
... ... @@ -52,7 +52,7 @@ abstract class Request implements RequestInterface
return false;
}
$array = &$this->{$name};
Arr::set($array, $name, $value);
Arr::set($array, $key, $value);
return true;
}
... ...