作者 竞泽

alter:index

@@ -7,14 +7,13 @@ namespace Lackoxygen\TopWarehouse\Contracts; @@ -7,14 +7,13 @@ namespace Lackoxygen\TopWarehouse\Contracts;
7 interface RequestInterface 7 interface RequestInterface
8 { 8 {
9 /** 9 /**
10 - * app value to array  
11 - *  
12 * @param string $name 10 * @param string $name
  11 + * @param $key
13 * @param $value 12 * @param $value
14 * 13 *
15 * @return mixed 14 * @return mixed
16 */ 15 */
17 - public function append(string $name, $value); 16 + public function append(string $name, $key, $value);
18 17
19 /** 18 /**
20 * @return array 19 * @return array
@@ -304,6 +304,22 @@ class OrdersB2cAddRequest extends Request @@ -304,6 +304,22 @@ class OrdersB2cAddRequest extends Request
304 public $index = []; 304 public $index = [];
305 305
306 306
  307 + /**
  308 + * 商品集合
  309 + * @param $goods_id
  310 + * @param $good_name
  311 + * @param $price
  312 + * @param $num
  313 + * @param $dec_total
  314 + * @param $deliveryItemId
  315 + *
  316 + * @return bool|mixed
  317 + */
  318 + public function appendIndex($goods_id, $good_name, $price, $num, $dec_total, $deliveryItemId)
  319 + {
  320 + return parent::append('index', count($this->index), get_defined_vars());
  321 + }
  322 +
307 public function initialize() 323 public function initialize()
308 { 324 {
309 $this->contentType = 'application/json'; 325 $this->contentType = 'application/json';
@@ -43,7 +43,7 @@ abstract class Request implements RequestInterface @@ -43,7 +43,7 @@ abstract class Request implements RequestInterface
43 /** 43 /**
44 * @inheritDoc 44 * @inheritDoc
45 */ 45 */
46 - public function append(string $name, $value): bool 46 + public function append(string $name, $key, $value): bool
47 { 47 {
48 if (!property_exists($this, $name)) { 48 if (!property_exists($this, $name)) {
49 return false; 49 return false;
@@ -52,7 +52,7 @@ abstract class Request implements RequestInterface @@ -52,7 +52,7 @@ abstract class Request implements RequestInterface
52 return false; 52 return false;
53 } 53 }
54 $array = &$this->{$name}; 54 $array = &$this->{$name};
55 - Arr::set($array, $name, $value); 55 + Arr::set($array, $key, $value);
56 56
57 return true; 57 return true;
58 } 58 }