DeliverySendRequest.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <?php
  2. /**
  3. * TOP API: taobao.delivery.send request
  4. *
  5. * @author auto create
  6. * @since 1.0, 2015.08.06
  7. */
  8. class DeliverySendRequest
  9. {
  10. /**
  11. * 物流公司代码.如"POST"就代表中国邮政,"ZJS"就代表宅急送.调用 taobao.logistics.companies.get 获取。如传入的代码非淘宝官方物流合作公司,默认是“其他”物流的方式,在淘宝不显示物流具体进度,故传入需谨慎。如果orderType为delivery_needed,则必传
  12. **/
  13. private $companyCode;
  14. /**
  15. * feature参数格式<br>范例: mobileCode=tid1:手机串号1,手机串号2|tid2:手机串号3;machineCode=tid3:3C机器号A,3C机器号B<br>mobileCode无忧购的KEY,machineCode为3C的KEY,多个key之间用”;”分隔<br>“tid1:手机串号1,手机串号2|tid2:手机串号3”为mobileCode对应的value。"|"不同商品间的分隔符。<br>例A商品和B商品都属于无忧购商品,之间就用"|"分开。<br>TID就是商品代表的子订单号,对应taobao.trade.fullinfo.get 接口获得的oid字段。(通过OID可以唯一定位到当前商品上)<br>":"TID和具体传入参数间的分隔符。冒号前表示TID,之后代表该商品的参数属性。<br>"," 属性间分隔符。(对应商品数量,当存在一个商品的数量超过1个时,用逗号分开)。<br>具体:当订单中A商品的数量为2个,其中手机串号分别为"12345","67890"。<br>参数格式:mobileCode=TIDA:12345,67890。TIDA对应了A宝贝,冒号后用逗号分隔的"12345","67890".说明本订单A宝贝的数量为2,值分别为"12345","67890"。<br>当存在"|"时,就说明订单中存在多个无忧购的商品,商品间用"|"分隔了开来。|"之后的内容含义同上。
  16. **/
  17. private $feature;
  18. /**
  19. * 物流公司取货地址.XXX街道XXX门牌,省市区不需要提供.目的在于让物流公司能清楚的知道在哪取货。校验规则:1.4-60字符(字母\数字\汉字)2.不能全部数字3.不能全部字母
  20. **/
  21. private $fetcherAddress;
  22. /**
  23. * 取货地国家公布的标准地区码.参考:http://www.stats.gov.cn/tjbz/xzqhdm/t20080215_402462675.htm 或者调用 taobao.areas.get 获取
  24. **/
  25. private $fetcherAreaId;
  26. /**
  27. * 取货地手机号码
  28. **/
  29. private $fetcherMobile;
  30. /**
  31. * 联系人名称
  32. **/
  33. private $fetcherName;
  34. /**
  35. * 取货地固定电话.包含区号,电话,分机号,中间用 " – "; 取货地固定电话和取货地手机号码,必须填写一个.
  36. **/
  37. private $fetcherPhone;
  38. /**
  39. * 取货地邮编
  40. **/
  41. private $fetcherZip;
  42. /**
  43. * 卖家备注.最大长度为250个字符。如果orderType为delivery_needed,则必传
  44. **/
  45. private $memo;
  46. /**
  47. * 发货类型. 可选( delivery_needed(物流订单发货),virtual_goods(虚拟物品发货). ) 注:选择virtual_goods类型进行发货的话下面的参数可以不需填写。如果选择delivery_needed 则company_code,out_sid,seller_name,seller_area_id,seller_address,seller_zip,seller_phone,seller_mobile,memo必须要填写
  48. **/
  49. private $orderType;
  50. /**
  51. * 运单号.具体一个物流公司的真实运单号码。淘宝官方物流会校验,请谨慎传入;若company_code中传入的代码非淘宝官方物流合作公司,此处运单号不校验。如果orderType为delivery_needed,则必传
  52. **/
  53. private $outSid;
  54. /**
  55. * 卖家地址(详细地址).如:XXX街道XXX门牌,省市区不需要提供。如果orderType为delivery_needed,则必传.<br><font color="red">校验规则:<br>1.4-60字符(字母\数字\汉字)<br>2.不能全部数字<br>3.不能全部字母<br></font>
  56. **/
  57. private $sellerAddress;
  58. /**
  59. * 卖家所在地国家公布的标准地区码.参考:http://www.stats.gov.cn/tjbz/xzqhdm/t20080215_402462675.htm 或者调用 taobao.areas.get 获取。如果orderType为delivery_needed,则必传
  60. **/
  61. private $sellerAreaId;
  62. /**
  63. * 卖家手机号码,必须由8到16位数字构成<br><font color="red">校验规则:<br>1.8-16位数字<br>2.不能数字全部相同<br>3.不能全为字符格式</font>
  64. **/
  65. private $sellerMobile;
  66. /**
  67. * 卖家姓名。如果orderType为delivery_needed。<font color=red>注:最长支持15个字符</font color=red>
  68. **/
  69. private $sellerName;
  70. /**
  71. * 卖家固定电话.包含区号,电话,分机号,中间用 " – "; 卖家固定电话和卖家手机号码,必须填写一个.<br><font color="red">校验规则:<br>1.字符不能全部相同<br>2.长度:5-24位<br>3.只能包含数字和横杠‘-’</font>
  72. **/
  73. private $sellerPhone;
  74. /**
  75. * 卖家邮编。如果orderType为delivery_needed,则必传
  76. **/
  77. private $sellerZip;
  78. /**
  79. * 交易ID
  80. **/
  81. private $tid;
  82. private $apiParas = array();
  83. public function setCompanyCode($companyCode)
  84. {
  85. $this->companyCode = $companyCode;
  86. $this->apiParas["company_code"] = $companyCode;
  87. }
  88. public function getCompanyCode()
  89. {
  90. return $this->companyCode;
  91. }
  92. public function setFeature($feature)
  93. {
  94. $this->feature = $feature;
  95. $this->apiParas["feature"] = $feature;
  96. }
  97. public function getFeature()
  98. {
  99. return $this->feature;
  100. }
  101. public function setFetcherAddress($fetcherAddress)
  102. {
  103. $this->fetcherAddress = $fetcherAddress;
  104. $this->apiParas["fetcher_address"] = $fetcherAddress;
  105. }
  106. public function getFetcherAddress()
  107. {
  108. return $this->fetcherAddress;
  109. }
  110. public function setFetcherAreaId($fetcherAreaId)
  111. {
  112. $this->fetcherAreaId = $fetcherAreaId;
  113. $this->apiParas["fetcher_area_id"] = $fetcherAreaId;
  114. }
  115. public function getFetcherAreaId()
  116. {
  117. return $this->fetcherAreaId;
  118. }
  119. public function setFetcherMobile($fetcherMobile)
  120. {
  121. $this->fetcherMobile = $fetcherMobile;
  122. $this->apiParas["fetcher_mobile"] = $fetcherMobile;
  123. }
  124. public function getFetcherMobile()
  125. {
  126. return $this->fetcherMobile;
  127. }
  128. public function setFetcherName($fetcherName)
  129. {
  130. $this->fetcherName = $fetcherName;
  131. $this->apiParas["fetcher_name"] = $fetcherName;
  132. }
  133. public function getFetcherName()
  134. {
  135. return $this->fetcherName;
  136. }
  137. public function setFetcherPhone($fetcherPhone)
  138. {
  139. $this->fetcherPhone = $fetcherPhone;
  140. $this->apiParas["fetcher_phone"] = $fetcherPhone;
  141. }
  142. public function getFetcherPhone()
  143. {
  144. return $this->fetcherPhone;
  145. }
  146. public function setFetcherZip($fetcherZip)
  147. {
  148. $this->fetcherZip = $fetcherZip;
  149. $this->apiParas["fetcher_zip"] = $fetcherZip;
  150. }
  151. public function getFetcherZip()
  152. {
  153. return $this->fetcherZip;
  154. }
  155. public function setMemo($memo)
  156. {
  157. $this->memo = $memo;
  158. $this->apiParas["memo"] = $memo;
  159. }
  160. public function getMemo()
  161. {
  162. return $this->memo;
  163. }
  164. public function setOrderType($orderType)
  165. {
  166. $this->orderType = $orderType;
  167. $this->apiParas["order_type"] = $orderType;
  168. }
  169. public function getOrderType()
  170. {
  171. return $this->orderType;
  172. }
  173. public function setOutSid($outSid)
  174. {
  175. $this->outSid = $outSid;
  176. $this->apiParas["out_sid"] = $outSid;
  177. }
  178. public function getOutSid()
  179. {
  180. return $this->outSid;
  181. }
  182. public function setSellerAddress($sellerAddress)
  183. {
  184. $this->sellerAddress = $sellerAddress;
  185. $this->apiParas["seller_address"] = $sellerAddress;
  186. }
  187. public function getSellerAddress()
  188. {
  189. return $this->sellerAddress;
  190. }
  191. public function setSellerAreaId($sellerAreaId)
  192. {
  193. $this->sellerAreaId = $sellerAreaId;
  194. $this->apiParas["seller_area_id"] = $sellerAreaId;
  195. }
  196. public function getSellerAreaId()
  197. {
  198. return $this->sellerAreaId;
  199. }
  200. public function setSellerMobile($sellerMobile)
  201. {
  202. $this->sellerMobile = $sellerMobile;
  203. $this->apiParas["seller_mobile"] = $sellerMobile;
  204. }
  205. public function getSellerMobile()
  206. {
  207. return $this->sellerMobile;
  208. }
  209. public function setSellerName($sellerName)
  210. {
  211. $this->sellerName = $sellerName;
  212. $this->apiParas["seller_name"] = $sellerName;
  213. }
  214. public function getSellerName()
  215. {
  216. return $this->sellerName;
  217. }
  218. public function setSellerPhone($sellerPhone)
  219. {
  220. $this->sellerPhone = $sellerPhone;
  221. $this->apiParas["seller_phone"] = $sellerPhone;
  222. }
  223. public function getSellerPhone()
  224. {
  225. return $this->sellerPhone;
  226. }
  227. public function setSellerZip($sellerZip)
  228. {
  229. $this->sellerZip = $sellerZip;
  230. $this->apiParas["seller_zip"] = $sellerZip;
  231. }
  232. public function getSellerZip()
  233. {
  234. return $this->sellerZip;
  235. }
  236. public function setTid($tid)
  237. {
  238. $this->tid = $tid;
  239. $this->apiParas["tid"] = $tid;
  240. }
  241. public function getTid()
  242. {
  243. return $this->tid;
  244. }
  245. public function getApiMethodName()
  246. {
  247. return "taobao.delivery.send";
  248. }
  249. public function getApiParas()
  250. {
  251. return $this->apiParas;
  252. }
  253. public function check()
  254. {
  255. RequestCheckUtil::checkNotNull($this->tid,"tid");
  256. }
  257. public function putOtherTextParam($key, $value) {
  258. $this->apiParas[$key] = $value;
  259. $this->$key = $value;
  260. }
  261. }