ProductAddRequest.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?php
  2. /**
  3. * TOP API: taobao.product.add request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2022.07.13
  7. */
  8. class ProductAddRequest
  9. {
  10. /**
  11. * 非关键属性结构:pid:vid;pid:vid.<br>
  12. 非关键属性<font color=red>不包含</font>关键属性、销售属性、用户自定义属性、商品属性;
  13. <br>调用taobao.itemprops.get获取pid,调用taobao.itempropvalues.get获取vid.<br><font color=red>注:支持最大长度为512字节</font>
  14. **/
  15. private $binds;
  16. /**
  17. * 商品类目ID.调用taobao.itemcats.get获取;注意:必须是叶子类目 id.
  18. **/
  19. private $cid;
  20. /**
  21. * 用户自定义属性,结构:pid1:value1;pid2:value2,如果有型号,系列等子属性用: 隔开 例如:“20000:优衣库:型号:001;632501:1234”,表示“品牌:优衣库:型号:001;货号:1234”
  22. <br><font color=red>注:包含所有自定义属性的传入</font>
  23. **/
  24. private $customerProps;
  25. /**
  26. * 产品描述.最大不超过25000个字符
  27. **/
  28. private $desc;
  29. /**
  30. * 产品主图片.最大1M,目前仅支持GIF,JPG.
  31. **/
  32. private $image;
  33. /**
  34. * 是不是主图
  35. **/
  36. private $major;
  37. /**
  38. * 上市时间。目前只支持鞋城类目传入此参数
  39. **/
  40. private $marketTime;
  41. /**
  42. * 产品名称,最大30个字符.
  43. **/
  44. private $name;
  45. /**
  46. * native_unkeyprops
  47. **/
  48. private $nativeUnkeyprops;
  49. /**
  50. * 外部产品ID
  51. **/
  52. private $outerId;
  53. /**
  54. * 产品市场价.精确到2位小数;单位为元.如:200.07
  55. **/
  56. private $price;
  57. /**
  58. * 销售属性值别名。格式为pid1:vid1:alias1;pid1:vid2:alia2。只有少数销售属性值支持传入别名,比如颜色和尺寸
  59. **/
  60. private $propertyAlias;
  61. /**
  62. * 关键属性 结构:pid:vid;pid:vid.调用taobao.itemprops.get获取pid,调用taobao.itempropvalues.get获取vid;如果碰到用户自定义属性,请用customer_props.
  63. **/
  64. private $props;
  65. /**
  66. * 销售属性结构:pid:vid;pid:vid.调用taobao.itemprops.get获取is_sale_prop=true的pid,调用taobao.itempropvalues.get获取vid.
  67. **/
  68. private $saleProps;
  69. /**
  70. * 加入垂直市场,目前只支持以鞋城卖家身份加入名鞋馆(暂时此字段还不起作用,不对外开放)
  71. **/
  72. private $verticalMarket;
  73. private $apiParas = array();
  74. public function setBinds($binds)
  75. {
  76. $this->binds = $binds;
  77. $this->apiParas["binds"] = $binds;
  78. }
  79. public function getBinds()
  80. {
  81. return $this->binds;
  82. }
  83. public function setCid($cid)
  84. {
  85. $this->cid = $cid;
  86. $this->apiParas["cid"] = $cid;
  87. }
  88. public function getCid()
  89. {
  90. return $this->cid;
  91. }
  92. public function setCustomerProps($customerProps)
  93. {
  94. $this->customerProps = $customerProps;
  95. $this->apiParas["customer_props"] = $customerProps;
  96. }
  97. public function getCustomerProps()
  98. {
  99. return $this->customerProps;
  100. }
  101. public function setDesc($desc)
  102. {
  103. $this->desc = $desc;
  104. $this->apiParas["desc"] = $desc;
  105. }
  106. public function getDesc()
  107. {
  108. return $this->desc;
  109. }
  110. public function setImage($image)
  111. {
  112. $this->image = $image;
  113. $this->apiParas["image"] = $image;
  114. }
  115. public function getImage()
  116. {
  117. return $this->image;
  118. }
  119. public function setMajor($major)
  120. {
  121. $this->major = $major;
  122. $this->apiParas["major"] = $major;
  123. }
  124. public function getMajor()
  125. {
  126. return $this->major;
  127. }
  128. public function setMarketTime($marketTime)
  129. {
  130. $this->marketTime = $marketTime;
  131. $this->apiParas["market_time"] = $marketTime;
  132. }
  133. public function getMarketTime()
  134. {
  135. return $this->marketTime;
  136. }
  137. public function setName($name)
  138. {
  139. $this->name = $name;
  140. $this->apiParas["name"] = $name;
  141. }
  142. public function getName()
  143. {
  144. return $this->name;
  145. }
  146. public function setNativeUnkeyprops($nativeUnkeyprops)
  147. {
  148. $this->nativeUnkeyprops = $nativeUnkeyprops;
  149. $this->apiParas["native_unkeyprops"] = $nativeUnkeyprops;
  150. }
  151. public function getNativeUnkeyprops()
  152. {
  153. return $this->nativeUnkeyprops;
  154. }
  155. public function setOuterId($outerId)
  156. {
  157. $this->outerId = $outerId;
  158. $this->apiParas["outer_id"] = $outerId;
  159. }
  160. public function getOuterId()
  161. {
  162. return $this->outerId;
  163. }
  164. public function setPrice($price)
  165. {
  166. $this->price = $price;
  167. $this->apiParas["price"] = $price;
  168. }
  169. public function getPrice()
  170. {
  171. return $this->price;
  172. }
  173. public function setPropertyAlias($propertyAlias)
  174. {
  175. $this->propertyAlias = $propertyAlias;
  176. $this->apiParas["property_alias"] = $propertyAlias;
  177. }
  178. public function getPropertyAlias()
  179. {
  180. return $this->propertyAlias;
  181. }
  182. public function setProps($props)
  183. {
  184. $this->props = $props;
  185. $this->apiParas["props"] = $props;
  186. }
  187. public function getProps()
  188. {
  189. return $this->props;
  190. }
  191. public function setSaleProps($saleProps)
  192. {
  193. $this->saleProps = $saleProps;
  194. $this->apiParas["sale_props"] = $saleProps;
  195. }
  196. public function getSaleProps()
  197. {
  198. return $this->saleProps;
  199. }
  200. public function setVerticalMarket($verticalMarket)
  201. {
  202. $this->verticalMarket = $verticalMarket;
  203. $this->apiParas["vertical_market"] = $verticalMarket;
  204. }
  205. public function getVerticalMarket()
  206. {
  207. return $this->verticalMarket;
  208. }
  209. public function getApiMethodName()
  210. {
  211. return "taobao.product.add";
  212. }
  213. public function getApiParas()
  214. {
  215. return $this->apiParas;
  216. }
  217. public function check()
  218. {
  219. RequestCheckUtil::checkMaxLength($this->binds,512,"binds");
  220. RequestCheckUtil::checkNotNull($this->cid,"cid");
  221. RequestCheckUtil::checkNotNull($this->image,"image");
  222. }
  223. public function putOtherTextParam($key, $value) {
  224. $this->apiParas[$key] = $value;
  225. $this->$key = $value;
  226. }
  227. }