sunxbiao пре 9 месеци
родитељ
комит
c068ae8e96
100 измењених фајлова са 6459 додато и 0 уклоњено
  1. 78 0
      extend/TaobaoSdk/Autoloader.php
  2. 12 0
      extend/TaobaoSdk/OapiTest.php
  3. 384 0
      extend/TaobaoSdk/QimenCloud/QimenCloudClient.php
  4. 40 0
      extend/TaobaoSdk/TopSdk.php
  5. 255 0
      extend/TaobaoSdk/aliyun/AliyunClient.php
  6. 656 0
      extend/TaobaoSdk/dingtalk/DingTalkClient.php
  7. 18 0
      extend/TaobaoSdk/dingtalk/DingTalkConstant.php
  8. 47 0
      extend/TaobaoSdk/top/ApplicationVar.php
  9. 199 0
      extend/TaobaoSdk/top/ClusterTopClient.php
  10. 23 0
      extend/TaobaoSdk/top/HttpdnsGetRequest.php
  11. 107 0
      extend/TaobaoSdk/top/RequestCheckUtil.php
  12. 21 0
      extend/TaobaoSdk/top/ResultSet.php
  13. 219 0
      extend/TaobaoSdk/top/SpiUtils.php
  14. 377 0
      extend/TaobaoSdk/top/TopClient.php
  15. 43 0
      extend/TaobaoSdk/top/TopLogger.php
  16. 15 0
      extend/TaobaoSdk/top/domain/ActivityTagMapData.php
  17. 35 0
      extend/TaobaoSdk/top/domain/Area.php
  18. 140 0
      extend/TaobaoSdk/top/domain/BasicMapData.php
  19. 15 0
      extend/TaobaoSdk/top/domain/Data.php
  20. 25 0
      extend/TaobaoSdk/top/domain/DataMap.php
  21. 80 0
      extend/TaobaoSdk/top/domain/Extra.php
  22. 20 0
      extend/TaobaoSdk/top/domain/FavoritesDetail.php
  23. 20 0
      extend/TaobaoSdk/top/domain/FavoritesInfo.php
  24. 20 0
      extend/TaobaoSdk/top/domain/Feature.php
  25. 40 0
      extend/TaobaoSdk/top/domain/FinalIncomeInfo.php
  26. 40 0
      extend/TaobaoSdk/top/domain/FinalPromotionPathMapData.php
  27. 35 0
      extend/TaobaoSdk/top/domain/FutureActivityPromotionDTO.php
  28. 35 0
      extend/TaobaoSdk/top/domain/FutureActivityPromotionPathMapData.php
  29. 20 0
      extend/TaobaoSdk/top/domain/GovSubsidyDTO.php
  30. 40 0
      extend/TaobaoSdk/top/domain/IncomeInfo.php
  31. 15 0
      extend/TaobaoSdk/top/domain/InstanceDTO.php
  32. 560 0
      extend/TaobaoSdk/top/domain/Item.php
  33. 30 0
      extend/TaobaoSdk/top/domain/ItemImg.php
  34. 29 0
      extend/TaobaoSdk/top/domain/KfcSearchResult.php
  35. 40 0
      extend/TaobaoSdk/top/domain/Location.php
  36. 55 0
      extend/TaobaoSdk/top/domain/MapData.php
  37. 30 0
      extend/TaobaoSdk/top/domain/MaterialQuery.php
  38. 15 0
      extend/TaobaoSdk/top/domain/MediaIssueDTO.php
  39. 35 0
      extend/TaobaoSdk/top/domain/MgcInfo.php
  40. 45 0
      extend/TaobaoSdk/top/domain/MorePromotionMapData.php
  41. 220 0
      extend/TaobaoSdk/top/domain/NTbkItem.php
  42. 40 0
      extend/TaobaoSdk/top/domain/NTbkShop.php
  43. 170 0
      extend/TaobaoSdk/top/domain/OpenAccount.php
  44. 30 0
      extend/TaobaoSdk/top/domain/OpenAccountSearchResult.php
  45. 30 0
      extend/TaobaoSdk/top/domain/OpenAccountTokenApplyResult.php
  46. 30 0
      extend/TaobaoSdk/top/domain/OpenaccountLong.php
  47. 30 0
      extend/TaobaoSdk/top/domain/OpenaccountObject.php
  48. 25 0
      extend/TaobaoSdk/top/domain/OpenaccountVoid.php
  49. 30 0
      extend/TaobaoSdk/top/domain/OrderData.php
  50. 15 0
      extend/TaobaoSdk/top/domain/PageResult.php
  51. 20 0
      extend/TaobaoSdk/top/domain/PredictRoundingUpPathMapData.php
  52. 40 0
      extend/TaobaoSdk/top/domain/PresaleInfo.php
  53. 137 0
      extend/TaobaoSdk/top/domain/Product.php
  54. 40 0
      extend/TaobaoSdk/top/domain/ProductImg.php
  55. 45 0
      extend/TaobaoSdk/top/domain/ProductPropImg.php
  56. 25 0
      extend/TaobaoSdk/top/domain/PromotionExtend.php
  57. 70 0
      extend/TaobaoSdk/top/domain/PromotionInfoMapData.php
  58. 30 0
      extend/TaobaoSdk/top/domain/PromotionList.php
  59. 15 0
      extend/TaobaoSdk/top/domain/PromotionTagMapData.php
  60. 35 0
      extend/TaobaoSdk/top/domain/PropImg.php
  61. 60 0
      extend/TaobaoSdk/top/domain/PropValue.php
  62. 60 0
      extend/TaobaoSdk/top/domain/PublishInfo.php
  63. 20 0
      extend/TaobaoSdk/top/domain/RecommendItemList.php
  64. 50 0
      extend/TaobaoSdk/top/domain/RegisterInfoDto.php
  65. 45 0
      extend/TaobaoSdk/top/domain/Result.php
  66. 25 0
      extend/TaobaoSdk/top/domain/Results.php
  67. 35 0
      extend/TaobaoSdk/top/domain/RightsInstanceCreateResult.php
  68. 30 0
      extend/TaobaoSdk/top/domain/RightsSendRelationRptDto.php
  69. 20 0
      extend/TaobaoSdk/top/domain/RightsSendRptDTO.php
  70. 15 0
      extend/TaobaoSdk/top/domain/RpcResult.php
  71. 15 0
      extend/TaobaoSdk/top/domain/ScopeInfo.php
  72. 120 0
      extend/TaobaoSdk/top/domain/Sku.php
  73. 40 0
      extend/TaobaoSdk/top/domain/SpCampaign.php
  74. 35 0
      extend/TaobaoSdk/top/domain/StateSubsidyInfo.php
  75. 40 0
      extend/TaobaoSdk/top/domain/TbkItemDetail.php
  76. 20 0
      extend/TaobaoSdk/top/domain/TbkSpread.php
  77. 15 0
      extend/TaobaoSdk/top/domain/TbkSpreadRequest.php
  78. 20 0
      extend/TaobaoSdk/top/domain/TmallRankInfo.php
  79. 25 0
      extend/TaobaoSdk/top/domain/TopDownloadRecordDo.php
  80. 35 0
      extend/TaobaoSdk/top/domain/TopNInfoDTO.php
  81. 40 0
      extend/TaobaoSdk/top/domain/TouMaterials.php
  82. 25 0
      extend/TaobaoSdk/top/domain/TradeConfirmFee.php
  83. 25 0
      extend/TaobaoSdk/top/domain/Ucrowdrankitems.php
  84. 15 0
      extend/TaobaoSdk/top/domain/UpdateStatusResult.php
  85. 45 0
      extend/TaobaoSdk/top/domain/VegasCpaReportDTO.php
  86. 45 0
      extend/TaobaoSdk/top/domain/Video.php
  87. 20 0
      extend/TaobaoSdk/top/domain/Youjiacouponinfo.php
  88. 26 0
      extend/TaobaoSdk/top/fileTest.php
  89. 32 0
      extend/TaobaoSdk/top/request/AppipGetRequest.php
  90. 48 0
      extend/TaobaoSdk/top/request/AreasGetRequest.php
  91. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountLoginRequest.php
  92. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountLoginbytokenRequest.php
  93. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountLogindoublecheckRequest.php
  94. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountNewlogindoublecheckRequest.php
  95. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountPasswordResetRequest.php
  96. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountRegisterRequest.php
  97. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountRegistercodeCheckRequest.php
  98. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountRegistercodeSendRequest.php
  99. 47 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountResetcodeCheckRequest.php
  100. 0 0
      extend/TaobaoSdk/top/request/BaichuanOpenaccountResetcodeSendRequest.php

+ 78 - 0
extend/TaobaoSdk/Autoloader.php

@@ -0,0 +1,78 @@
1
+<?php
2
+
3
+class Autoloader{
4
+  
5
+  /**
6
+     * 类库自动加载,写死路径,确保不加载其他文件。
7
+     * @param string $class 对象类名
8
+     * @return void
9
+     */
10
+    public static function autoload($class) {
11
+        $name = $class;
12
+        if(false !== strpos($name,'\\')){
13
+          $name = strstr($class, '\\', true);
14
+        }
15
+        
16
+        $filename = TOP_AUTOLOADER_PATH."/top/".$name.".php";
17
+        if(is_file($filename)) {
18
+            include $filename;
19
+            return;
20
+        }
21
+
22
+        $filename = TOP_AUTOLOADER_PATH."/top/request/".$name.".php";
23
+        if(is_file($filename)) {
24
+            include $filename;
25
+            return;
26
+        }
27
+
28
+        $filename = TOP_AUTOLOADER_PATH."/top/domain/".$name.".php";
29
+        if(is_file($filename)) {
30
+            include $filename;
31
+            return;
32
+        }
33
+
34
+        $filename = TOP_AUTOLOADER_PATH."/aliyun/".$name.".php";
35
+        if(is_file($filename)) {
36
+            include $filename;
37
+            return;
38
+        }
39
+
40
+        $filename = TOP_AUTOLOADER_PATH."/aliyun/request/".$name.".php";
41
+        if(is_file($filename)) {
42
+            include $filename;
43
+            return;
44
+        }
45
+
46
+        $filename = TOP_AUTOLOADER_PATH."/aliyun/domain/".$name.".php";
47
+        if(is_file($filename)) {
48
+            include $filename;
49
+            return;
50
+        }      
51
+
52
+        $filename = TOP_AUTOLOADER_PATH."/dingtalk/".$name.".php";
53
+        if(is_file($filename)) {
54
+            include $filename;
55
+            return;
56
+        }
57
+        $filename = TOP_AUTOLOADER_PATH."/dingtalk/request/".$name.".php";
58
+        if(is_file($filename)) {
59
+            include $filename;
60
+            return;
61
+        }
62
+
63
+        $filename = TOP_AUTOLOADER_PATH."/dingtalk/domain/".$name.".php";
64
+        if(is_file($filename)) {
65
+            include $filename;
66
+            return;
67
+        }         
68
+		
69
+		$filename = TOP_AUTOLOADER_PATH."/QimenCloud/top/request/".$name.".php";
70
+        if(is_file($filename)) {
71
+            include $filename;
72
+            return;
73
+        }
74
+    }
75
+}
76
+
77
+spl_autoload_register('Autoloader::autoload');
78
+?>

+ 12 - 0
extend/TaobaoSdk/OapiTest.php

@@ -0,0 +1,12 @@
1
+<?php
2
+include "TopSdk.php";
3
+date_default_timezone_set('Asia/Shanghai');
4
+
5
+$c = new DingTalkClient(DingTalkConstant::$CALL_TYPE_OAPI, DingTalkConstant::$METHOD_POST , DingTalkConstant::$FORMAT_JSON);
6
+$req = new OapiMediaUploadRequest;
7
+$req->setType("image");
8
+$req->setMedia(array('type'=>'application/octet-stream','filename'=>'image.png', 'content' => file_get_contents('/Users/test/image.png')));
9
+$resp=$c->execute($req, "******","https://oapi.dingtalk.com/media/upload");
10
+var_dump($resp)
11
+
12
+?>

+ 384 - 0
extend/TaobaoSdk/QimenCloud/QimenCloudClient.php

@@ -0,0 +1,384 @@
1
+<?php
2
+class QimenCloudClient
3
+{
4
+	public $appkey;
5
+
6
+	public $secretKey;
7
+	
8
+	public $targetAppkey = "";
9
+
10
+	public $gatewayUrl = null;
11
+
12
+	public $format = "xml";
13
+
14
+	public $connectTimeout;
15
+
16
+	public $readTimeout;
17
+
18
+	/** 是否打开入参check**/
19
+	public $checkRequest = true;
20
+
21
+	protected $signMethod = "md5";
22
+
23
+	protected $apiVersion = "2.0";
24
+
25
+	protected $sdkVersion = "top-sdk-php-20151012";
26
+
27
+	public function getAppkey()
28
+	{
29
+		return $this->appkey;
30
+	}
31
+
32
+	public function __construct($appkey = "",$secretKey = ""){
33
+		$this->appkey = $appkey;
34
+		$this->secretKey = $secretKey ;
35
+	}
36
+
37
+	protected function generateSign($params)
38
+	{
39
+		ksort($params);
40
+
41
+		$stringToBeSigned = $this->secretKey;
42
+		foreach ($params as $k => $v)
43
+		{
44
+			if(!is_array($v) && "@" != substr($v, 0, 1))
45
+			{
46
+				$stringToBeSigned .= "$k$v";
47
+			}
48
+		}
49
+		unset($k, $v);
50
+		$stringToBeSigned .= $this->secretKey;
51
+
52
+		return strtoupper(md5($stringToBeSigned));
53
+	}
54
+
55
+	public function curl($url, $postFields = null)
56
+	{
57
+		$ch = curl_init();
58
+		curl_setopt($ch, CURLOPT_URL, $url);
59
+		curl_setopt($ch, CURLOPT_FAILONERROR, false);
60
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
61
+		if ($this->readTimeout) {
62
+			curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
63
+		}
64
+		if ($this->connectTimeout) {
65
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
66
+		}
67
+		curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
68
+		//https 请求
69
+		if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
70
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
71
+			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
72
+		}
73
+
74
+		if (is_array($postFields) && 0 < count($postFields))
75
+		{
76
+			$postBodyString = "";
77
+			$postMultipart = false;
78
+			foreach ($postFields as $k => $v)
79
+			{
80
+				if("@" != substr($v, 0, 1))//判断是不是文件上传
81
+				{
82
+					$postBodyString .= "$k=" . urlencode($v) . "&"; 
83
+				}
84
+				else//文件上传用multipart/form-data,否则用www-form-urlencoded
85
+				{
86
+					$postMultipart = true;
87
+					if(class_exists('\CURLFile')){
88
+						$postFields[$k] = new \CURLFile(substr($v, 1));
89
+					}
90
+				}
91
+			}
92
+			unset($k, $v);
93
+			curl_setopt($ch, CURLOPT_POST, true);
94
+			if ($postMultipart)
95
+			{
96
+				if (class_exists('\CURLFile')) {
97
+				    curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
98
+				} else {
99
+				    if (defined('CURLOPT_SAFE_UPLOAD')) {
100
+				        curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
101
+				    }
102
+				}
103
+				curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
104
+			}
105
+			else
106
+			{
107
+				$header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8");
108
+				curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
109
+				curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
110
+			}
111
+		}
112
+		$reponse = curl_exec($ch);
113
+		
114
+		if (curl_errno($ch))
115
+		{
116
+			throw new Exception(curl_error($ch),0);
117
+		}
118
+		else
119
+		{
120
+			$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
121
+			if (200 !== $httpStatusCode)
122
+			{
123
+				throw new Exception($reponse,$httpStatusCode);
124
+			}
125
+		}
126
+		curl_close($ch);
127
+		return $reponse;
128
+	}
129
+	public function curl_with_memory_file($url, $postFields = null, $fileFields = null)
130
+	{
131
+		$ch = curl_init();
132
+		curl_setopt($ch, CURLOPT_URL, $url);
133
+		curl_setopt($ch, CURLOPT_FAILONERROR, false);
134
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
135
+		if ($this->readTimeout) {
136
+			curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
137
+		}
138
+		if ($this->connectTimeout) {
139
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
140
+		}
141
+		curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
142
+		//https 请求
143
+		if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
144
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
145
+			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
146
+		}
147
+		//生成分隔符
148
+		$delimiter = '-------------' . uniqid();
149
+		//先将post的普通数据生成主体字符串
150
+		$data = '';
151
+		if($postFields != null){
152
+			foreach ($postFields as $name => $content) {
153
+			    $data .= "--" . $delimiter . "\r\n";
154
+			    $data .= 'Content-Disposition: form-data; name="' . $name . '"';
155
+			    //multipart/form-data 不需要urlencode,参见 http:stackoverflow.com/questions/6603928/should-i-url-encode-post-data
156
+			    $data .= "\r\n\r\n" . $content . "\r\n";
157
+			}
158
+			unset($name,$content);
159
+		}
160
+
161
+		//将上传的文件生成主体字符串
162
+		if($fileFields != null){
163
+			foreach ($fileFields as $name => $file) {
164
+			    $data .= "--" . $delimiter . "\r\n";
165
+			    $data .= 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $file['name'] . "\" \r\n";
166
+			    $data .= 'Content-Type: ' . $file['type'] . "\r\n\r\n";//多了个文档类型
167
+
168
+			    $data .= $file['content'] . "\r\n";
169
+			}
170
+			unset($name,$file);
171
+		}
172
+		//主体结束的分隔符
173
+		$data .= "--" . $delimiter . "--";
174
+
175
+		curl_setopt($ch, CURLOPT_POST, true);
176
+		curl_setopt($ch, CURLOPT_HTTPHEADER , array(
177
+		    'Content-Type: multipart/form-data; boundary=' . $delimiter,
178
+		    'Content-Length: ' . strlen($data))
179
+		); 
180
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
181
+		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
182
+
183
+		$reponse = curl_exec($ch);
184
+		unset($data);
185
+
186
+		if (curl_errno($ch))
187
+		{
188
+			throw new Exception(curl_error($ch),0);
189
+		}
190
+		else
191
+		{
192
+			$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
193
+			if (200 !== $httpStatusCode)
194
+			{
195
+				throw new Exception($reponse,$httpStatusCode);
196
+			}
197
+		}
198
+		curl_close($ch);
199
+		return $reponse;
200
+	}
201
+
202
+	protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
203
+	{
204
+		$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
205
+		$logger = new TopLogger;
206
+		$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
207
+		$logger->conf["separator"] = "^_^";
208
+		$logData = array(
209
+		date("Y-m-d H:i:s"),
210
+		$apiName,
211
+		$this->appkey,
212
+		$localIp,
213
+		PHP_OS,
214
+		$this->sdkVersion,
215
+		$requestUrl,
216
+		$errorCode,
217
+		str_replace("\n","",$responseTxt)
218
+		);
219
+		$logger->log($logData);
220
+	}
221
+
222
+	public function execute($request, $session = null,$bestUrl = null)
223
+	{
224
+		if($this->gatewayUrl == null) {
225
+			throw new Exception("client-check-error:Need Set gatewayUrl.", 40);
226
+		}
227
+
228
+		$result =  new ResultSet(); 
229
+		if($this->checkRequest) {
230
+			try {
231
+				$request->check();
232
+			} catch (Exception $e) {
233
+
234
+				$result->code = $e->getCode();
235
+				$result->msg = $e->getMessage();
236
+				return $result;
237
+			}
238
+		}
239
+		//组装系统参数
240
+		$sysParams["app_key"] = $this->appkey;
241
+		$sysParams["v"] = $this->apiVersion;
242
+		$sysParams["format"] = $this->format;
243
+		$sysParams["sign_method"] = $this->signMethod;
244
+		$sysParams["method"] = $request->getApiMethodName();
245
+		$sysParams["timestamp"] = date("Y-m-d H:i:s");
246
+		$sysParams["target_app_key"] = $this->targetAppkey;
247
+		if (null != $session)
248
+		{
249
+			$sysParams["session"] = $session;
250
+		}
251
+		$apiParams = array();
252
+		//获取业务参数
253
+		$apiParams = $request->getApiParas();
254
+
255
+
256
+		//系统参数放入GET请求串
257
+		if($bestUrl){
258
+			$requestUrl = $bestUrl."?";
259
+			$sysParams["partner_id"] = $this->getClusterTag();
260
+		}else{
261
+			$requestUrl = $this->gatewayUrl."?";
262
+			$sysParams["partner_id"] = $this->sdkVersion;
263
+		}
264
+		//签名
265
+		$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams));
266
+
267
+		foreach ($sysParams as $sysParamKey => $sysParamValue)
268
+		{
269
+			// if(strcmp($sysParamKey,"timestamp") != 0)
270
+			$requestUrl .= "$sysParamKey=" . urlencode($sysParamValue) . "&";
271
+		}
272
+
273
+		$fileFields = array();
274
+		foreach ($apiParams as $key => $value) {
275
+			if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
276
+				$value['name'] = $key;
277
+				$fileFields[$key] = $value;
278
+				unset($apiParams[$key]);
279
+			}
280
+		}
281
+
282
+		// $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
283
+		$requestUrl = substr($requestUrl, 0, -1);
284
+
285
+		//发起HTTP请求
286
+		try
287
+		{
288
+			if(count($fileFields) > 0){
289
+				$resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
290
+			}else{
291
+				$resp = $this->curl($requestUrl, $apiParams);
292
+			}
293
+		}
294
+		catch (Exception $e)
295
+		{
296
+			$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
297
+			$result->code = $e->getCode();
298
+			$result->msg = $e->getMessage();
299
+			return $result;
300
+		}
301
+
302
+		unset($apiParams);
303
+		unset($fileFields);
304
+		//解析TOP返回结果
305
+		$respWellFormed = false;
306
+		if ("json" == $this->format)
307
+		{
308
+			$respObject = json_decode($resp);
309
+			if (null !== $respObject)
310
+			{
311
+				$respWellFormed = true;
312
+				foreach ($respObject as $propKey => $propValue)
313
+				{
314
+					$respObject = $propValue;
315
+				}
316
+			}
317
+		}
318
+		else if("xml" == $this->format)
319
+		{
320
+			$respObject = @simplexml_load_string($resp);
321
+			if (false !== $respObject)
322
+			{
323
+				$respWellFormed = true;
324
+			}
325
+		}
326
+
327
+		//返回的HTTP文本不是标准JSON或者XML,记下错误日志
328
+		if (false === $respWellFormed)
329
+		{
330
+			$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
331
+			$result->code = 0;
332
+			$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
333
+			return $result;
334
+		}
335
+
336
+		//如果TOP返回了错误码,记录到业务错误日志中
337
+		if (isset($respObject->code))
338
+		{
339
+			$logger = new TopLogger;
340
+			$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
341
+			$logger->log(array(
342
+				date("Y-m-d H:i:s"),
343
+				$resp
344
+			));
345
+		}
346
+		return $respObject;
347
+	}
348
+
349
+	public function exec($paramsArray)
350
+	{
351
+		if (!isset($paramsArray["method"]))
352
+		{
353
+			trigger_error("No api name passed");
354
+		}
355
+		$inflector = new LtInflector;
356
+		$inflector->conf["separator"] = ".";
357
+		$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request";
358
+		if (!class_exists($requestClassName))
359
+		{
360
+			trigger_error("No such api: " . $paramsArray["method"]);
361
+		}
362
+
363
+		$session = isset($paramsArray["session"]) ? $paramsArray["session"] : null;
364
+
365
+		$req = new $requestClassName;
366
+		foreach($paramsArray as $paraKey => $paraValue)
367
+		{
368
+			$inflector->conf["separator"] = "_";
369
+			$setterMethodName = $inflector->camelize($paraKey);
370
+			$inflector->conf["separator"] = ".";
371
+			$setterMethodName = "set" . $inflector->camelize($setterMethodName);
372
+			if (method_exists($req, $setterMethodName))
373
+			{
374
+				$req->$setterMethodName($paraValue);
375
+			}
376
+		}
377
+		return $this->execute($req, $session);
378
+	}
379
+
380
+	private function getClusterTag()
381
+    {
382
+	    return substr($this->sdkVersion,0,11)."-cluster".substr($this->sdkVersion,11);
383
+    }
384
+}

+ 40 - 0
extend/TaobaoSdk/TopSdk.php

@@ -0,0 +1,40 @@
1
+<?php
2
+/**
3
+ * TOP SDK 入口文件
4
+ * 请不要修改这个文件,除非你知道怎样修改以及怎样恢复
5
+ * @author xuteng.xt
6
+ */
7
+
8
+/**
9
+ * 定义常量开始
10
+ * 在include("TopSdk.php")之前定义这些常量,不要直接修改本文件,以利于升级覆盖
11
+ */
12
+/**
13
+ * SDK工作目录
14
+ * 存放日志,TOP缓存数据
15
+ */
16
+if (!defined("TOP_SDK_WORK_DIR"))
17
+{
18
+	define("TOP_SDK_WORK_DIR", "/tmp/");
19
+}
20
+
21
+/**
22
+ * 是否处于开发模式
23
+ * 在你自己电脑上开发程序的时候千万不要设为false,以免缓存造成你的代码修改了不生效
24
+ * 部署到生产环境正式运营后,如果性能压力大,可以把此常量设定为false,能提高运行速度(对应的代价就是你下次升级程序时要清一下缓存)
25
+ */
26
+if (!defined("TOP_SDK_DEV_MODE"))
27
+{
28
+	define("TOP_SDK_DEV_MODE", true);
29
+}
30
+
31
+if (!defined("TOP_AUTOLOADER_PATH"))
32
+{
33
+	define("TOP_AUTOLOADER_PATH", dirname(__FILE__));
34
+}
35
+
36
+/**
37
+* 注册autoLoader,此注册autoLoader只加载top文件
38
+* 不要删除,除非你自己加载文件。
39
+**/
40
+require("Autoloader.php");

+ 255 - 0
extend/TaobaoSdk/aliyun/AliyunClient.php

@@ -0,0 +1,255 @@
1
+<?php
2
+class AliyunClient
3
+{
4
+	public $accessKeyId;
5
+
6
+	public $accessKeySecret;
7
+
8
+	public $serverUrl = "http://ecs.aliyuncs.com/";
9
+
10
+	public $format = "json";
11
+
12
+	public $connectTimeout = 3000;//3秒
13
+
14
+	public $readTimeout = 80000;//80秒
15
+
16
+	/** 是否打开入参check**/
17
+	public $checkRequest = true;
18
+
19
+	protected $signatureMethod = "HMAC-SHA1";
20
+
21
+	protected $signatureVersion = "1.0";
22
+	
23
+    protected  $dateTimeFormat = 'Y-m-d\TH:i:s\Z'; // ISO8601规范
24
+	
25
+	protected $sdkVersion = "1.0";
26
+
27
+	public function execute($request)
28
+	{
29
+		if($this->checkRequest) {
30
+			try {
31
+				$request->check();
32
+			} catch (Exception $e) {
33
+				$result->code = $e->getCode();
34
+				$result->message = $e->getMessage();
35
+				return $result;
36
+			}
37
+		}
38
+		//获取业务参数
39
+		$apiParams = $request->getApiParas();
40
+		//组装系统参数
41
+		$apiParams["AccessKeyId"] = $this->accessKeyId;
42
+		$apiParams["Format"] = $this->format;//
43
+		$apiParams["SignatureMethod"] = $this->signatureMethod;
44
+		$apiParams["SignatureVersion"] = $this->signatureVersion;
45
+		$apiParams["SignatureNonce"] = uniqid();
46
+		date_default_timezone_set("GMT");
47
+		$apiParams["TimeStamp"] = date($this->dateTimeFormat);
48
+		$apiParams["partner_id"] = $this->sdkVersion;
49
+		
50
+	    $apiNameArray =	split("\.", $request->getApiMethodName());
51
+		$apiParams["Action"] = $apiNameArray[3];
52
+		$apiParams["Version"] = $apiNameArray[4];
53
+		//签名
54
+		$apiParams["Signature"] = $this->computeSignature($apiParams, $this->accessKeySecret);
55
+
56
+		//系统参数放入GET请求串
57
+		$requestUrl = rtrim($this->serverUrl,"/") . "/?";
58
+		foreach ($apiParams as $apiParamKey => $apiParamValue)
59
+		{
60
+			$requestUrl .= "$apiParamKey=" . urlencode($apiParamValue) . "&";
61
+		}
62
+		$requestUrl = substr($requestUrl, 0, -1);
63
+		//发起HTTP请求
64
+		try
65
+		{
66
+			$resp = $this->curl($requestUrl, null);
67
+		}
68
+		catch (Exception $e)
69
+		{
70
+			$this->logCommunicationError($apiParams["Action"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
71
+			if ("json" == $this->format)
72
+			{
73
+				return  json_decode($e->getMessage());
74
+			}
75
+			else if("xml" == $this->format)
76
+			{
77
+				return  @simplexml_load_string($e->getMessage());
78
+			}
79
+	    }
80
+
81
+		//解析API返回结果
82
+		$respWellFormed = false;
83
+		if ("json" == $this->format)
84
+		{
85
+			$respObject = json_decode($resp);
86
+			if (null !== $respObject)
87
+			{
88
+				$respWellFormed = true;
89
+			}
90
+		}
91
+		else if("xml" == $this->format)
92
+		{
93
+			$respObject = @simplexml_load_string($resp);
94
+			if (false !== $respObject)
95
+			{
96
+				$respWellFormed = true;
97
+			}
98
+		}
99
+
100
+		//返回的HTTP文本不是标准JSON或者XML,记下错误日志
101
+		if (false === $respWellFormed)
102
+		{
103
+			$this->logCommunicationError($apiParams["Action"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
104
+			$result->code = 0;
105
+			$result->message = "HTTP_RESPONSE_NOT_WELL_FORMED";
106
+			return $result;
107
+		}
108
+
109
+		//如果TOP返回了错误码,记录到业务错误日志中
110
+		if (isset($respObject->code))
111
+		{
112
+			$logger = new LtLogger;
113
+			$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
114
+			$logger->log(array(
115
+				date("Y-m-d H:i:s"),
116
+				$resp
117
+			));
118
+		}
119
+		return $respObject;
120
+	}
121
+
122
+	public function exec($paramsArray)
123
+	{
124
+		if (!isset($paramsArray["Action"]))
125
+		{
126
+			trigger_error("No api name passed");
127
+		}
128
+		$inflector = new LtInflector;
129
+		$inflector->conf["separator"] = ".";
130
+		$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["Action"], 7))) . "Request";
131
+		if (!class_exists($requestClassName))
132
+		{
133
+			trigger_error("No such api: " . $paramsArray["Action"]);
134
+		}
135
+
136
+		$req = new $requestClassName;
137
+		foreach($paramsArray as $paraKey => $paraValue)
138
+		{
139
+			$inflector->conf["separator"] = "_";
140
+			$setterMethodName = $inflector->camelize($paraKey);
141
+			$inflector->conf["separator"] = ".";
142
+			$setterMethodName = "set" . $inflector->camelize($setterMethodName);
143
+			if (method_exists($req, $setterMethodName))
144
+			{
145
+				$req->$setterMethodName($paraValue);
146
+			}
147
+		}
148
+		return $this->execute($req, $session);
149
+	}
150
+	
151
+	protected function percentEncode($str)
152
+	{
153
+	    // 使用urlencode编码后,将"+","*","%7E"做替换即满足 API规定的编码规范
154
+	    $res = urlencode($str);
155
+	    $res = preg_replace('/\+/', '%20', $res);
156
+	    $res = preg_replace('/\*/', '%2A', $res);
157
+	    $res = preg_replace('/%7E/', '~', $res);
158
+	    return $res;
159
+	}
160
+	
161
+	protected function computeSignature($parameters, $accessKeySecret)
162
+	{
163
+	    // 将参数Key按字典顺序排序
164
+	    ksort($parameters);
165
+	
166
+	    // 生成规范化请求字符串
167
+	    $canonicalizedQueryString = '';
168
+	    foreach($parameters as $key => $value)
169
+	    {
170
+		$canonicalizedQueryString .= '&' . $this->percentEncode($key) 
171
+		    . '=' . $this->percentEncode($value);
172
+	    }
173
+	
174
+	    // 生成用于计算签名的字符串 stringToSign
175
+	    $stringToSign = 'GET&%2F&' . $this->percentencode(substr($canonicalizedQueryString, 1));
176
+	
177
+	    // 计算签名,注意accessKeySecret后面要加上字符'&'
178
+	    $signature = base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret . '&', true));
179
+	    return $signature;
180
+	}
181
+	
182
+    public function curl($url, $postFields = null)
183
+	{
184
+		$ch = curl_init();
185
+		curl_setopt($ch, CURLOPT_URL, $url);
186
+		curl_setopt($ch, CURLOPT_FAILONERROR, false);
187
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
188
+		if ($this->readTimeout) {
189
+			curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
190
+		}
191
+		if ($this->connectTimeout) {
192
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
193
+		}
194
+		//https 请求
195
+		if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
196
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
197
+			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
198
+		}
199
+
200
+		if (is_array($postFields) && 0 < count($postFields))
201
+		{
202
+			$postBodyString = "";
203
+			$postMultipart = false;
204
+			foreach ($postFields as $k => $v)
205
+			{
206
+				if("@" != substr($v, 0, 1))//判断是不是文件上传
207
+				{
208
+					$postBodyString .= "$k=" . urlencode($v) . "&"; 
209
+				}
210
+				else//文件上传用multipart/form-data,否则用www-form-urlencoded
211
+				{
212
+					$postMultipart = true;
213
+				}
214
+			}
215
+			unset($k, $v);
216
+			curl_setopt($ch, CURLOPT_POST, true);
217
+			if ($postMultipart)
218
+			{
219
+				curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
220
+			}
221
+			else
222
+			{
223
+				curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
224
+			}
225
+		}
226
+		$reponse = curl_exec($ch);
227
+		
228
+		if (curl_errno($ch))
229
+		{
230
+			throw new Exception(curl_error($ch),0);
231
+		}
232
+		curl_close($ch);
233
+		return $reponse;
234
+	}
235
+
236
+	protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
237
+	{
238
+		$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
239
+		$logger = new LtLogger;
240
+		$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->accessKeyId . "_" . date("Y-m-d") . ".log";
241
+		$logger->conf["separator"] = "^_^";
242
+		$logData = array(
243
+		date("Y-m-d H:i:s"),
244
+		$apiName,
245
+		$this->accessKeyId,
246
+		$localIp,
247
+		PHP_OS,
248
+		$this->sdkVersion,
249
+		$requestUrl,
250
+		$errorCode,
251
+		str_replace("\n","",$responseTxt)
252
+		);
253
+		$logger->log($logData);
254
+	}
255
+}

+ 656 - 0
extend/TaobaoSdk/dingtalk/DingTalkClient.php

@@ -0,0 +1,656 @@
1
+<?php
2
+class DingTalkClient
3
+{
4
+	/**@Author chaohui.zch copy from TopClient and modify 2016-12-14 **/
5
+
6
+    /**@Author chaohui.zch modify $gatewayUrl 2017-07-18 **/
7
+    public $gatewayUrl = "https://eco.taobao.com/router/rest";
8
+
9
+	public $format = "xml";
10
+
11
+	public $connectTimeout;
12
+
13
+	public $readTimeout;
14
+
15
+    public $apiCallType;
16
+
17
+    public $httpMethod;
18
+
19
+	/** 是否打开入参check**/
20
+	public $checkRequest = true;
21
+
22
+	protected $apiVersion = "2.0";
23
+
24
+	protected $sdkVersion = "dingtalk-sdk-php-20161214";
25
+
26
+    public function __construct($apiCallType = null, $httpMethod = null, $format = "xml"){
27
+        $this->apiCallType = $apiCallType;
28
+        $this->httpMethod = $httpMethod;
29
+        $this->format = $format;
30
+    }
31
+
32
+	public function curl($url, $postFields = null)
33
+	{
34
+		$ch = curl_init();
35
+		curl_setopt($ch, CURLOPT_URL, $url);
36
+		curl_setopt($ch, CURLOPT_FAILONERROR, false);
37
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
38
+		if ($this->readTimeout) {
39
+			curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
40
+		}
41
+		if ($this->connectTimeout) {
42
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
43
+		}
44
+		curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
45
+		//https 请求
46
+		if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
47
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
48
+			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
49
+		}
50
+
51
+		if (is_array($postFields) && 0 < count($postFields))
52
+		{
53
+			$postBodyString = "";
54
+			$postMultipart = false;
55
+			foreach ($postFields as $k => $v)
56
+			{
57
+				if("@" != substr($v, 0, 1))//判断是不是文件上传
58
+				{
59
+					$postBodyString .= "$k=" . urlencode($v) . "&"; 
60
+				}
61
+				else//文件上传用multipart/form-data,否则用www-form-urlencoded
62
+				{
63
+					$postMultipart = true;
64
+					if(class_exists('\CURLFile')){
65
+						$postFields[$k] = new \CURLFile(substr($v, 1));
66
+					}
67
+				}
68
+			}
69
+			unset($k, $v);
70
+			curl_setopt($ch, CURLOPT_POST, true);
71
+			if ($postMultipart)
72
+			{
73
+				if (class_exists('\CURLFile')) {
74
+				    curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
75
+				} else {
76
+				    if (defined('CURLOPT_SAFE_UPLOAD')) {
77
+				        curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
78
+				    }
79
+				}
80
+				curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
81
+			}
82
+			else
83
+			{
84
+				$header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8");
85
+				curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
86
+				curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
87
+			}
88
+		}
89
+		$reponse = curl_exec($ch);
90
+		
91
+		if (curl_errno($ch))
92
+		{
93
+			throw new Exception(curl_error($ch),0);
94
+		}
95
+		else
96
+		{
97
+			$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
98
+			if (200 !== $httpStatusCode)
99
+			{
100
+				throw new Exception($reponse,$httpStatusCode);
101
+			}
102
+		}
103
+		curl_close($ch);
104
+		return $reponse;
105
+	}
106
+
107
+    public function curl_get($url,$apiFields = null)
108
+    {
109
+        $ch = curl_init();
110
+
111
+        foreach ($apiFields as $key => $value)
112
+        {
113
+            if(!is_string($value)){
114
+                $value = json_encode($value);
115
+            }
116
+            $url .= "&" ."$key=" . urlencode($value);
117
+        }
118
+
119
+        curl_setopt($ch, CURLOPT_URL, $url);
120
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
121
+        curl_setopt($ch, CURLOPT_FAILONERROR, false);
122
+        curl_setopt($ch, CURLOPT_HEADER, false);
123
+        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
124
+
125
+
126
+        if ($this->readTimeout)
127
+        {
128
+            curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
129
+        }
130
+
131
+        if ($this->connectTimeout)
132
+        {
133
+            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
134
+        }
135
+
136
+        curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
137
+
138
+        //https ignore ssl check ?
139
+        if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" )
140
+        {
141
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
142
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
143
+        }
144
+
145
+        $reponse = curl_exec($ch);
146
+
147
+        if (curl_errno($ch))
148
+        {
149
+            throw new Exception(curl_error($ch),0);
150
+        }
151
+        else
152
+        {
153
+            $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
154
+            if (200 !== $httpStatusCode)
155
+            {
156
+                throw new Exception($reponse,$httpStatusCode);
157
+            }
158
+        }
159
+        curl_close($ch);
160
+        return $reponse;
161
+    }
162
+
163
+    public function curl_json($url, $postFields = null)
164
+    {
165
+        $ch = curl_init();
166
+        curl_setopt($ch, CURLOPT_URL, $url);
167
+        curl_setopt($ch, CURLOPT_FAILONERROR, false);
168
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
169
+        if ($this->readTimeout) {
170
+            curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
171
+        }
172
+        if ($this->connectTimeout) {
173
+            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
174
+        }
175
+        curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
176
+        //https 请求
177
+        if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
178
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
179
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
180
+        }
181
+
182
+        if (is_array($postFields) && 0 < count($postFields))
183
+        {
184
+            $postBodyString = "";
185
+            $postMultipart = false;
186
+            foreach ($postFields as $k => $v)
187
+            {
188
+                if(!is_string($v)){
189
+                    $v = json_encode($v);
190
+                }
191
+                if("@" != substr($v, 0, 1))//判断是不是文件上传
192
+                {
193
+                    $postBodyString .= "$k=" . urlencode($v) . "&";
194
+                }
195
+                else//文件上传用multipart/form-data,否则用www-form-urlencoded
196
+                {
197
+                    $postMultipart = true;
198
+                    if(class_exists('\CURLFile')){
199
+                        $postFields[$k] = new \CURLFile(substr($v, 1));
200
+                    }
201
+                }
202
+            }
203
+            unset($k, $v);
204
+            curl_setopt($ch, CURLOPT_POST, true);
205
+            if ($postMultipart)
206
+            {
207
+                if (class_exists('\CURLFile')) {
208
+                    curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
209
+                } else {
210
+                    if (defined('CURLOPT_SAFE_UPLOAD')) {
211
+                        curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
212
+                    }
213
+                }
214
+                curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
215
+            }
216
+            else {
217
+                $header = array("Content-Type: application/json; charset=utf-8", "Content-Length:".strlen(json_encode($postFields)));
218
+                curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
219
+                curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postFields));
220
+            }
221
+        }
222
+        $reponse = curl_exec($ch);
223
+
224
+        if (curl_errno($ch))
225
+        {
226
+            throw new Exception(curl_error($ch),0);
227
+        }
228
+        else
229
+        {
230
+            $httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
231
+            if (200 !== $httpStatusCode)
232
+            {
233
+                throw new Exception($reponse,$httpStatusCode);
234
+            }
235
+        }
236
+        curl_close($ch);
237
+        return $reponse;
238
+    }
239
+
240
+	public function curl_with_memory_file($url, $postFields = null, $fileFields = null)
241
+	{
242
+		$ch = curl_init();
243
+		curl_setopt($ch, CURLOPT_URL, $url);
244
+		curl_setopt($ch, CURLOPT_FAILONERROR, false);
245
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
246
+		if ($this->readTimeout) {
247
+			curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
248
+		}
249
+		if ($this->connectTimeout) {
250
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
251
+		}
252
+		curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
253
+		//https 请求
254
+		if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
255
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
256
+			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
257
+		}
258
+		//生成分隔符
259
+		$delimiter = '-------------' . uniqid();
260
+		//先将post的普通数据生成主体字符串
261
+		$data = '';
262
+		if($postFields != null){
263
+			foreach ($postFields as $name => $content) {
264
+			    $data .= "--" . $delimiter . "\r\n";
265
+			    $data .= 'Content-Disposition: form-data; name="' . $name . '"';
266
+			    //multipart/form-data 不需要urlencode,参见 http:stackoverflow.com/questions/6603928/should-i-url-encode-post-data
267
+			    $data .= "\r\n\r\n" . $content . "\r\n";
268
+			}
269
+			unset($name,$content);
270
+		}
271
+
272
+		//将上传的文件生成主体字符串
273
+		if($fileFields != null){
274
+			foreach ($fileFields as $name => $file) {
275
+			    $data .= "--" . $delimiter . "\r\n";
276
+			    $data .= 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $file['filename'] . "\" \r\n";
277
+			    $data .= 'Content-Type: ' . $file['type'] . "\r\n\r\n";//多了个文档类型
278
+
279
+			    $data .= $file['content'] . "\r\n";
280
+			}
281
+			unset($name,$file);
282
+		}
283
+		//主体结束的分隔符
284
+		$data .= "--" . $delimiter . "--";
285
+
286
+		curl_setopt($ch, CURLOPT_POST, true);
287
+		curl_setopt($ch, CURLOPT_HTTPHEADER , array(
288
+		    'Content-Type: multipart/form-data; boundary=' . $delimiter,
289
+		    'Content-Length: ' . strlen($data))
290
+		); 
291
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
292
+		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
293
+
294
+		$reponse = curl_exec($ch);
295
+		unset($data);
296
+
297
+		if (curl_errno($ch))
298
+		{
299
+			throw new Exception(curl_error($ch),0);
300
+		}
301
+		else
302
+		{
303
+			$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
304
+			if (200 !== $httpStatusCode)
305
+			{
306
+				throw new Exception($reponse,$httpStatusCode);
307
+			}
308
+		}
309
+		curl_close($ch);
310
+		return $reponse;
311
+	}
312
+
313
+	protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
314
+	{
315
+		$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
316
+		$logger = new TopLogger;
317
+		$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . "_" . date("Y-m-d") . ".log";
318
+		$logger->conf["separator"] = "^_^";
319
+		$logData = array(
320
+		date("Y-m-d H:i:s"),
321
+		$apiName,
322
+		$localIp,
323
+		PHP_OS,
324
+		$this->sdkVersion,
325
+		$requestUrl,
326
+		$errorCode,
327
+		str_replace("\n","",$responseTxt)
328
+		);
329
+		$logger->log($logData);
330
+	}
331
+
332
+    public function execute($request, $session = null,$bestUrl = null){
333
+        if(DingTalkConstant::$CALL_TYPE_OAPI == $this->apiCallType){
334
+            return $this->_executeOapi($request, $session, $bestUrl, null, null, null, null);
335
+        }else{
336
+            return $this->_execute($request, $session, $bestUrl);
337
+        }
338
+    }
339
+
340
+    public function executeWithAccessKey($request, $bestUrl = null, $accessKey, $accessSecret){
341
+        return $this->executeWithCorpId($request, $bestUrl, $accessKey, $accessSecret, null, null);
342
+    }
343
+
344
+    public function executeWithSuiteTicket($request,$bestUrl = null, $accessKey, $accessSecret, $suiteTicket){
345
+        return $this->executeWithCorpId($request,$bestUrl, $accessKey, $accessSecret, $suiteTicket, null);
346
+    }
347
+
348
+	public function executeWithCorpId($request, $bestUrl = null, $accessKey, $accessSecret, $suiteTicket, $corpId) {
349
+        if(DingTalkConstant::$CALL_TYPE_OAPI == $this->apiCallType){
350
+            return $this->_executeOapi($request, null, $bestUrl,$accessKey, $accessSecret, $suiteTicket, $corpId);
351
+        }else{
352
+            return $this->_execute($request, null, $bestUrl);
353
+        }
354
+    }
355
+
356
+    private function _executeOapi($request, $session = null,$bestUrl = null,$accessKey, $accessSecret, $suiteTicket, $corpId){
357
+        $result =  new ResultSet();
358
+        if($this->checkRequest) {
359
+            try {
360
+                $request->check();
361
+            } catch (Exception $e) {
362
+
363
+                $result->code = $e->getCode();
364
+                $result->msg = $e->getMessage();
365
+                return $result;
366
+            }
367
+        }
368
+
369
+        $sysParams["method"] = $request->getApiMethodName();
370
+        //系统参数放入GET请求串
371
+        if($bestUrl){
372
+            if(strpos($bestUrl,'?') === false){
373
+                $requestUrl = $bestUrl."?";
374
+            }else{
375
+                $requestUrl = $bestUrl;
376
+            }
377
+        }else{
378
+            $requestUrl = $this->gatewayUrl."?";
379
+        }
380
+        if(null != $accessKey){
381
+            $timestamp = $this->getMillisecond();
382
+            // 验证签名有效性
383
+            $canonicalString = $this->getCanonicalStringForIsv($timestamp, $suiteTicket);
384
+            $signature = $this->computeSignature($accessSecret, $canonicalString);
385
+
386
+            $queryParams["accessKey"] = $accessKey;
387
+            $queryParams["signature"] = $signature;
388
+            $queryParams["timestamp"] = $timestamp+"";
389
+            if($suiteTicket != null) {
390
+                $queryParams["suiteTicket"] = $suiteTicket;
391
+            }
392
+            if($corpId != null){
393
+                $queryParams["corpId"] =  $corpId;
394
+            }
395
+            foreach ($queryParams as $queryParamKey => $queryParamValue) {
396
+                $requestUrl .= "$queryParamKey=" . urlencode($queryParamValue) . "&";
397
+            }
398
+        }else{
399
+            $requestUrl .= "access_token=" . urlencode($session) . "&";
400
+        }
401
+
402
+        $apiParams = array();
403
+        //获取业务参数
404
+        $apiParams = $request->getApiParas();
405
+        $fileFields = array();
406
+        foreach ($apiParams as $key => $value) {
407
+            if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
408
+                $value['name'] = $key;
409
+                $fileFields[$key] = $value;
410
+                unset($apiParams[$key]);
411
+            }
412
+        }
413
+
414
+        // $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
415
+        $requestUrl = substr($requestUrl, 0, -1);
416
+
417
+        //发起HTTP请求
418
+        try
419
+        {
420
+            if(count($fileFields) > 0){
421
+                $resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
422
+            }else{
423
+                if(DingTalkConstant::$METHOD_POST == $this->httpMethod){
424
+                    $resp = $this->curl_json($requestUrl, $apiParams);
425
+                }else{
426
+                    $resp = $this->curl_get($requestUrl, $apiParams);
427
+                }
428
+            }
429
+        }
430
+        catch (Exception $e)
431
+        {
432
+            $this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
433
+            $result->code = $e->getCode();
434
+            $result->msg = $e->getMessage();
435
+            return $result;
436
+        }
437
+
438
+        unset($apiParams);
439
+        unset($fileFields);
440
+        //解析TOP返回结果
441
+        $respWellFormed = false;
442
+        if ("json" == $this->format)
443
+        {
444
+            $respObject = json_decode($resp);
445
+            if (null !== $respObject)
446
+            {
447
+                $respWellFormed = true;
448
+            }
449
+        }
450
+        else if("xml" == $this->format)
451
+        {
452
+            $respObject = @simplexml_load_string($resp);
453
+            if (false !== $respObject)
454
+            {
455
+                $respWellFormed = true;
456
+            }
457
+        }
458
+
459
+        //返回的HTTP文本不是标准JSON或者XML,记下错误日志
460
+        if (false === $respWellFormed)
461
+        {
462
+            $this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
463
+            $result->code = 0;
464
+            $result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
465
+            return $result;
466
+        }
467
+
468
+        //如果TOP返回了错误码,记录到业务错误日志中
469
+        if (isset($respObject->code))
470
+        {
471
+            $logger = new TopLogger;
472
+            $logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" .  "_" . date("Y-m-d") . ".log";
473
+            $logger->log(array(
474
+                date("Y-m-d H:i:s"),
475
+                $resp
476
+            ));
477
+        }
478
+        return $respObject;
479
+    }
480
+
481
+    private function getMillisecond() {
482
+        list($s1, $s2) = explode(' ', microtime());
483
+        return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
484
+    }
485
+
486
+    private function getCanonicalStringForIsv($timestamp, $suiteTicket) {
487
+        $result = $timestamp;
488
+        if($suiteTicket != null) {
489
+            $result .= "\n".$suiteTicket;
490
+        }
491
+        return $result;
492
+    }
493
+
494
+    private function computeSignature($accessSecret, $canonicalString){
495
+        $s = hash_hmac('sha256', $canonicalString, $accessSecret, true);
496
+        return base64_encode($s);
497
+    }
498
+
499
+    private function _execute($request, $session = null,$bestUrl = null)
500
+	{
501
+		$result =  new ResultSet(); 
502
+		if($this->checkRequest) {
503
+			try {
504
+				$request->check();
505
+			} catch (Exception $e) {
506
+
507
+				$result->code = $e->getCode();
508
+				$result->msg = $e->getMessage();
509
+				return $result;
510
+			}
511
+		}
512
+		//组装系统参数
513
+		$sysParams["v"] = $this->apiVersion;
514
+		$sysParams["format"] = $this->format;
515
+		$sysParams["method"] = $request->getApiMethodName();
516
+		$sysParams["timestamp"] = date("Y-m-d H:i:s");
517
+		if (null != $session)
518
+		{
519
+			$sysParams["session"] = $session;
520
+		}
521
+		$apiParams = array();
522
+		//获取业务参数
523
+		$apiParams = $request->getApiParas();
524
+
525
+
526
+		//系统参数放入GET请求串
527
+		if($bestUrl){
528
+            if(strpos($bestUrl,'?') === false){
529
+                $requestUrl = $bestUrl."?";
530
+            }else{
531
+                $requestUrl = $bestUrl;
532
+            }
533
+			$sysParams["partner_id"] = $this->getClusterTag();
534
+		}else{
535
+			$requestUrl = $this->gatewayUrl."?";
536
+			$sysParams["partner_id"] = $this->sdkVersion;
537
+		}
538
+
539
+		foreach ($sysParams as $sysParamKey => $sysParamValue)
540
+		{
541
+			// if(strcmp($sysParamKey,"timestamp") != 0)
542
+			$requestUrl .= "$sysParamKey=" . urlencode($sysParamValue) . "&";
543
+		}
544
+
545
+		$fileFields = array();
546
+		foreach ($apiParams as $key => $value) {
547
+			if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
548
+				$value['name'] = $key;
549
+				$fileFields[$key] = $value;
550
+				unset($apiParams[$key]);
551
+			}
552
+		}
553
+
554
+		// $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
555
+		$requestUrl = substr($requestUrl, 0, -1);
556
+
557
+		//发起HTTP请求
558
+		try
559
+		{
560
+			if(count($fileFields) > 0){
561
+				$resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
562
+			}else{
563
+				$resp = $this->curl($requestUrl, $apiParams);
564
+			}
565
+		}
566
+		catch (Exception $e)
567
+		{
568
+			$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
569
+			$result->code = $e->getCode();
570
+			$result->msg = $e->getMessage();
571
+			return $result;
572
+		}
573
+
574
+		unset($apiParams);
575
+		unset($fileFields);
576
+		//解析TOP返回结果
577
+		$respWellFormed = false;
578
+		if ("json" == $this->format)
579
+		{
580
+			$respObject = json_decode($resp);
581
+			if (null !== $respObject)
582
+			{
583
+				$respWellFormed = true;
584
+				foreach ($respObject as $propKey => $propValue)
585
+				{
586
+					$respObject = $propValue;
587
+				}
588
+			}
589
+		}
590
+		else if("xml" == $this->format)
591
+		{
592
+			$respObject = @simplexml_load_string($resp);
593
+			if (false !== $respObject)
594
+			{
595
+				$respWellFormed = true;
596
+			}
597
+		}
598
+
599
+		//返回的HTTP文本不是标准JSON或者XML,记下错误日志
600
+		if (false === $respWellFormed)
601
+		{
602
+			$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
603
+			$result->code = 0;
604
+			$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
605
+			return $result;
606
+		}
607
+
608
+		//如果TOP返回了错误码,记录到业务错误日志中
609
+		if (isset($respObject->code))
610
+		{
611
+			$logger = new TopLogger;
612
+			$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" .  "_" . date("Y-m-d") . ".log";
613
+			$logger->log(array(
614
+				date("Y-m-d H:i:s"),
615
+				$resp
616
+			));
617
+		}
618
+		return $respObject;
619
+	}
620
+
621
+	public function exec($paramsArray)
622
+	{
623
+		if (!isset($paramsArray["method"]))
624
+		{
625
+			trigger_error("No api name passed");
626
+		}
627
+		$inflector = new LtInflector;
628
+		$inflector->conf["separator"] = ".";
629
+		$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request";
630
+		if (!class_exists($requestClassName))
631
+		{
632
+			trigger_error("No such dingtalk-api: " . $paramsArray["method"]);
633
+		}
634
+
635
+		$session = isset($paramsArray["session"]) ? $paramsArray["session"] : null;
636
+
637
+		$req = new $requestClassName;
638
+		foreach($paramsArray as $paraKey => $paraValue)
639
+		{
640
+			$inflector->conf["separator"] = "_";
641
+			$setterMethodName = $inflector->camelize($paraKey);
642
+			$inflector->conf["separator"] = ".";
643
+			$setterMethodName = "set" . $inflector->camelize($setterMethodName);
644
+			if (method_exists($req, $setterMethodName))
645
+			{
646
+				$req->$setterMethodName($paraValue);
647
+			}
648
+		}
649
+		return $this->execute($req, $session);
650
+	}
651
+
652
+	private function getClusterTag()
653
+    {
654
+	    return substr($this->sdkVersion,0,11)."-cluster".substr($this->sdkVersion,11);
655
+    }
656
+}

+ 18 - 0
extend/TaobaoSdk/dingtalk/DingTalkConstant.php

@@ -0,0 +1,18 @@
1
+<?php
2
+/**
3
+ * Created by PhpStorm.
4
+ * User: zuodeng
5
+ * Date: 2018/7/18
6
+ * Time: 上午11:31
7
+ */
8
+class DingTalkConstant
9
+{
10
+    static $CALL_TYPE_OAPI = "oapi";
11
+    static $CALL_TYPE_TOP = "top";
12
+
13
+    static $METHOD_POST = "POST";
14
+    static $METHOD_GET = "GET";
15
+
16
+    static $FORMAT_JSON = "json";
17
+    static $FORMAT_XML = "xml";
18
+}

+ 47 - 0
extend/TaobaoSdk/top/ApplicationVar.php

@@ -0,0 +1,47 @@
1
+<?php
2
+
3
+class ApplicationVar
4
+{
5
+	var $save_file;
6
+	var $application  = null;
7
+ 	var $app_data    = '';
8
+ 	var $__writed    = false;
9
+
10
+	function __construct()
11
+ 	{
12
+    $this->save_file = __DIR__.'/httpdns.conf' ;
13
+ 		$this->application = array();
14
+ 	}
15
+
16
+ 	public function setValue($var_name,$var_value)
17
+  {
18
+   		if (!is_string($var_name) || empty($var_name))
19
+    		return false;
20
+   
21
+   		$this->application[$var_name] = $var_value;
22
+  }
23
+
24
+  public function write(){
25
+      $this->app_data = @serialize($this->application);    
26
+      $this->__writeToFile();
27
+  }
28
+
29
+ 	public function getValue()
30
+ 	{
31
+     	if (!is_file($this->save_file))
32
+        	 $this->__writeToFile();
33
+     	return @unserialize(@file_get_contents($this->save_file));
34
+ 	}
35
+
36
+ 	function __writeToFile()
37
+ 	{
38
+  		$fp = @fopen($this->save_file,"w");
39
+      if(flock($fp , LOCK_EX | LOCK_NB)){
40
+          @fwrite($fp,$this->app_data);
41
+          flock($fp , LOCK_UN);
42
+      }
43
+      @fclose($fp);
44
+ 	}
45
+}
46
+
47
+?>

+ 199 - 0
extend/TaobaoSdk/top/ClusterTopClient.php

@@ -0,0 +1,199 @@
1
+<?php
2
+class ClusterTopClient extends TopClient {
3
+
4
+	private static $dnsconfig;
5
+	private static $syncDate = 0;
6
+	private static $applicationVar ;
7
+	private static $cfgDuration = 10;
8
+
9
+	public function __construct($appkey = "",$secretKey = ""){
10
+		ClusterTopClient::$applicationVar = new ApplicationVar;
11
+		$this->appkey = $appkey;
12
+		$this->secretKey = $secretKey ;
13
+		$saveConfig = ClusterTopClient::$applicationVar->getValue();
14
+
15
+		if($saveConfig){
16
+			$tmpConfig = $saveConfig['dnsconfig'];
17
+			ClusterTopClient::$dnsconfig = $this->object_to_array($tmpConfig);
18
+			unset($tmpConfig);
19
+
20
+			ClusterTopClient::$syncDate = $saveConfig['syncDate'];
21
+			if(!ClusterTopClient::$syncDate)
22
+				ClusterTopClient::$syncDate = 0;
23
+		}
24
+	}
25
+
26
+	public function __destruct(){
27
+		if(ClusterTopClient::$dnsconfig && ClusterTopClient::$syncDate){
28
+			ClusterTopClient::$applicationVar->setValue("dnsconfig",ClusterTopClient::$dnsconfig);
29
+			ClusterTopClient::$applicationVar->setValue("syncDate",ClusterTopClient::$syncDate);
30
+			ClusterTopClient::$applicationVar->write();
31
+		}
32
+	}
33
+
34
+	public function execute($request = null, $session = null,$bestUrl = null){
35
+		$currentDate = date('U');
36
+		$syncDuration = $this->getDnsConfigSyncDuration();
37
+		$bestUrl = $this->getBestVipUrl($this->gatewayUrl,$request->getApiMethodName(),$session);
38
+		if($currentDate - ClusterTopClient::$syncDate > $syncDuration * 60){
39
+			$httpdns = new HttpdnsGetRequest;
40
+			ClusterTopClient::$dnsconfig = json_decode(parent::execute($httpdns,null,$bestUrl)->result,true);
41
+			$syncDate = date('U');
42
+			ClusterTopClient::$syncDate = $syncDate ;
43
+		}
44
+		return parent::execute($request,$session,$bestUrl);
45
+	}
46
+
47
+	private function getDnsConfigSyncDuration(){
48
+		if(ClusterTopClient::$cfgDuration){
49
+			return ClusterTopClient::$cfgDuration;
50
+		}
51
+		if(!ClusterTopClient::$dnsconfig){
52
+			return ClusterTopClient::$cfgDuration;
53
+		}
54
+		$config = json_encode(ClusterTopClient::$dnsconfig);
55
+		if(!$config){
56
+			return ClusterTopClient::$cfgDuration;
57
+		}
58
+		$config = ClusterTopClient::$dnsconfig['config'];
59
+		$duration = $config['interval'];
60
+		ClusterTopClient::$cfgDuration = $duration;
61
+
62
+		return ClusterTopClient::$cfgDuration;
63
+	}
64
+
65
+	private function getBestVipUrl($url,$apiname = null,$session = null){
66
+		$config = ClusterTopClient::$dnsconfig['config'];
67
+		$degrade = $config['degrade'];
68
+		if(strcmp($degrade,'true') == 0){
69
+			return $url;
70
+		}		
71
+		$currentEnv = $this->getEnvByApiName($apiname,$session);
72
+		$vip = $this->getVipByEnv($url,$currentEnv);
73
+		if($vip)
74
+			return $vip;
75
+		return $url;
76
+	}
77
+
78
+	private function getVipByEnv($comUrl,$currentEnv){
79
+		$urlSchema = parse_url($comUrl);
80
+		if(!$urlSchema)
81
+			return null;
82
+		if(!ClusterTopClient::$dnsconfig['env'])
83
+			return null;
84
+		
85
+		if(!array_key_exists($currentEnv,ClusterTopClient::$dnsconfig['env']))
86
+			return null;
87
+
88
+		$hostList = ClusterTopClient::$dnsconfig['env'][$currentEnv];
89
+		if(!$hostList)
90
+			return null ;
91
+
92
+		$vipList = null;
93
+		foreach ($hostList as $key => $value) {
94
+			if(strcmp($key,$urlSchema['host']) == 0 && strcmp($value['proto'],$urlSchema['scheme']) == 0){
95
+				$vipList = $value;
96
+				break;
97
+			}
98
+		}
99
+		$vip = $this->getRandomWeightElement($vipList['vip']);
100
+		
101
+		if($vip){
102
+			return $urlSchema['scheme']."://".$vip.$urlSchema['path'];
103
+		}
104
+		return null;
105
+	}
106
+
107
+	private function getEnvByApiName($apiName,$session=""){
108
+		$apiCfgArray = ClusterTopClient::$dnsconfig['api'];
109
+		if($apiCfgArray){	
110
+			if(array_key_exists($apiName,$apiCfgArray)){
111
+				$apiCfg = $apiCfgArray[$apiName];
112
+				if(array_key_exists('user',$apiCfg)){
113
+					$userFlag = $apiCfg['user'];
114
+					$flag = $this->getUserFlag($session);
115
+					if($userFlag && $flag ){
116
+						return $this->getEnvBySessionFlag($userFlag,$flag);
117
+					}else{
118
+						return $this->getRandomWeightElement($apiCfg['rule']);
119
+					}
120
+				}
121
+			}
122
+		}
123
+		return $this->getDeafultEnv();
124
+	}
125
+
126
+	private function getUserFlag($session){
127
+		if($session && strlen($session) > 5){
128
+			if($session[0] == '6' || $session[0] == '7'){
129
+				return $session[strlen($session) -1];
130
+			}else if($session[0] == '5' || $session[0] == '8'){
131
+				return $session[5];
132
+			}
133
+		}
134
+		return null;
135
+	}
136
+
137
+	private function getEnvBySessionFlag($targetConfig,$flag){
138
+		if($flag){
139
+			$userConf = ClusterTopClient::$dnsconfig['user'];
140
+			$cfgArry = $userConf[$targetConfig];
141
+			foreach ($cfgArry as $key => $value) {
142
+				if(in_array($flag,$value))
143
+					return $key;
144
+			}
145
+		}else{
146
+			return null;
147
+		}
148
+	}
149
+
150
+	private function getRandomWeightElement($elements){
151
+		$totalWeight = 0;
152
+		if($elements){
153
+			foreach ($elements as $ele) {
154
+				$weight = $this->getElementWeight($ele);
155
+				$r = $this->randomFloat() * ($weight + $totalWeight);
156
+				if($r >= $totalWeight){
157
+					$selected = $ele;
158
+				}
159
+				$totalWeight += $weight;
160
+			}
161
+			if($selected){
162
+				return $this->getElementValue($selected);
163
+			}
164
+		}
165
+		return null;
166
+
167
+	}
168
+
169
+	private function getElementWeight($ele){
170
+		$params = explode('|', $ele);
171
+		return floatval($params[1]);
172
+	}
173
+	private function getElementValue($ele){
174
+		$params = explode('|', $ele);
175
+		return $params[0];		
176
+	}
177
+
178
+	private function getDeafultEnv(){
179
+		return ClusterTopClient::$dnsconfig['config']['def_env'];
180
+	}
181
+
182
+	private static function startsWith($haystack, $needle) {
183
+    	return $needle === "" || strpos($haystack, $needle) === 0;
184
+	}
185
+
186
+	private function object_to_array($obj) 
187
+	{ 
188
+    	$_arr= is_object($obj) ? get_object_vars($obj) : $obj; 
189
+    	foreach($_arr as $key=> $val) 
190
+    	{ 
191
+        	$val= (is_array($val) || is_object($val))? $this->object_to_array($val) : $val; 
192
+        	$arr[$key] = $val; 
193
+    	} 
194
+    	return$arr; 
195
+	}
196
+
197
+	private function randomFloat($min = 0, $max = 1) { return $min + mt_rand() / mt_getrandmax() * ($max - $min); }
198
+}
199
+?>

+ 23 - 0
extend/TaobaoSdk/top/HttpdnsGetRequest.php

@@ -0,0 +1,23 @@
1
+<?php
2
+
3
+class HttpdnsGetRequest
4
+{
5
+	private $apiParas = array();
6
+	
7
+	public function getApiMethodName()
8
+	{
9
+		return "taobao.httpdns.get";
10
+	}
11
+	
12
+	public function getApiParas()
13
+	{
14
+		return $this->apiParas;
15
+	}
16
+	
17
+	public function check(){}
18
+	
19
+	public function putOtherTextParam($key, $value) {
20
+		$this->apiParas[$key] = $value;
21
+		$this->$key = $value;
22
+	}
23
+}

+ 107 - 0
extend/TaobaoSdk/top/RequestCheckUtil.php

@@ -0,0 +1,107 @@
1
+<?php
2
+/**
3
+ * API入参静态检查类
4
+ * 可以对API的参数类型、长度、最大值等进行校验
5
+ *
6
+ **/
7
+class RequestCheckUtil
8
+{
9
+	/**
10
+	 * 校验字段 fieldName 的值$value非空
11
+	 *
12
+	 **/
13
+	public static function checkNotNull($value,$fieldName) {
14
+		
15
+		if(self::checkEmpty($value)){
16
+			throw new Exception("client-check-error:Missing Required Arguments: " .$fieldName , 40);
17
+		}
18
+	}
19
+
20
+	/**
21
+	 * 检验字段fieldName的值value 的长度
22
+	 *
23
+	 **/
24
+	public static function checkMaxLength($value,$maxLength,$fieldName){		
25
+		if(!self::checkEmpty($value) && mb_strlen($value , "UTF-8") > $maxLength){
26
+			throw new Exception("client-check-error:Invalid Arguments:the length of " .$fieldName . " can not be larger than " . $maxLength . "." , 41);
27
+		}
28
+	}
29
+
30
+	/**
31
+	 * 检验字段fieldName的值value的最大列表长度
32
+	 *
33
+	 **/
34
+	public static function checkMaxListSize($value,$maxSize,$fieldName) {	
35
+
36
+		if(self::checkEmpty($value))
37
+			return ;
38
+
39
+		$list=preg_split("/,/",$value);
40
+		if(count($list) > $maxSize){
41
+				throw new Exception("client-check-error:Invalid Arguments:the listsize(the string split by \",\") of ". $fieldName . " must be less than " . $maxSize . " ." , 41);
42
+		}
43
+	}
44
+
45
+	/**
46
+	 * 检验字段fieldName的值value 的最大值
47
+	 *
48
+	 **/
49
+	public static function checkMaxValue($value,$maxValue,$fieldName){	
50
+
51
+		if(self::checkEmpty($value))
52
+			return ;
53
+
54
+		self::checkNumeric($value,$fieldName);
55
+
56
+		if($value > $maxValue){
57
+				throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " can not be larger than " . $maxValue ." ." , 41);
58
+		}
59
+	}
60
+
61
+	/**
62
+	 * 检验字段fieldName的值value 的最小值
63
+	 *
64
+	 **/
65
+	public static function checkMinValue($value,$minValue,$fieldName) {
66
+		
67
+		if(self::checkEmpty($value))
68
+			return ;
69
+
70
+		self::checkNumeric($value,$fieldName);
71
+		
72
+		if($value < $minValue){
73
+				throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " can not be less than " . $minValue . " ." , 41);
74
+		}
75
+	}
76
+
77
+	/**
78
+	 * 检验字段fieldName的值value是否是number
79
+	 *
80
+	 **/
81
+	protected static function checkNumeric($value,$fieldName) {
82
+		if(!is_numeric($value))
83
+			throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " is not number : " . $value . " ." , 41);
84
+	}
85
+
86
+	/**
87
+	 * 校验$value是否非空
88
+	 *  if not set ,return true;
89
+	 *	if is null , return true;
90
+	 *	
91
+	 *
92
+	 **/
93
+	public static function checkEmpty($value) {
94
+		if(!isset($value))
95
+			return true ;
96
+		if($value === null )
97
+			return true;
98
+		if(is_array($value) && count($value) == 0)
99
+			return true;
100
+		if(is_string($value) &&trim($value) === "")
101
+			return true;
102
+		
103
+		return false;
104
+	}
105
+
106
+}
107
+?>

+ 21 - 0
extend/TaobaoSdk/top/ResultSet.php

@@ -0,0 +1,21 @@
1
+<?php
2
+/**
3
+ * 返回的默认类
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2015-01-20
7
+ */
8
+class ResultSet
9
+{
10
+	
11
+	/** 
12
+	 * 返回的错误码
13
+	 **/
14
+	public $code;
15
+	
16
+	/** 
17
+	 * 返回的错误信息
18
+	 **/
19
+	public $msg;
20
+	
21
+}

+ 219 - 0
extend/TaobaoSdk/top/SpiUtils.php

@@ -0,0 +1,219 @@
1
+<?php
2
+class SpiUtils{
3
+	private static $top_sign_list = "HTTP_TOP_SIGN_LIST";
4
+	private static $timestamp = "timestamp";
5
+	private static $header_real_ip = array("X_Real_IP", "X_Forwarded_For", "Proxy_Client_IP",
6
+											"WL_Proxy_Client_IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR");
7
+	/**
8
+	 * 校验SPI请求签名,适用于所有GET请求,及不包含文件参数的POST请求。
9
+	 * 
10
+	 * @param request 请求对象
11
+	 * @param secret app对应的secret
12
+	 * @return true:校验通过;false:校验不通过
13
+	 */
14
+	public static function checkSign4FormRequest($secret){
15
+		return self::checkSign(null,null,$secret);
16
+	}
17
+
18
+	/**
19
+	 * 校验SPI请求签名,适用于请求体是xml/json等可用文本表示的POST请求。
20
+	 * 
21
+	 * @param request 请求对象
22
+	 * @param body 请求体的文本内容
23
+	 * @param secret app对应的secret
24
+	 * @return true:校验通过;false:校验不通过
25
+	 */
26
+	public static function checkSign4TextRequest($body,$secret){
27
+		return self::checkSign(null,$body,$secret);
28
+	}
29
+	
30
+	/**
31
+	 * 校验SPI请求签名,适用于带文件上传的POST请求。
32
+	 * 
33
+	 * @param request 请求对象
34
+	 * @param form 除了文件参数以外的所有普通文本参数的map集合
35
+	 * @param secret app对应的secret
36
+	 * @return true:校验通过;false:校验不通过
37
+	 */
38
+	public static function checkSign4FileRequest($form, $secret){
39
+		return self::checkSign($form, null, $secret);
40
+	}
41
+
42
+	private static function checkSign($form, $body, $secret) {
43
+		$params = array();
44
+		// 1. 获取header参数
45
+		$headerMap = self::getHeaderMap();
46
+		foreach ($headerMap as $k => $v){
47
+			$params[$k] = $v ;
48
+		}
49
+
50
+		// 2. 获取url参数
51
+		$queryMap = self::getQueryMap();
52
+		foreach ($queryMap as $k => $v){
53
+			$params[$k] = $v ;
54
+		}
55
+
56
+		// 3. 获取form参数
57
+		if ($form == null && $body == null) {
58
+			$formMap = self::getFormMap();
59
+			foreach ($formMap as $k => $v){
60
+				$params[$k] = $v ;
61
+			}
62
+		} else if ($form != null) {
63
+			foreach ($form as $k => $v){
64
+				$params[$k] = $v ;
65
+			}
66
+		}
67
+
68
+		if($body == null){
69
+			$body = file_get_contents('php://input');
70
+		}
71
+
72
+		$remoteSign = $queryMap["sign"];
73
+		$localSign = self::sign($params, $body, $secret);
74
+		if (strcmp($remoteSign, $localSign) == 0) {
75
+			return true;
76
+		} else {
77
+			$paramStr = self::getParamStrFromMap($params);
78
+			self::logCommunicationError($remoteSign,$localSign,$paramStr,$body);
79
+			return false;
80
+		}
81
+	}
82
+
83
+	private static function getHeaderMap() {
84
+		$headerMap = array();
85
+		$signList = $_SERVER['HTTP_TOP_SIGN_LIST']; // 只获取参与签名的头部字段
86
+
87
+		if(!$signList) {
88
+			return $headerMap;
89
+		}
90
+
91
+		$signList = trim($signList);
92
+		if (strlen($signList) > 0){
93
+			$params = split(",", $signList);
94
+			foreach ($_SERVER as $k => $v){
95
+				if (substr($k, 0, 5) == 'HTTP_'){
96
+					foreach($params as $kk){
97
+						$upperkey = strtoupper($kk);
98
+						if(self::endWith($k,$upperkey)){
99
+							$headerMap[$kk] = $v;
100
+						}
101
+					}
102
+				}
103
+			}
104
+		}
105
+		return $headerMap;
106
+	}
107
+
108
+	private static function getQueryMap(){
109
+		$queryStr = $_SERVER["QUERY_STRING"];
110
+		$resultArray = array();
111
+		foreach (explode('&', $queryStr) as $pair) {
112
+		    list($key, $value) = explode('=', $pair);
113
+		    if (strpos($key, '.') !== false) {
114
+		        list($subKey, $subVal) = explode('.', $key);
115
+
116
+		        if (preg_match('/(?P<name>\w+)\[(?P<index>\w+)\]/', $subKey, $matches)) {
117
+		            $resultArray[$matches['name']][$matches['index']][$subVal] = $value;
118
+		        } else {
119
+		            $resultArray[$subKey][$subVal] = urldecode($value);
120
+		        }
121
+		    } else {
122
+		        $resultArray[$key] = urldecode($value);
123
+		    }
124
+		}
125
+		return $resultArray;
126
+	}
127
+
128
+	private static function checkRemoteIp(){
129
+		$remoteIp = $_SERVER["REMOTE_ADDR"];
130
+		foreach ($header_real_ip as $k){
131
+			$realIp = $_SERVER[$k];
132
+			$realIp = trim($realIp);
133
+			if(strlen($realIp) > 0 && strcasecmp("unknown",$realIp)){
134
+				$remoteIp = $realIp;
135
+				break;
136
+			}
137
+		}
138
+		return self::startsWith($remoteIp,"140.205.144.") || self::startsWith($remoteIp,"40.205.145.");
139
+	}
140
+
141
+	private static function getFormMap(){
142
+		$resultArray = array();
143
+		foreach($_POST as $key=>$v) { 
144
+			$resultArray[$key] = $v ;
145
+		}
146
+		return $resultArray ;	
147
+	}
148
+
149
+	private static function startsWith($haystack, $needle) {
150
+    	return $needle === "" || strpos($haystack, $needle) === 0;
151
+	}
152
+
153
+	private static function endWith($haystack, $needle) {   
154
+	    $length = strlen($needle);  
155
+	    if($length == 0)
156
+	    {    
157
+	        return true;  
158
+	    }  
159
+	    return (substr($haystack, -$length) === $needle);
160
+ 	}
161
+
162
+	private static function checkTimestamp(){
163
+		$ts = $_POST['timestamp'];
164
+		if($ts){
165
+			$clientTimestamp = strtotime($ts);
166
+			$current = $_SERVER['REQUEST_TIME'];
167
+			return ($current - $clientTimestamp) <= 5*60*1000;
168
+		}else{
169
+			return false;
170
+		}
171
+	}
172
+
173
+	private static function getParamStrFromMap($params){
174
+		ksort($params);
175
+		$stringToBeSigned = "";
176
+		foreach ($params as $k => $v)
177
+		{
178
+			if(strcmp("sign", $k) != 0)
179
+			{
180
+				$stringToBeSigned .= "$k$v";
181
+			}
182
+		}
183
+		unset($k, $v);
184
+		return $stringToBeSigned;
185
+	}
186
+
187
+	private static function sign($params,$body,$secret){
188
+		ksort($params);
189
+
190
+		$stringToBeSigned = $secret;
191
+		$stringToBeSigned .= self::getParamStrFromMap($params);
192
+
193
+		if($body)
194
+			$stringToBeSigned .= $body;
195
+		$stringToBeSigned .= $secret;
196
+		return strtoupper(md5($stringToBeSigned));
197
+	}
198
+
199
+	protected static function logCommunicationError($remoteSign, $localSign, $paramStr, $body)
200
+	{
201
+		$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
202
+		$logger = new TopLogger;
203
+		$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_". date("Y-m-d") . ".log";
204
+		$logger->conf["separator"] = "^_^";
205
+		$logData = array(
206
+		"checkTopSign error" ,
207
+		"remoteSign=".$remoteSign ,
208
+		"localSign=".$localSign ,
209
+		"paramStr=".$paramStr ,
210
+		"body=".$body
211
+		);
212
+		$logger->log($logData);
213
+	}
214
+	private static function clear_blank($str, $glue='')
215
+	{
216
+		$replace = array(" ", "\r", "\n", "\t"); return str_replace($replace, $glue, $str);
217
+	}
218
+}
219
+?>

+ 377 - 0
extend/TaobaoSdk/top/TopClient.php

@@ -0,0 +1,377 @@
1
+<?php
2
+class TopClient
3
+{
4
+	public $appkey;
5
+
6
+	public $secretKey;
7
+
8
+	public $gatewayUrl = "http://gw.api.taobao.com/router/rest";
9
+
10
+	public $format = "xml";
11
+
12
+	public $connectTimeout;
13
+
14
+	public $readTimeout;
15
+
16
+	/** 是否打开入参check**/
17
+	public $checkRequest = true;
18
+
19
+	protected $signMethod = "md5";
20
+
21
+	protected $apiVersion = "2.0";
22
+
23
+	protected $sdkVersion = "top-sdk-php-20251103";
24
+
25
+	public function getAppkey()
26
+	{
27
+		return $this->appkey;
28
+	}
29
+
30
+	public function __construct($appkey = "",$secretKey = ""){
31
+		$this->appkey = $appkey;
32
+		$this->secretKey = $secretKey ;
33
+	}
34
+
35
+	protected function generateSign($params)
36
+	{
37
+		ksort($params);
38
+
39
+		$stringToBeSigned = $this->secretKey;
40
+		foreach ($params as $k => $v)
41
+		{
42
+			if(!is_array($v) && "@" != substr($v, 0, 1))
43
+			{
44
+				$stringToBeSigned .= "$k$v";
45
+			}
46
+		}
47
+		unset($k, $v);
48
+		$stringToBeSigned .= $this->secretKey;
49
+
50
+		return strtoupper(md5($stringToBeSigned));
51
+	}
52
+
53
+	public function curl($url, $postFields = null)
54
+	{
55
+		$ch = curl_init();
56
+		curl_setopt($ch, CURLOPT_URL, $url);
57
+		curl_setopt($ch, CURLOPT_FAILONERROR, false);
58
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
59
+		if ($this->readTimeout) {
60
+			curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
61
+		}
62
+		if ($this->connectTimeout) {
63
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
64
+		}
65
+		curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
66
+		//https 请求
67
+		if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
68
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
69
+			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
70
+		}
71
+
72
+		if (is_array($postFields) && 0 < count($postFields))
73
+		{
74
+			$postBodyString = "";
75
+			$postMultipart = false;
76
+			foreach ($postFields as $k => $v)
77
+			{
78
+				if("@" != substr($v, 0, 1))//判断是不是文件上传
79
+				{
80
+					$postBodyString .= "$k=" . urlencode($v) . "&"; 
81
+				}
82
+				else//文件上传用multipart/form-data,否则用www-form-urlencoded
83
+				{
84
+					$postMultipart = true;
85
+					if(class_exists('\CURLFile')){
86
+						$postFields[$k] = new \CURLFile(substr($v, 1));
87
+					}
88
+				}
89
+			}
90
+			unset($k, $v);
91
+			curl_setopt($ch, CURLOPT_POST, true);
92
+			if ($postMultipart)
93
+			{
94
+				if (class_exists('\CURLFile')) {
95
+				    curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
96
+				} else {
97
+				    if (defined('CURLOPT_SAFE_UPLOAD')) {
98
+				        curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
99
+				    }
100
+				}
101
+				curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
102
+			}
103
+			else
104
+			{
105
+				$header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8");
106
+				curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
107
+				curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
108
+			}
109
+		}
110
+		$reponse = curl_exec($ch);
111
+		
112
+		if (curl_errno($ch))
113
+		{
114
+			throw new Exception(curl_error($ch),0);
115
+		}
116
+		else
117
+		{
118
+			$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
119
+			if (200 !== $httpStatusCode)
120
+			{
121
+				throw new Exception($reponse,$httpStatusCode);
122
+			}
123
+		}
124
+		curl_close($ch);
125
+		return $reponse;
126
+	}
127
+	public function curl_with_memory_file($url, $postFields = null, $fileFields = null)
128
+	{
129
+		$ch = curl_init();
130
+		curl_setopt($ch, CURLOPT_URL, $url);
131
+		curl_setopt($ch, CURLOPT_FAILONERROR, false);
132
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
133
+		if ($this->readTimeout) {
134
+			curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
135
+		}
136
+		if ($this->connectTimeout) {
137
+			curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
138
+		}
139
+		curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
140
+		//https 请求
141
+		if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
142
+			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
143
+			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
144
+		}
145
+		//生成分隔符
146
+		$delimiter = '-------------' . uniqid();
147
+		//先将post的普通数据生成主体字符串
148
+		$data = '';
149
+		if($postFields != null){
150
+			foreach ($postFields as $name => $content) {
151
+			    $data .= "--" . $delimiter . "\r\n";
152
+			    $data .= 'Content-Disposition: form-data; name="' . $name . '"';
153
+			    //multipart/form-data 不需要urlencode,参见 http:stackoverflow.com/questions/6603928/should-i-url-encode-post-data
154
+			    $data .= "\r\n\r\n" . $content . "\r\n";
155
+			}
156
+			unset($name,$content);
157
+		}
158
+
159
+		//将上传的文件生成主体字符串
160
+		if($fileFields != null){
161
+			foreach ($fileFields as $name => $file) {
162
+			    $data .= "--" . $delimiter . "\r\n";
163
+			    $data .= 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $file['name'] . "\" \r\n";
164
+			    $data .= 'Content-Type: ' . $file['type'] . "\r\n\r\n";//多了个文档类型
165
+
166
+			    $data .= $file['content'] . "\r\n";
167
+			}
168
+			unset($name,$file);
169
+		}
170
+		//主体结束的分隔符
171
+		$data .= "--" . $delimiter . "--";
172
+
173
+		curl_setopt($ch, CURLOPT_POST, true);
174
+		curl_setopt($ch, CURLOPT_HTTPHEADER , array(
175
+		    'Content-Type: multipart/form-data; boundary=' . $delimiter,
176
+		    'Content-Length: ' . strlen($data))
177
+		); 
178
+		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
179
+		curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
180
+
181
+		$reponse = curl_exec($ch);
182
+		unset($data);
183
+
184
+		if (curl_errno($ch))
185
+		{
186
+			throw new Exception(curl_error($ch),0);
187
+		}
188
+		else
189
+		{
190
+			$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
191
+			if (200 !== $httpStatusCode)
192
+			{
193
+				throw new Exception($reponse,$httpStatusCode);
194
+			}
195
+		}
196
+		curl_close($ch);
197
+		return $reponse;
198
+	}
199
+
200
+	protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
201
+	{
202
+		$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
203
+		$logger = new TopLogger;
204
+		$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
205
+		$logger->conf["separator"] = "^_^";
206
+		$logData = array(
207
+		date("Y-m-d H:i:s"),
208
+		$apiName,
209
+		$this->appkey,
210
+		$localIp,
211
+		PHP_OS,
212
+		$this->sdkVersion,
213
+		$requestUrl,
214
+		$errorCode,
215
+		str_replace("\n","",$responseTxt)
216
+		);
217
+		$logger->log($logData);
218
+	}
219
+
220
+	public function execute($request, $session = null,$bestUrl = null)
221
+	{
222
+		$result =  new ResultSet(); 
223
+		if($this->checkRequest) {
224
+			try {
225
+				$request->check();
226
+			} catch (Exception $e) {
227
+
228
+				$result->code = $e->getCode();
229
+				$result->msg = $e->getMessage();
230
+				return $result;
231
+			}
232
+		}
233
+		//组装系统参数
234
+		$sysParams["app_key"] = $this->appkey;
235
+		$sysParams["v"] = $this->apiVersion;
236
+		$sysParams["format"] = $this->format;
237
+		$sysParams["sign_method"] = $this->signMethod;
238
+		$sysParams["method"] = $request->getApiMethodName();
239
+		$sysParams["timestamp"] = date("Y-m-d H:i:s");
240
+		if (null != $session)
241
+		{
242
+			$sysParams["session"] = $session;
243
+		}
244
+		$apiParams = array();
245
+		//获取业务参数
246
+		$apiParams = $request->getApiParas();
247
+
248
+
249
+		//系统参数放入GET请求串
250
+		if($bestUrl){
251
+			$requestUrl = $bestUrl."?";
252
+			$sysParams["partner_id"] = $this->getClusterTag();
253
+		}else{
254
+			$requestUrl = $this->gatewayUrl."?";
255
+			$sysParams["partner_id"] = $this->sdkVersion;
256
+		}
257
+		//签名
258
+		$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams));
259
+
260
+		foreach ($sysParams as $sysParamKey => $sysParamValue)
261
+		{
262
+			// if(strcmp($sysParamKey,"timestamp") != 0)
263
+			$requestUrl .= "$sysParamKey=" . urlencode($sysParamValue) . "&";
264
+		}
265
+
266
+		$fileFields = array();
267
+		foreach ($apiParams as $key => $value) {
268
+			if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
269
+				$value['name'] = $key;
270
+				$fileFields[$key] = $value;
271
+				unset($apiParams[$key]);
272
+			}
273
+		}
274
+
275
+		// $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
276
+		$requestUrl = substr($requestUrl, 0, -1);
277
+
278
+		//发起HTTP请求
279
+		try
280
+		{
281
+			if(count($fileFields) > 0){
282
+				$resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
283
+			}else{
284
+				$resp = $this->curl($requestUrl, $apiParams);
285
+			}
286
+		}
287
+		catch (Exception $e)
288
+		{
289
+			$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
290
+			$result->code = $e->getCode();
291
+			$result->msg = $e->getMessage();
292
+			return $result;
293
+		}
294
+
295
+		unset($apiParams);
296
+		unset($fileFields);
297
+		//解析TOP返回结果
298
+		$respWellFormed = false;
299
+		if ("json" == $this->format)
300
+		{
301
+			$respObject = json_decode($resp);
302
+			if (null !== $respObject)
303
+			{
304
+				$respWellFormed = true;
305
+				foreach ($respObject as $propKey => $propValue)
306
+				{
307
+					$respObject = $propValue;
308
+				}
309
+			}
310
+		}
311
+		else if("xml" == $this->format)
312
+		{
313
+			$respObject = @simplexml_load_string($resp);
314
+			if (false !== $respObject)
315
+			{
316
+				$respWellFormed = true;
317
+			}
318
+		}
319
+
320
+		//返回的HTTP文本不是标准JSON或者XML,记下错误日志
321
+		if (false === $respWellFormed)
322
+		{
323
+			$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
324
+			$result->code = 0;
325
+			$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
326
+			return $result;
327
+		}
328
+
329
+		//如果TOP返回了错误码,记录到业务错误日志中
330
+		if (isset($respObject->code))
331
+		{
332
+			$logger = new TopLogger;
333
+			$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
334
+			$logger->log(array(
335
+				date("Y-m-d H:i:s"),
336
+				$resp
337
+			));
338
+		}
339
+		return $respObject;
340
+	}
341
+
342
+	public function exec($paramsArray)
343
+	{
344
+		if (!isset($paramsArray["method"]))
345
+		{
346
+			trigger_error("No api name passed");
347
+		}
348
+		$inflector = new LtInflector;
349
+		$inflector->conf["separator"] = ".";
350
+		$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request";
351
+		if (!class_exists($requestClassName))
352
+		{
353
+			trigger_error("No such api: " . $paramsArray["method"]);
354
+		}
355
+
356
+		$session = isset($paramsArray["session"]) ? $paramsArray["session"] : null;
357
+
358
+		$req = new $requestClassName;
359
+		foreach($paramsArray as $paraKey => $paraValue)
360
+		{
361
+			$inflector->conf["separator"] = "_";
362
+			$setterMethodName = $inflector->camelize($paraKey);
363
+			$inflector->conf["separator"] = ".";
364
+			$setterMethodName = "set" . $inflector->camelize($setterMethodName);
365
+			if (method_exists($req, $setterMethodName))
366
+			{
367
+				$req->$setterMethodName($paraValue);
368
+			}
369
+		}
370
+		return $this->execute($req, $session);
371
+	}
372
+
373
+	private function getClusterTag()
374
+    {
375
+	    return substr($this->sdkVersion,0,11)."-cluster".substr($this->sdkVersion,11);
376
+    }
377
+}

+ 43 - 0
extend/TaobaoSdk/top/TopLogger.php

@@ -0,0 +1,43 @@
1
+<?php
2
+class TopLogger
3
+{
4
+	public $conf = array(
5
+		"separator" => "\t",
6
+		"log_file" => ""
7
+	);
8
+
9
+	private $fileHandle;
10
+
11
+	protected function getFileHandle()
12
+	{
13
+		if (null === $this->fileHandle)
14
+		{
15
+			if (empty($this->conf["log_file"]))
16
+			{
17
+				trigger_error("no log file spcified.");
18
+			}
19
+			$logDir = dirname($this->conf["log_file"]);
20
+			if (!is_dir($logDir))
21
+			{
22
+				mkdir($logDir, 0777, true);
23
+			}
24
+			$this->fileHandle = fopen($this->conf["log_file"], "a");
25
+		}
26
+		return $this->fileHandle;
27
+	}
28
+
29
+	public function log($logData)
30
+	{
31
+		if ("" == $logData || array() == $logData)
32
+		{
33
+			return false;
34
+		}
35
+		if (is_array($logData))
36
+		{
37
+			$logData = implode($this->conf["separator"], $logData);
38
+		}
39
+		$logData = $logData. "\n";
40
+		fwrite($this->getFileHandle(), $logData);
41
+	}
42
+}
43
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/ActivityTagMapData.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 货品展示标识列表
5
+ * @author auto create
6
+ */
7
+class ActivityTagMapData
8
+{
9
+	
10
+	/** 
11
+	 * 货品展示标识,展示在商品标题前的商品活动标
12
+	 **/
13
+	public $tag_name;	
14
+}
15
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/Area.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * 地址区域信息列表.返回的Area包含的具体信息为入参fields请求的字段信息 。
5
+ * @author auto create
6
+ */
7
+class Area
8
+{
9
+	
10
+	/** 
11
+	 * 标准行政区域代码.参考:http://www.stats.gov.cn/tjbz/xzqhdm/t20120105_402777427.htm
12
+	 **/
13
+	public $id;
14
+	
15
+	/** 
16
+	 * 地域名称.如北京市,杭州市,西湖区,每一个area_id 都代表了一个具体的地区.
17
+	 **/
18
+	public $name;
19
+	
20
+	/** 
21
+	 * 父节点区域标识.如北京市的area_id是110100,朝阳区是北京市的一个区,所以朝阳区的parent_id就是北京市的area_id.
22
+	 **/
23
+	public $parent_id;
24
+	
25
+	/** 
26
+	 * 区域类型.area区域 1:country/国家;2:province/省/自治区/直辖市;3:city/地区(省下面的地级市);4:district/县/市(县级市)/区;abroad:海外. 比如北京市的area_type = 2,朝阳区是北京市的一个区,所以朝阳区的area_type = 4.
27
+	 **/
28
+	public $type;
29
+	
30
+	/** 
31
+	 * 具体一个地区的邮编
32
+	 **/
33
+	public $zip;	
34
+}
35
+?>

+ 140 - 0
extend/TaobaoSdk/top/domain/BasicMapData.php

@@ -0,0 +1,140 @@
1
+<?php
2
+
3
+/**
4
+ * 商品基本信息
5
+ * @author auto create
6
+ */
7
+class BasicMapData
8
+{
9
+	
10
+	/** 
11
+	 * 年销量
12
+	 **/
13
+	public $annual_vol;
14
+	
15
+	/** 
16
+	 * 商品信息-品牌名称
17
+	 **/
18
+	public $brand_name;
19
+	
20
+	/** 
21
+	 * 叶子类目名称
22
+	 **/
23
+	public $category_name;
24
+	
25
+	/** 
26
+	 * 商品信息-是否包邮
27
+	 **/
28
+	public $free_shipment;
29
+	
30
+	/** 
31
+	 * 好评率是否高于行业均值(字段等级SA)
32
+	 **/
33
+	public $h_good_rate;
34
+	
35
+	/** 
36
+	 * 成交转化是否高于行业均值(字段等级SA)
37
+	 **/
38
+	public $h_pay_rate30;
39
+	
40
+	/** 
41
+	 * 退款率是否低于行业均值(字段等级SA)
42
+	 **/
43
+	public $i_rfd_rate;
44
+	
45
+	/** 
46
+	 * 是否加入消费者保障
47
+	 **/
48
+	public $is_prepay;
49
+	
50
+	/** 
51
+	 * 商品链接
52
+	 **/
53
+	public $item_url;
54
+	
55
+	/** 
56
+	 * 一级类目名称
57
+	 **/
58
+	public $level_one_category_name;
59
+	
60
+	/** 
61
+	 * 商品库类型,支持多库类型输出,以英文逗号分隔“,”分隔,1:营销商品主推库,2:内容商品库,3:淘宝主推商品库,如果值为空则不属于1,2,3这三种商品类型
62
+	 **/
63
+	public $material_lib_type;
64
+	
65
+	/** 
66
+	 * 商品主图
67
+	 **/
68
+	public $pict_url;
69
+	
70
+	/** 
71
+	 * 商品所在地
72
+	 **/
73
+	public $provcity;
74
+	
75
+	/** 
76
+	 * 卖家等级(字段等级SA)
77
+	 **/
78
+	public $ratesum;
79
+	
80
+	/** 
81
+	 * 卖家id(字段等级C)
82
+	 **/
83
+	public $seller_id;
84
+	
85
+	/** 
86
+	 * 店铺dsr 评分(字段等级SA)
87
+	 **/
88
+	public $shop_dsr;
89
+	
90
+	/** 
91
+	 * 商品信息-店铺名称
92
+	 **/
93
+	public $shop_title;
94
+	
95
+	/** 
96
+	 * 商品信息-商品短标题
97
+	 **/
98
+	public $short_title;
99
+	
100
+	/** 
101
+	 * 商品小图列表
102
+	 **/
103
+	public $small_images;
104
+	
105
+	/** 
106
+	 * 是否品牌精选,0不是,1是
107
+	 **/
108
+	public $superior_brand;
109
+	
110
+	/** 
111
+	 * H5宝贝详情(字段等级S)
112
+	 **/
113
+	public $taobao_desc_url;
114
+	
115
+	/** 
116
+	 * 商品标题
117
+	 **/
118
+	public $title;
119
+	
120
+	/** 
121
+	 * pc宝贝详情(字段等级S)
122
+	 **/
123
+	public $tmall_desc_url;
124
+	
125
+	/** 
126
+	 * 卖家类型,0表示集市,1表示商城,3表示特价版
127
+	 **/
128
+	public $user_type;
129
+	
130
+	/** 
131
+	 * 30天销量;数据统计截止昨日非实时更新
132
+	 **/
133
+	public $volume;
134
+	
135
+	/** 
136
+	 * 商品信息-商品白底图
137
+	 **/
138
+	public $white_image;	
139
+}
140
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/Data.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * data
5
+ * @author auto create
6
+ */
7
+class Data
8
+{
9
+	
10
+	/** 
11
+	 * data
12
+	 **/
13
+	public $data;	
14
+}
15
+?>

+ 25 - 0
extend/TaobaoSdk/top/domain/DataMap.php

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * x
5
+ * @author auto create
6
+ */
7
+class DataMap
8
+{
9
+	
10
+	/** 
11
+	 * 当入参不传pid的时候返回,表示账号关联的pid
12
+	 **/
13
+	public $pid;
14
+	
15
+	/** 
16
+	 * 当入参传入pid的时候返回,表示pid关联的relationId
17
+	 **/
18
+	public $rid;
19
+	
20
+	/** 
21
+	 * 0表示预警,1表示拦截,如果名单中同一个淘客同时有拦截和预警信息,以拦截为准
22
+	 **/
23
+	public $status;	
24
+}
25
+?>

+ 80 - 0
extend/TaobaoSdk/top/domain/Extra.php

@@ -0,0 +1,80 @@
1
+<?php
2
+
3
+/**
4
+ * extra
5
+ * @author auto create
6
+ */
7
+class Extra
8
+{
9
+	
10
+	/** 
11
+	 * 引导付款金额,同一个红包,若因消费者付款使用后取消订单或退货退款,产生二次红包使用行为,引导付款笔数也会记录两单
12
+	 **/
13
+	public $alipay_amt;
14
+	
15
+	/** 
16
+	 * 引导付款笔数,同一个红包,若因消费者付款使用后取消订单或退货退款,产生二次红包使用行为,引导付款笔数也会记录两单
17
+	 **/
18
+	public $alipay_num;
19
+	
20
+	/** 
21
+	 * 结算佣金,确认收货,产生二次红包使用行为,会记录2次
22
+	 **/
23
+	public $cm_settle_amt;
24
+	
25
+	/** 
26
+	 * 领取率,领取淘礼金个数/创建淘礼金个数
27
+	 **/
28
+	public $get_rate;
29
+	
30
+	/** 
31
+	 * 付款佣金,下单付款,产生二次红包使用行为,会记录2次
32
+	 **/
33
+	public $pre_pub_share_fee_for_disp;
34
+	
35
+	/** 
36
+	 * 退款淘礼金个数,红包使用后,由于订单取消,退货退款等行为带来的淘礼金红包退回数量,退款红包数量会重复计算
37
+	 **/
38
+	public $refund_num;
39
+	
40
+	/** 
41
+	 * 退款淘礼金金额,红包使用后,由于订单取消,退货退款等行为行为带来的淘礼金红包退回数量 (退款红包若产生多次使用,退款红包金额会被多次计算,退款红包数量单日内不重复计算,跨天重复计算)
42
+	 **/
43
+	public $refund_sum_amt;
44
+	
45
+	/** 
46
+	 * 未领取金额,过了领取有效期或者暂停后没有被领取的红包金额
47
+	 **/
48
+	public $remaining_amt;
49
+	
50
+	/** 
51
+	 * 未领取淘礼金个数,过了领取有效期或者暂停后没有被领取的红包个数
52
+	 **/
53
+	public $remaining_num;
54
+	
55
+	/** 
56
+	 * 使用淘礼金个数,同一个红包,若因消费者付款使用后取消订单或退货退款,产生二次红包使用行为,使用淘礼金个数会重复计算
57
+	 **/
58
+	public $use_num;
59
+	
60
+	/** 
61
+	 * 使用率,使用淘礼金个数/领取淘礼金个数
62
+	 **/
63
+	public $use_rate;
64
+	
65
+	/** 
66
+	 * 使用淘礼金金额,若红包被重复使用(1)淘礼金红包被拆分,并且产生部分退款,会保留部分退款的订单淘礼金金额;若全部退款,会保留订单全部淘礼金金额),因此,已使用金额可能大于消费者实际使用金额(使用红包后,若产生红包退回后再次使用,已使用金额会被二次计算,已使用数量不会)
67
+	 **/
68
+	public $use_sum_amt;
69
+	
70
+	/** 
71
+	 * 领取淘礼金个数
72
+	 **/
73
+	public $win_pv;
74
+	
75
+	/** 
76
+	 * 领取淘礼金金额
77
+	 **/
78
+	public $win_sum_amt;	
79
+}
80
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/FavoritesDetail.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 选品库收藏夹详细信息
5
+ * @author auto create
6
+ */
7
+class FavoritesDetail
8
+{
9
+	
10
+	/** 
11
+	 * 选品库收藏夹id
12
+	 **/
13
+	public $favorites_id;
14
+	
15
+	/** 
16
+	 * 选品库收藏夹标题
17
+	 **/
18
+	public $favorites_title;	
19
+}
20
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/FavoritesInfo.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 选品库信息
5
+ * @author auto create
6
+ */
7
+class FavoritesInfo
8
+{
9
+	
10
+	/** 
11
+	 * 选品库收藏夹详细信息
12
+	 **/
13
+	public $favorites_list;
14
+	
15
+	/** 
16
+	 * 选品库收藏夹总数量
17
+	 **/
18
+	public $total_count;	
19
+}
20
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/Feature.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 属性值feature
5
+ * @author auto create
6
+ */
7
+class Feature
8
+{
9
+	
10
+	/** 
11
+	 * 属性键
12
+	 **/
13
+	public $attr_key;
14
+	
15
+	/** 
16
+	 * 属性值
17
+	 **/
18
+	public $attr_value;	
19
+}
20
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/FinalIncomeInfo.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 商品佣金信息
5
+ * @author auto create
6
+ */
7
+class FinalIncomeInfo
8
+{
9
+	
10
+	/** 
11
+	 * 商品佣金金额
12
+	 **/
13
+	public $commission_amount;
14
+	
15
+	/** 
16
+	 * 商品佣金比率
17
+	 **/
18
+	public $commission_rate;
19
+	
20
+	/** 
21
+	 * 补贴金额
22
+	 **/
23
+	public $subsidy_amount;
24
+	
25
+	/** 
26
+	 * 补贴比率
27
+	 **/
28
+	public $subsidy_rate;
29
+	
30
+	/** 
31
+	 * 补贴类型
32
+	 **/
33
+	public $subsidy_type;
34
+	
35
+	/** 
36
+	 * 补贴上限;仅在单笔订单命中补贴上限时返回结果否则出参为空
37
+	 **/
38
+	public $subsidy_upper_limit;	
39
+}
40
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/FinalPromotionPathMapData.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 优惠促销列表
5
+ * @author auto create
6
+ */
7
+class FinalPromotionPathMapData
8
+{
9
+	
10
+	/** 
11
+	 * 优惠利益点文案,如“1件7.92折”、“每200减20”等
12
+	 **/
13
+	public $promotion_desc;
14
+	
15
+	/** 
16
+	 * 优惠结束时间
17
+	 **/
18
+	public $promotion_end_time;
19
+	
20
+	/** 
21
+	 * 优惠金额(元)
22
+	 **/
23
+	public $promotion_fee;
24
+	
25
+	/** 
26
+	 * 优惠ID
27
+	 **/
28
+	public $promotion_id;
29
+	
30
+	/** 
31
+	 * 优惠开始时间
32
+	 **/
33
+	public $promotion_start_time;
34
+	
35
+	/** 
36
+	 * 优惠名称,如“商品券”、“跨店满减”、“单品直降”等
37
+	 **/
38
+	public $promotion_title;	
39
+}
40
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/FutureActivityPromotionDTO.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * 暂不支持
5
+ * @author auto create
6
+ */
7
+class FutureActivityPromotionDTO
8
+{
9
+	
10
+	/** 
11
+	 * 预热优惠利益点文案,如“1件7.92折”、“每200减20”等
12
+	 **/
13
+	public $promotion_desc;
14
+	
15
+	/** 
16
+	 * 优惠结束时间
17
+	 **/
18
+	public $promotion_end_time;
19
+	
20
+	/** 
21
+	 * 预热实际优惠金额(元)
22
+	 **/
23
+	public $promotion_fee;
24
+	
25
+	/** 
26
+	 * 优惠开始时间
27
+	 **/
28
+	public $promotion_start_time;
29
+	
30
+	/** 
31
+	 * 优惠名称,如“商品券”、“跨店满减”、“单品直降”等
32
+	 **/
33
+	public $promotion_title;	
34
+}
35
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/FutureActivityPromotionPathMapData.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * 预热到手价优惠路径列表
5
+ * @author auto create
6
+ */
7
+class FutureActivityPromotionPathMapData
8
+{
9
+	
10
+	/** 
11
+	 * 预热优惠利益点文案,如“1件7.92折”、“每200减20”等
12
+	 **/
13
+	public $promotion_desc;
14
+	
15
+	/** 
16
+	 * 优惠结束时间
17
+	 **/
18
+	public $promotion_end_time;
19
+	
20
+	/** 
21
+	 * 预热实际优惠金额(元)
22
+	 **/
23
+	public $promotion_fee;
24
+	
25
+	/** 
26
+	 * 优惠开始时间
27
+	 **/
28
+	public $promotion_start_time;
29
+	
30
+	/** 
31
+	 * 预热优惠名称,如“商品券”、“跨店满减”、“单品直降”等
32
+	 **/
33
+	public $promotion_title;	
34
+}
35
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/GovSubsidyDTO.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 国家补贴
5
+ * @author auto create
6
+ */
7
+class GovSubsidyDTO
8
+{
9
+	
10
+	/** 
11
+	 * 国补信息
12
+	 **/
13
+	public $state_subsidy_info;
14
+	
15
+	/** 
16
+	 * 国家补贴
17
+	 **/
18
+	public $tag_name;	
19
+}
20
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/IncomeInfo.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 商品佣金信息
5
+ * @author auto create
6
+ */
7
+class IncomeInfo
8
+{
9
+	
10
+	/** 
11
+	 * 商品佣金金额
12
+	 **/
13
+	public $commission_amount;
14
+	
15
+	/** 
16
+	 * 商品佣金比率
17
+	 **/
18
+	public $commission_rate;
19
+	
20
+	/** 
21
+	 * 补贴金额
22
+	 **/
23
+	public $subsidy_amount;
24
+	
25
+	/** 
26
+	 * 补贴比率
27
+	 **/
28
+	public $subsidy_rate;
29
+	
30
+	/** 
31
+	 * 补贴类型
32
+	 **/
33
+	public $subsidy_type;
34
+	
35
+	/** 
36
+	 * 补贴上限;仅在单笔订单命中补贴上限时返回结果否则出参为空
37
+	 **/
38
+	public $subsidy_upper_limit;	
39
+}
40
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/InstanceDTO.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 结果
5
+ * @author auto create
6
+ */
7
+class InstanceDTO
8
+{
9
+	
10
+	/** 
11
+	 * extra
12
+	 **/
13
+	public $extra;	
14
+}
15
+?>

Разлика између датотеке није приказан због своје велике величине
+ 560 - 0
extend/TaobaoSdk/top/domain/Item.php


+ 30 - 0
extend/TaobaoSdk/top/domain/ItemImg.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * 商品图片结构
5
+ * @author auto create
6
+ */
7
+class ItemImg
8
+{
9
+	
10
+	/** 
11
+	 * 图片创建时间 时间格式:yyyy-MM-dd HH:mm:ss
12
+	 **/
13
+	public $created;
14
+	
15
+	/** 
16
+	 * 商品图片的id,和商品相对应(主图id默认为0)
17
+	 **/
18
+	public $id;
19
+	
20
+	/** 
21
+	 * 图片放在第几张(多图时可设置)
22
+	 **/
23
+	public $position;
24
+	
25
+	/** 
26
+	 * 图片链接地址
27
+	 **/
28
+	public $url;	
29
+}
30
+?>

+ 29 - 0
extend/TaobaoSdk/top/domain/KfcSearchResult.php

@@ -0,0 +1,29 @@
1
+<?php
2
+
3
+/**
4
+ * KFC 关键词过滤匹配结果
5
+ * @author auto create
6
+ */
7
+class KfcSearchResult
8
+{
9
+	
10
+	/** 
11
+	 * 过滤后的文本:
12
+当匹配到B等级的词时,文本中的关键词被替换为*号,content即为关键词替换后的文本;
13
+其他情况,content始终为null
14
+	 **/
15
+	public $content;
16
+	
17
+	/** 
18
+	 * 匹配到的关键词的等级,值为null,或为A、B、C、D。
19
+当匹配不到关键词时,值为null,否则值为A、B、C、D中的一个。
20
+A、B、C、D等级按严重程度从高至低排列。
21
+	 **/
22
+	public $level;
23
+	
24
+	/** 
25
+	 * 是否匹配到关键词,匹配到则为true.
26
+	 **/
27
+	public $matched;	
28
+}
29
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/Location.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 用户地址
5
+ * @author auto create
6
+ */
7
+class Location
8
+{
9
+	
10
+	/** 
11
+	 * 详细地址,最大256个字节(128个中文)
12
+	 **/
13
+	public $address;
14
+	
15
+	/** 
16
+	 * 所在城市(中文名称)
17
+	 **/
18
+	public $city;
19
+	
20
+	/** 
21
+	 * 国家名称
22
+	 **/
23
+	public $country;
24
+	
25
+	/** 
26
+	 * 区/县(只适用于物流API)
27
+	 **/
28
+	public $district;
29
+	
30
+	/** 
31
+	 * 所在省份(中文名称)
32
+	 **/
33
+	public $state;
34
+	
35
+	/** 
36
+	 * 邮政编码
37
+	 **/
38
+	public $zip;	
39
+}
40
+?>

+ 55 - 0
extend/TaobaoSdk/top/domain/MapData.php

@@ -0,0 +1,55 @@
1
+<?php
2
+
3
+/**
4
+ * resultList
5
+ * @author auto create
6
+ */
7
+class MapData
8
+{
9
+	
10
+	/** 
11
+	 * 选品库信息
12
+	 **/
13
+	public $favorites_info;
14
+	
15
+	/** 
16
+	 * 商品基础信息
17
+	 **/
18
+	public $item_basic_info;
19
+	
20
+	/** 
21
+	 * 商品信息-淘宝客新商品id;使用说明参考《淘宝客新商品ID升级》白皮书:https://www.yuque.com/taobaolianmengguanfangxiaoer/zmig94/tfyt0pahmlpzu2ud
22
+	 **/
23
+	public $item_id;
24
+	
25
+	/** 
26
+	 * 预售信息
27
+	 **/
28
+	public $presale_info;
29
+	
30
+	/** 
31
+	 * 价格促销信息
32
+	 **/
33
+	public $price_promotion_info;
34
+	
35
+	/** 
36
+	 * 淘客推广信息
37
+	 **/
38
+	public $publish_info;
39
+	
40
+	/** 
41
+	 * 商品库范围信息
42
+	 **/
43
+	public $scope_info;
44
+	
45
+	/** 
46
+	 * 天猫榜单信息
47
+	 **/
48
+	public $tmall_rank_info;
49
+	
50
+	/** 
51
+	 * 前N件佣金信息-前N件佣金生效或预热时透出以下字段
52
+	 **/
53
+	public $topn_info;	
54
+}
55
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/MaterialQuery.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * 请求结构
5
+ * @author auto create
6
+ */
7
+class MaterialQuery
8
+{
9
+	
10
+	/** 
11
+	 * 物料类型,1: 商品;2:权益
12
+	 **/
13
+	public $material_type;
14
+	
15
+	/** 
16
+	 * 页码,默认1,取值范围1~100
17
+	 **/
18
+	public $page_no;
19
+	
20
+	/** 
21
+	 * 每页物料id数量,默认20,取值范围1~100
22
+	 **/
23
+	public $page_size;
24
+	
25
+	/** 
26
+	 * 物料主题类型, 1促销活动;2热门主题;3精选榜单;4行业频道等;5其他
27
+	 **/
28
+	public $subject;	
29
+}
30
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/MediaIssueDTO.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 返回结果
5
+ * @author auto create
6
+ */
7
+class MediaIssueDTO
8
+{
9
+	
10
+	/** 
11
+	 * 当前媒体(不在任何媒体组时)或所在的媒体组是否可直塞
12
+	 **/
13
+	public $can_issue;	
14
+}
15
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/MgcInfo.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * 线报内容
5
+ * @author auto create
6
+ */
7
+class MgcInfo
8
+{
9
+	
10
+	/** 
11
+	 * 价格
12
+	 **/
13
+	public $price;
14
+	
15
+	/** 
16
+	 * 价格描述
17
+	 **/
18
+	public $price_desc;
19
+	
20
+	/** 
21
+	 * 文案
22
+	 **/
23
+	public $promotion_summary;
24
+	
25
+	/** 
26
+	 * 发布时间,13位毫秒时间戳
27
+	 **/
28
+	public $publish_time;
29
+	
30
+	/** 
31
+	 * 生效时间,实时线报为0,未来线报为13位毫秒时间戳
32
+	 **/
33
+	public $valid_time;	
34
+}
35
+?>

+ 45 - 0
extend/TaobaoSdk/top/domain/MorePromotionMapData.php

@@ -0,0 +1,45 @@
1
+<?php
2
+
3
+/**
4
+ * 更多活动优惠
5
+ * @author auto create
6
+ */
7
+class MorePromotionMapData
8
+{
9
+	
10
+	/** 
11
+	 * 预热优惠利益点文案,如“1件7.92折”、“每200减20”等
12
+	 **/
13
+	public $promotion_desc;
14
+	
15
+	/** 
16
+	 * 优惠结束时间
17
+	 **/
18
+	public $promotion_end_time;
19
+	
20
+	/** 
21
+	 * 优惠ID
22
+	 **/
23
+	public $promotion_id;
24
+	
25
+	/** 
26
+	 * 优惠开始时间
27
+	 **/
28
+	public $promotion_start_time;
29
+	
30
+	/** 
31
+	 * 预热优惠名称,如“商品券”、“跨店满减”、“单品直降”等
32
+	 **/
33
+	public $promotion_title;
34
+	
35
+	/** 
36
+	 * 当天优惠总库存【指定优惠透出,不对外开放】
37
+	 **/
38
+	public $promotion_total_count;
39
+	
40
+	/** 
41
+	 * 优惠使用路径【指定优惠透出,不对外开放】
42
+	 **/
43
+	public $promotion_url;	
44
+}
45
+?>

+ 220 - 0
extend/TaobaoSdk/top/domain/NTbkItem.php

@@ -0,0 +1,220 @@
1
+<?php
2
+
3
+/**
4
+ * 淘宝客商品
5
+ * @author auto create
6
+ */
7
+class NTbkItem
8
+{
9
+	
10
+	/** 
11
+	 * 叶子类目名称
12
+	 **/
13
+	public $cat_leaf_name;
14
+	
15
+	/** 
16
+	 * 一级类目名称
17
+	 **/
18
+	public $cat_name;
19
+	
20
+	/** 
21
+	 * 是否包邮
22
+	 **/
23
+	public $free_shipment;
24
+	
25
+	/** 
26
+	 * 好评率是否高于行业均值
27
+	 **/
28
+	public $h_good_rate;
29
+	
30
+	/** 
31
+	 * 成交转化是否高于行业均值
32
+	 **/
33
+	public $h_pay_rate30;
34
+	
35
+	/** 
36
+	 * 是否是热门商品,0不是,1是
37
+	 **/
38
+	public $hot_flag;
39
+	
40
+	/** 
41
+	 * 退款率是否低于行业均值
42
+	 **/
43
+	public $i_rfd_rate;
44
+	
45
+	/** 
46
+	 * 入参的(新)商品ID
47
+	 **/
48
+	public $input_num_iid;
49
+	
50
+	/** 
51
+	 * 是否加入消费者保障
52
+	 **/
53
+	public $is_prepay;
54
+	
55
+	/** 
56
+	 * 商品链接
57
+	 **/
58
+	public $item_url;
59
+	
60
+	/** 
61
+	 * 聚划算信息-聚淘结束时间(毫秒)
62
+	 **/
63
+	public $ju_online_end_time;
64
+	
65
+	/** 
66
+	 * 聚划算信息-聚淘开始时间(毫秒)
67
+	 **/
68
+	public $ju_online_start_time;
69
+	
70
+	/** 
71
+	 * 聚划算满减  -结束时间(毫秒)
72
+	 **/
73
+	public $ju_play_end_time;
74
+	
75
+	/** 
76
+	 * 聚划算满减  -开始时间(毫秒)
77
+	 **/
78
+	public $ju_play_start_time;
79
+	
80
+	/** 
81
+	 * 聚划算信息-商品预热结束时间(毫秒)
82
+	 **/
83
+	public $ju_pre_show_end_time;
84
+	
85
+	/** 
86
+	 * 聚划算信息-商品预热开始时间(毫秒)
87
+	 **/
88
+	public $ju_pre_show_start_time;
89
+	
90
+	/** 
91
+	 * 跨店满减信息
92
+	 **/
93
+	public $kuadian_promotion_info;
94
+	
95
+	/** 
96
+	 * 商品库类型,支持多库类型输出,以英文逗号分隔“,”分隔,1:营销商品主推库,如果值为空则不属于1这种商品类型
97
+	 **/
98
+	public $material_lib_type;
99
+	
100
+	/** 
101
+	 * 店铺名称
102
+	 **/
103
+	public $nick;
104
+	
105
+	/** 
106
+	 * 商品ID
107
+	 **/
108
+	public $num_iid;
109
+	
110
+	/** 
111
+	 * 商品主图
112
+	 **/
113
+	public $pict_url;
114
+	
115
+	/** 
116
+	 * 1聚划算满减:满N件减X元,满N件X折,满N件X元)  2天猫限时抢:前N分钟每件X元,前N分钟满N件每件X元,前N件每件X元)
117
+	 **/
118
+	public $play_info;
119
+	
120
+	/** 
121
+	 * 预售商品-定金(元)
122
+	 **/
123
+	public $presale_deposit;
124
+	
125
+	/** 
126
+	 * 预售商品-商品优惠信息
127
+	 **/
128
+	public $presale_discount_fee_text;
129
+	
130
+	/** 
131
+	 * 预售商品-付定金结束时间(毫秒)
132
+	 **/
133
+	public $presale_end_time;
134
+	
135
+	/** 
136
+	 * 预售商品-付定金开始时间(毫秒)
137
+	 **/
138
+	public $presale_start_time;
139
+	
140
+	/** 
141
+	 * 预售商品-付定金结束时间(毫秒)
142
+	 **/
143
+	public $presale_tail_end_time;
144
+	
145
+	/** 
146
+	 * 预售商品-付尾款开始时间(毫秒)
147
+	 **/
148
+	public $presale_tail_start_time;
149
+	
150
+	/** 
151
+	 * 商品所在地
152
+	 **/
153
+	public $provcity;
154
+	
155
+	/** 
156
+	 * 卖家等级
157
+	 **/
158
+	public $ratesum;
159
+	
160
+	/** 
161
+	 * 商品一口价格
162
+	 **/
163
+	public $reserve_price;
164
+	
165
+	/** 
166
+	 * 活动价
167
+	 **/
168
+	public $sale_price;
169
+	
170
+	/** 
171
+	 * 卖家id
172
+	 **/
173
+	public $seller_id;
174
+	
175
+	/** 
176
+	 * 店铺dsr 评分
177
+	 **/
178
+	public $shop_dsr;
179
+	
180
+	/** 
181
+	 * 商品小图列表
182
+	 **/
183
+	public $small_images;
184
+	
185
+	/** 
186
+	 * 是否品牌精选,0不是,1是
187
+	 **/
188
+	public $superior_brand;
189
+	
190
+	/** 
191
+	 * 商品标题
192
+	 **/
193
+	public $title;
194
+	
195
+	/** 
196
+	 * 天猫限时抢可售  -结束时间(毫秒)
197
+	 **/
198
+	public $tmall_play_activity_end_time;
199
+	
200
+	/** 
201
+	 * 天猫限时抢可售  -开始时间(毫秒)
202
+	 **/
203
+	public $tmall_play_activity_start_time;
204
+	
205
+	/** 
206
+	 * 卖家类型,0表示集市,1表示商城,3表示特价版
207
+	 **/
208
+	public $user_type;
209
+	
210
+	/** 
211
+	 * 30天销量
212
+	 **/
213
+	public $volume;
214
+	
215
+	/** 
216
+	 * 折扣价(元) 若属于预售商品,付定金时间内,折扣价=预售价
217
+	 **/
218
+	public $zk_final_price;	
219
+}
220
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/NTbkShop.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 淘宝客店铺
5
+ * @author auto create
6
+ */
7
+class NTbkShop
8
+{
9
+	
10
+	/** 
11
+	 * 店标图片
12
+	 **/
13
+	public $pict_url;
14
+	
15
+	/** 
16
+	 * 卖家昵称
17
+	 **/
18
+	public $seller_nick;
19
+	
20
+	/** 
21
+	 * 店铺名称
22
+	 **/
23
+	public $shop_title;
24
+	
25
+	/** 
26
+	 * 店铺类型,B:天猫,C:淘宝
27
+	 **/
28
+	public $shop_type;
29
+	
30
+	/** 
31
+	 * 店铺地址
32
+	 **/
33
+	public $shop_url;
34
+	
35
+	/** 
36
+	 * 卖家ID
37
+	 **/
38
+	public $user_id;	
39
+}
40
+?>

+ 170 - 0
extend/TaobaoSdk/top/domain/OpenAccount.php

@@ -0,0 +1,170 @@
1
+<?php
2
+
3
+/**
4
+ * Open Account模型
5
+ * @author auto create
6
+ */
7
+class OpenAccount
8
+{
9
+	
10
+	/** 
11
+	 * 支付宝的帐号标识
12
+	 **/
13
+	public $alipay_id;
14
+	
15
+	/** 
16
+	 * 头像url
17
+	 **/
18
+	public $avatar_url;
19
+	
20
+	/** 
21
+	 * 银行卡号
22
+	 **/
23
+	public $bank_card_no;
24
+	
25
+	/** 
26
+	 * 银行卡的拥有者姓名
27
+	 **/
28
+	public $bank_card_owner_name;
29
+	
30
+	/** 
31
+	 * 出生日期
32
+	 **/
33
+	public $birthday;
34
+	
35
+	/** 
36
+	 * 创建帐号的App Key
37
+	 **/
38
+	public $create_app_key;
39
+	
40
+	/** 
41
+	 * 帐号创建的设备的ID
42
+	 **/
43
+	public $create_device_id;
44
+	
45
+	/** 
46
+	 * 账号创建时的位置
47
+	 **/
48
+	public $create_location;
49
+	
50
+	/** 
51
+	 * 展示名
52
+	 **/
53
+	public $display_name;
54
+	
55
+	/** 
56
+	 * 数据域
57
+	 **/
58
+	public $domain_id;
59
+	
60
+	/** 
61
+	 * 邮箱
62
+	 **/
63
+	public $email;
64
+	
65
+	/** 
66
+	 * 自定义扩展信息Map的Json格式
67
+	 **/
68
+	public $ext_infos;
69
+	
70
+	/** 
71
+	 * 1男 2女
72
+	 **/
73
+	public $gender;
74
+	
75
+	/** 
76
+	 * 记录创建时间
77
+	 **/
78
+	public $gmt_create;
79
+	
80
+	/** 
81
+	 * 记录上次更新时间
82
+	 **/
83
+	public $gmt_modified;
84
+	
85
+	/** 
86
+	 * Open Account Id
87
+	 **/
88
+	public $id;
89
+	
90
+	/** 
91
+	 * 开发者自定义账号id
92
+	 **/
93
+	public $isv_account_id;
94
+	
95
+	/** 
96
+	 * 地区
97
+	 **/
98
+	public $locale;
99
+	
100
+	/** 
101
+	 * 登录名
102
+	 **/
103
+	public $login_id;
104
+	
105
+	/** 
106
+	 * 密码
107
+	 **/
108
+	public $login_pwd;
109
+	
110
+	/** 
111
+	 * 加密算法类型:1、代表单纯MD5,2:代表单一Salt的MD5,3、代表根据记录不同后的MD5
112
+	 **/
113
+	public $login_pwd_encryption;
114
+	
115
+	/** 
116
+	 * 密码加密强度
117
+	 **/
118
+	public $login_pwd_intensity;
119
+	
120
+	/** 
121
+	 * 密码salt
122
+	 **/
123
+	public $login_pwd_salt;
124
+	
125
+	/** 
126
+	 * 手机
127
+	 **/
128
+	public $mobile;
129
+	
130
+	/** 
131
+	 * 姓名
132
+	 **/
133
+	public $name;
134
+	
135
+	/** 
136
+	 * TAOBAO = 1;WEIXIN = 2;WEIBO = 3;QQ = 4;
137
+	 **/
138
+	public $oauth_plateform;
139
+	
140
+	/** 
141
+	 * 第三方oauth openid
142
+	 **/
143
+	public $open_id;
144
+	
145
+	/** 
146
+	 * 账号状态:1、启用,2、删除,3、禁用
147
+	 **/
148
+	public $status;
149
+	
150
+	/** 
151
+	 * 账号创建类型:1、通过短信创建,2、ISV批量导入,3、ISV OAuth创建
152
+	 **/
153
+	public $type;
154
+	
155
+	/** 
156
+	 * 记录的版本号
157
+	 **/
158
+	public $version;
159
+	
160
+	/** 
161
+	 * 旺旺
162
+	 **/
163
+	public $wangwang;
164
+	
165
+	/** 
166
+	 * 微信
167
+	 **/
168
+	public $weixin;	
169
+}
170
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/OpenAccountSearchResult.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * 搜索查询返回结果
5
+ * @author auto create
6
+ */
7
+class OpenAccountSearchResult
8
+{
9
+	
10
+	/** 
11
+	 * 状态码
12
+	 **/
13
+	public $code;
14
+	
15
+	/** 
16
+	 * OpenAccount的列表
17
+	 **/
18
+	public $datas;
19
+	
20
+	/** 
21
+	 * 状态信息
22
+	 **/
23
+	public $message;
24
+	
25
+	/** 
26
+	 * 查询是否成功,成功返回时有可能数据为空
27
+	 **/
28
+	public $successful;	
29
+}
30
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/OpenAccountTokenApplyResult.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * 返回的token结果
5
+ * @author auto create
6
+ */
7
+class OpenAccountTokenApplyResult
8
+{
9
+	
10
+	/** 
11
+	 * 错误码
12
+	 **/
13
+	public $code;
14
+	
15
+	/** 
16
+	 * token
17
+	 **/
18
+	public $data;
19
+	
20
+	/** 
21
+	 * 错误信息
22
+	 **/
23
+	public $message;
24
+	
25
+	/** 
26
+	 * 是否成功
27
+	 **/
28
+	public $successful;	
29
+}
30
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/OpenaccountLong.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * Open Account模型
5
+ * @author auto create
6
+ */
7
+class OpenaccountLong
8
+{
9
+	
10
+	/** 
11
+	 * 返回码
12
+	 **/
13
+	public $code;
14
+	
15
+	/** 
16
+	 * 返回数据
17
+	 **/
18
+	public $data;
19
+	
20
+	/** 
21
+	 * 返回信息
22
+	 **/
23
+	public $message;
24
+	
25
+	/** 
26
+	 * 是否成功
27
+	 **/
28
+	public $successful;	
29
+}
30
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/OpenaccountObject.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * Open Account模型
5
+ * @author auto create
6
+ */
7
+class OpenaccountObject
8
+{
9
+	
10
+	/** 
11
+	 * 错误码
12
+	 **/
13
+	public $code;
14
+	
15
+	/** 
16
+	 * 返回数据
17
+	 **/
18
+	public $data;
19
+	
20
+	/** 
21
+	 * 返回信息
22
+	 **/
23
+	public $message;
24
+	
25
+	/** 
26
+	 * 是否成功
27
+	 **/
28
+	public $successful;	
29
+}
30
+?>

+ 25 - 0
extend/TaobaoSdk/top/domain/OpenaccountVoid.php

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * Open Account模型
5
+ * @author auto create
6
+ */
7
+class OpenaccountVoid
8
+{
9
+	
10
+	/** 
11
+	 * 错误码
12
+	 **/
13
+	public $code;
14
+	
15
+	/** 
16
+	 * 返回信息
17
+	 **/
18
+	public $message;
19
+	
20
+	/** 
21
+	 * 是否成功
22
+	 **/
23
+	public $successful;	
24
+}
25
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/OrderData.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * 复购订单,仅适用于手淘拉新
5
+ * @author auto create
6
+ */
7
+class OrderData
8
+{
9
+	
10
+	/** 
11
+	 * 预估佣金
12
+	 **/
13
+	public $commission;
14
+	
15
+	/** 
16
+	 * 收货时间
17
+	 **/
18
+	public $confirm_receive_time;
19
+	
20
+	/** 
21
+	 * 订单号
22
+	 **/
23
+	public $order_no;
24
+	
25
+	/** 
26
+	 * 支付时间
27
+	 **/
28
+	public $pay_time;	
29
+}
30
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/PageResult.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 分页模型
5
+ * @author auto create
6
+ */
7
+class PageResult
8
+{
9
+	
10
+	/** 
11
+	 * 数据列表
12
+	 **/
13
+	public $results;	
14
+}
15
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/PredictRoundingUpPathMapData.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 预估凑单优惠路径
5
+ * @author auto create
6
+ */
7
+class PredictRoundingUpPathMapData
8
+{
9
+	
10
+	/** 
11
+	 * 优惠利益点文案,如“2件5折”、“每200减20”等
12
+	 **/
13
+	public $promotion_desc;
14
+	
15
+	/** 
16
+	 * 优惠名称,如“商品券”、“跨店满减”、“单品直降”等
17
+	 **/
18
+	public $promotion_title;	
19
+}
20
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/PresaleInfo.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 预售信息
5
+ * @author auto create
6
+ */
7
+class PresaleInfo
8
+{
9
+	
10
+	/** 
11
+	 * 预售商品-定金(元)
12
+	 **/
13
+	public $presale_deposit;
14
+	
15
+	/** 
16
+	 * 预售商品-优惠信息
17
+	 **/
18
+	public $presale_discount_fee_text;
19
+	
20
+	/** 
21
+	 * 预售商品-付定金结束时间(毫秒)
22
+	 **/
23
+	public $presale_end_time;
24
+	
25
+	/** 
26
+	 * 预售商品-付定金开始时间(毫秒)
27
+	 **/
28
+	public $presale_start_time;
29
+	
30
+	/** 
31
+	 * 预售商品-付尾款结束时间(毫秒)
32
+	 **/
33
+	public $presale_tail_end_time;
34
+	
35
+	/** 
36
+	 * 预售商品-付尾款开始时间(毫秒)
37
+	 **/
38
+	public $presale_tail_start_time;	
39
+}
40
+?>

+ 137 - 0
extend/TaobaoSdk/top/domain/Product.php

@@ -0,0 +1,137 @@
1
+<?php
2
+
3
+/**
4
+ * 产品结构
5
+ * @author auto create
6
+ */
7
+class Product
8
+{
9
+	
10
+	/** 
11
+	 * 产品的非关键属性列表.格式:pid:vid;pid:vid.
12
+	 **/
13
+	public $binds;
14
+	
15
+	/** 
16
+	 * 产品的非关键属性字符串列表.格式同props_str(<strong>注:</strong><font color="red">属性名称中的冒号":"被转换为:"#cln#";  
17
+分号";"被转换为:"#scln#"
18
+</font>)
19
+	 **/
20
+	public $binds_str;
21
+	
22
+	/** 
23
+	 * 商品类目名称
24
+	 **/
25
+	public $cat_name;
26
+	
27
+	/** 
28
+	 * 商品类目ID.必须是叶子类目ID
29
+	 **/
30
+	public $cid;
31
+	
32
+	/** 
33
+	 * 创建时间.格式:yyyy-mm-dd hh:mm:ss
34
+	 **/
35
+	public $created;
36
+	
37
+	/** 
38
+	 * 用户自定义属性,结构:pid1:value1;pid2:value2 例如:“20000:优衣库”,表示“品牌:优衣库”
39
+	 **/
40
+	public $customer_props;
41
+	
42
+	/** 
43
+	 * 产品的描述.最大25000个字节
44
+	 **/
45
+	public $desc;
46
+	
47
+	/** 
48
+	 * 修改时间.格式:yyyy-mm-dd hh:mm:ss
49
+	 **/
50
+	public $modified;
51
+	
52
+	/** 
53
+	 * 产品名称
54
+	 **/
55
+	public $name;
56
+	
57
+	/** 
58
+	 * 外部产品ID
59
+	 **/
60
+	public $outer_id;
61
+	
62
+	/** 
63
+	 * 产品的主图片地址.(绝对地址,格式:http://host/image_path)
64
+	 **/
65
+	public $pic_url;
66
+	
67
+	/** 
68
+	 * 产品的市场价.单位为元.精确到2位小数;如:200.07
69
+	 **/
70
+	public $price;
71
+	
72
+	/** 
73
+	 * 产品ID
74
+	 **/
75
+	public $product_id;
76
+	
77
+	/** 
78
+	 * 产品的子图片.目前最多支持4张。fields中设置为product_imgs.id、product_imgs.url、product_imgs.position 等形式就会返回相应的字段
79
+	 **/
80
+	public $product_imgs;
81
+	
82
+	/** 
83
+	 * 产品的属性图片.比如说黄色对应的产品图片,绿色对应的产品图片。fields中设置为product_prop_imgs.id、 
84
+product_prop_imgs.props、product_prop_imgs.url、product_prop_imgs.position等形式就会返回相应的字段
85
+	 **/
86
+	public $product_prop_imgs;
87
+	
88
+	/** 
89
+	 * 销售属性值别名。格式为pid1:vid1:alias1;pid1:vid2:alia2。
90
+	 **/
91
+	public $property_alias;
92
+	
93
+	/** 
94
+	 * 产品的关键属性列表.格式:pid:vid;pid:vid
95
+	 **/
96
+	public $props;
97
+	
98
+	/** 
99
+	 * 产品的关键属性字符串列表.比如:品牌:诺基亚;型号:N73(<strong>注:</strong><font color="red">属性名称中的冒号":"被转换为:"#cln#";  
100
+分号";"被转换为:"#scln#"
101
+</font>)
102
+	 **/
103
+	public $props_str;
104
+	
105
+	/** 
106
+	 * 产品的销售属性列表.格式:pid:vid;pid:vid
107
+	 **/
108
+	public $sale_props;
109
+	
110
+	/** 
111
+	 * 产品的销售属性字符串列表.格式同props_str(<strong>注:</strong><font color="red">属性名称中的冒号":"被转换为:"#cln#";  
112
+分号";"被转换为:"#scln#"
113
+</font>)
114
+	 **/
115
+	public $sale_props_str;
116
+	
117
+	/** 
118
+	 * 产品卖点描述,长度限制20个汉字
119
+	 **/
120
+	public $sell_pt;
121
+	
122
+	/** 
123
+	 * 当前状态(0 商家确认 1 屏蔽 3 小二确认 2 未确认 -1 删除)
124
+	 **/
125
+	public $status;
126
+	
127
+	/** 
128
+	 * 淘宝标准产品编码
129
+	 **/
130
+	public $tsc;
131
+	
132
+	/** 
133
+	 * 垂直市场,如:3(3C),4(鞋城)
134
+	 **/
135
+	public $vertical_market;	
136
+}
137
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/ProductImg.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 返回产品图片结构中的:url,id,created,modified
5
+ * @author auto create
6
+ */
7
+class ProductImg
8
+{
9
+	
10
+	/** 
11
+	 * 添加时间.格式:yyyy-mm-dd hh:mm:ss
12
+	 **/
13
+	public $created;
14
+	
15
+	/** 
16
+	 * 产品图片ID
17
+	 **/
18
+	public $id;
19
+	
20
+	/** 
21
+	 * 修改时间.格式:yyyy-mm-dd hh:mm:ss
22
+	 **/
23
+	public $modified;
24
+	
25
+	/** 
26
+	 * 图片序号。产品里的图片展示顺序,数据越小越靠前。要求是正整数。
27
+	 **/
28
+	public $position;
29
+	
30
+	/** 
31
+	 * 图片所属产品的ID
32
+	 **/
33
+	public $product_id;
34
+	
35
+	/** 
36
+	 * 图片地址.(绝对地址,格式:http://host/image_path)
37
+	 **/
38
+	public $url;	
39
+}
40
+?>

+ 45 - 0
extend/TaobaoSdk/top/domain/ProductPropImg.php

@@ -0,0 +1,45 @@
1
+<?php
2
+
3
+/**
4
+ * 支持返回产品属性图片中的:url,id,created,modified
5
+ * @author auto create
6
+ */
7
+class ProductPropImg
8
+{
9
+	
10
+	/** 
11
+	 * 添加时间.格式:yyyy-mm-dd hh:mm:ss
12
+	 **/
13
+	public $created;
14
+	
15
+	/** 
16
+	 * 产品属性图片ID
17
+	 **/
18
+	public $id;
19
+	
20
+	/** 
21
+	 * 修改时间.格式:yyyy-mm-dd hh:mm:ss
22
+	 **/
23
+	public $modified;
24
+	
25
+	/** 
26
+	 * 图片序号。产品里的图片展示顺序,数据越小越靠前。要求是正整数。
27
+	 **/
28
+	public $position;
29
+	
30
+	/** 
31
+	 * 图片所属产品的ID
32
+	 **/
33
+	public $product_id;
34
+	
35
+	/** 
36
+	 * 属性串(pid:vid),目前只有颜色属性.如:颜色:红色表示为 1627207:28326
37
+	 **/
38
+	public $props;
39
+	
40
+	/** 
41
+	 * 图片地址.(绝对地址,格式:http://host/image_path)
42
+	 **/
43
+	public $url;	
44
+}
45
+?>

+ 25 - 0
extend/TaobaoSdk/top/domain/PromotionExtend.php

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * 权益扩展信息
5
+ * @author auto create
6
+ */
7
+class PromotionExtend
8
+{
9
+	
10
+	/** 
11
+	 * 权益链接
12
+	 **/
13
+	public $promotion_url;
14
+	
15
+	/** 
16
+	 * 权益推荐商品
17
+	 **/
18
+	public $recommend_item_list;
19
+	
20
+	/** 
21
+	 * 有价券信息
22
+	 **/
23
+	public $youjia_coupon_info;	
24
+}
25
+?>

+ 70 - 0
extend/TaobaoSdk/top/domain/PromotionInfoMapData.php

@@ -0,0 +1,70 @@
1
+<?php
2
+
3
+/**
4
+ * 价格促销信息
5
+ * @author auto create
6
+ */
7
+class PromotionInfoMapData
8
+{
9
+	
10
+	/** 
11
+	 * 货品展示标识列表
12
+	 **/
13
+	public $activity_tag_list;
14
+	
15
+	/** 
16
+	 * 优惠促销列表
17
+	 **/
18
+	public $final_promotion_path_list;
19
+	
20
+	/** 
21
+	 * 促销信息-预估到手价(元)。若属于预售商品,付定金时间内,预估到手价=预售尾款预估到手价
22
+	 **/
23
+	public $final_promotion_price;
24
+	
25
+	/** 
26
+	 * 暂不支持
27
+	 **/
28
+	public $future_activity_promotion_path_list;
29
+	
30
+	/** 
31
+	 * 暂不支持
32
+	 **/
33
+	public $future_activity_promotion_price;
34
+	
35
+	/** 
36
+	 * 国家补贴
37
+	 **/
38
+	public $gov_subsidy;
39
+	
40
+	/** 
41
+	 * 更多活动优惠
42
+	 **/
43
+	public $more_promotion_list;
44
+	
45
+	/** 
46
+	 * 促销信息-预估凑单价(元)。预估凑单叠加优惠后的商品单价
47
+	 **/
48
+	public $predict_rounding_up_price;
49
+	
50
+	/** 
51
+	 * 促销信息-凑单价说明,描述凑单价的实现说明。如 “可凑单”或“需买X件”
52
+	 **/
53
+	public $predict_rounding_up_price_desc;
54
+	
55
+	/** 
56
+	 * 标签信息列表
57
+	 **/
58
+	public $promotion_tag_list;
59
+	
60
+	/** 
61
+	 * 商品一口价格
62
+	 **/
63
+	public $reserve_price;
64
+	
65
+	/** 
66
+	 * 折扣价(元) 若属于预售商品,付定金时间内,折扣价=预售价
67
+	 **/
68
+	public $zk_final_price;	
69
+}
70
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/PromotionList.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * 权益信息
5
+ * @author auto create
6
+ */
7
+class PromotionList
8
+{
9
+	
10
+	/** 
11
+	 * 权益起用门槛,满X元可用,券场景为满元,精确到分,如满100元可用
12
+	 **/
13
+	public $entry_condition;
14
+	
15
+	/** 
16
+	 * 权益面额,券场景为减钱,精确到分
17
+	 **/
18
+	public $entry_discount;
19
+	
20
+	/** 
21
+	 * 权益结束时间,精确到毫秒时间戳
22
+	 **/
23
+	public $entry_used_end_time;
24
+	
25
+	/** 
26
+	 * 权益开始时间,精确到毫秒时间戳
27
+	 **/
28
+	public $entry_used_start_time;	
29
+}
30
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/PromotionTagMapData.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 标签信息列表
5
+ * @author auto create
6
+ */
7
+class PromotionTagMapData
8
+{
9
+	
10
+	/** 
11
+	 * 标签名称,如“88VIP”、“花呗免息”、“猫超买返”、“是否包邮”
12
+	 **/
13
+	public $tag_name;	
14
+}
15
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/PropImg.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * 商品属性图片结构
5
+ * @author auto create
6
+ */
7
+class PropImg
8
+{
9
+	
10
+	/** 
11
+	 * 图片创建时间 时间格式:yyyy-MM-dd HH:mm:ss
12
+	 **/
13
+	public $created;
14
+	
15
+	/** 
16
+	 * 属性图片的id,和商品相对应
17
+	 **/
18
+	public $id;
19
+	
20
+	/** 
21
+	 * 图片放在第几张(多图时可设置)
22
+	 **/
23
+	public $position;
24
+	
25
+	/** 
26
+	 * 图片所对应的属性组合的字符串
27
+	 **/
28
+	public $properties;
29
+	
30
+	/** 
31
+	 * 图片链接地址
32
+	 **/
33
+	public $url;	
34
+}
35
+?>

+ 60 - 0
extend/TaobaoSdk/top/domain/PropValue.php

@@ -0,0 +1,60 @@
1
+<?php
2
+
3
+/**
4
+ * 属性值
5
+ * @author auto create
6
+ */
7
+class PropValue
8
+{
9
+	
10
+	/** 
11
+	 * 类目ID
12
+	 **/
13
+	public $cid;
14
+	
15
+	/** 
16
+	 * 属性值feature
17
+	 **/
18
+	public $features;
19
+	
20
+	/** 
21
+	 * 是否为父类目属性
22
+	 **/
23
+	public $is_parent;
24
+	
25
+	/** 
26
+	 * 属性值
27
+	 **/
28
+	public $name;
29
+	
30
+	/** 
31
+	 * 属性值别名
32
+	 **/
33
+	public $name_alias;
34
+	
35
+	/** 
36
+	 * 属性 ID
37
+	 **/
38
+	public $pid;
39
+	
40
+	/** 
41
+	 * 属性名
42
+	 **/
43
+	public $prop_name;
44
+	
45
+	/** 
46
+	 * 排列序号。取值范围:大于零的整数
47
+	 **/
48
+	public $sort_order;
49
+	
50
+	/** 
51
+	 * 状态。可选值:normal(正常),deleted(删除)
52
+	 **/
53
+	public $status;
54
+	
55
+	/** 
56
+	 * 属性值ID
57
+	 **/
58
+	public $vid;	
59
+}
60
+?>

+ 60 - 0
extend/TaobaoSdk/top/domain/PublishInfo.php

@@ -0,0 +1,60 @@
1
+<?php
2
+
3
+/**
4
+ * 淘客推广信息
5
+ * @author auto create
6
+ */
7
+class PublishInfo
8
+{
9
+	
10
+	/** 
11
+	 * 额外奖励活动金额,活动奖励金额的类型与cpa_reward_type字段对应,如果一个商品有多个奖励类型,返回结果使用空格分割
12
+	 **/
13
+	public $cpa_reward_amount;
14
+	
15
+	/** 
16
+	 * 额外奖励活动类型,如果一个商品有多个奖励类型,返回结果使用空格分割,0=预售单单奖励,1=618超级U选单单补
17
+	 **/
18
+	public $cpa_reward_type;
19
+	
20
+	/** 
21
+	 * 当天推广销量。 非实时,约1小时更新
22
+	 **/
23
+	public $daily_promotion_sales;
24
+	
25
+	/** 
26
+	 * 暂不支持
27
+	 **/
28
+	public $future_activity_commission_rate;
29
+	
30
+	/** 
31
+	 * 暂不支持
32
+	 **/
33
+	public $future_activity_time;
34
+	
35
+	/** 
36
+	 * 商品佣金信息
37
+	 **/
38
+	public $income_info;
39
+	
40
+	/** 
41
+	 * 商品信息-收入比率(商品佣金比率+补贴比率)。15.5表示15.5%
42
+	 **/
43
+	public $income_rate;
44
+	
45
+	/** 
46
+	 * 单品淘礼金今日剩余可创建个数
47
+	 **/
48
+	public $tlj_remain_num;
49
+	
50
+	/** 
51
+	 * 前N件佣金信息-前N件佣金生效或预热时透出以下字段
52
+	 **/
53
+	public $topn_info;
54
+	
55
+	/** 
56
+	 * 两小时推广销量。 非实时,约半小时更新
57
+	 **/
58
+	public $two_hour_promotion_sales;	
59
+}
60
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/RecommendItemList.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 权益推荐商品
5
+ * @author auto create
6
+ */
7
+class RecommendItemList
8
+{
9
+	
10
+	/** 
11
+	 * 权益推荐商品id
12
+	 **/
13
+	public $item_id;
14
+	
15
+	/** 
16
+	 * 商品链接
17
+	 **/
18
+	public $url;	
19
+}
20
+?>

+ 50 - 0
extend/TaobaoSdk/top/domain/RegisterInfoDto.php

@@ -0,0 +1,50 @@
1
+<?php
2
+
3
+/**
4
+ * 线下备案专属信息
5
+ * @author auto create
6
+ */
7
+class RegisterInfoDto
8
+{
9
+	
10
+	/** 
11
+	 * 渠道独有 -经营类型
12
+	 **/
13
+	public $career;
14
+	
15
+	/** 
16
+	 * 渠道独有 - 编号
17
+	 **/
18
+	public $certify_number;
19
+	
20
+	/** 
21
+	 * 渠道独有 -信息
22
+	 **/
23
+	public $detail_address;
24
+	
25
+	/** 
26
+	 * 渠道独有 -区
27
+	 **/
28
+	public $location;
29
+	
30
+	/** 
31
+	 * 渠道独有 - 信息
32
+	 **/
33
+	public $phone_number;
34
+	
35
+	/** 
36
+	 * 渠道独有 -类型
37
+	 **/
38
+	public $shop_certify_type;
39
+	
40
+	/** 
41
+	 * 渠道独有 -店铺名称
42
+	 **/
43
+	public $shop_name;
44
+	
45
+	/** 
46
+	 * 渠道独有 -店铺类型
47
+	 **/
48
+	public $shop_type;	
49
+}
50
+?>

+ 45 - 0
extend/TaobaoSdk/top/domain/Result.php

@@ -0,0 +1,45 @@
1
+<?php
2
+
3
+/**
4
+ * 接口返回model
5
+ * @author auto create
6
+ */
7
+class Result
8
+{
9
+	
10
+	/** 
11
+	 * 错误代码
12
+	 **/
13
+	public $biz_error_code;
14
+	
15
+	/** 
16
+	 * 错误描述
17
+	 **/
18
+	public $biz_error_desc;
19
+	
20
+	/** 
21
+	 * 错误代码
22
+	 **/
23
+	public $biz_error_feature;
24
+	
25
+	/** 
26
+	 * 返回素材id
27
+	 **/
28
+	public $data;
29
+	
30
+	/** 
31
+	 * 结果码
32
+	 **/
33
+	public $result_code;
34
+	
35
+	/** 
36
+	 * 结果信息
37
+	 **/
38
+	public $result_msg;
39
+	
40
+	/** 
41
+	 * 是否成功
42
+	 **/
43
+	public $success;	
44
+}
45
+?>

+ 25 - 0
extend/TaobaoSdk/top/domain/Results.php

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * 数据结果
5
+ * @author auto create
6
+ */
7
+class Results
8
+{
9
+	
10
+	/** 
11
+	 * 明细类型,1:预估明细,2:结算明细
12
+	 **/
13
+	public $calc_type;
14
+	
15
+	/** 
16
+	 * 奖励明细数据,KV结构。字段释义见文档:https://www.yuque.com/docs/share/7ecf8cf1-7f99-4633-a2ed-f9b6f8116af5?#
17
+	 **/
18
+	public $field_detail;
19
+	
20
+	/** 
21
+	 * 明细记录主键id
22
+	 **/
23
+	public $id;	
24
+}
25
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/RightsInstanceCreateResult.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * model
5
+ * @author auto create
6
+ */
7
+class RightsInstanceCreateResult
8
+{
9
+	
10
+	/** 
11
+	 * 创建完成后资金账户可用资金,单位元,保留2位小数
12
+	 **/
13
+	public $available_fee;
14
+	
15
+	/** 
16
+	 * 媒体针对此商品今日剩余可领取淘礼金数量
17
+	 **/
18
+	public $item_today_num_left;
19
+	
20
+	/** 
21
+	 * 淘礼金Id
22
+	 **/
23
+	public $rights_id;
24
+	
25
+	/** 
26
+	 * 淘礼金领取Url
27
+	 **/
28
+	public $send_url;
29
+	
30
+	/** 
31
+	 * 投放code【百川商品详情页业务专用】
32
+	 **/
33
+	public $vegas_code;	
34
+}
35
+?>

+ 30 - 0
extend/TaobaoSdk/top/domain/RightsSendRelationRptDto.php

@@ -0,0 +1,30 @@
1
+<?php
2
+
3
+/**
4
+ * pid的发放数据
5
+ * @author auto create
6
+ */
7
+class RightsSendRelationRptDto
8
+{
9
+	
10
+	/** 
11
+	 * 日期
12
+	 **/
13
+	public $biz_date;
14
+	
15
+	/** 
16
+	 * 红包发放数量
17
+	 **/
18
+	public $fund_num;
19
+	
20
+	/** 
21
+	 * pid
22
+	 **/
23
+	public $pid;
24
+	
25
+	/** 
26
+	 * 红包使用次数
27
+	 **/
28
+	public $use_num;	
29
+}
30
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/RightsSendRptDTO.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * model
5
+ * @author auto create
6
+ */
7
+class RightsSendRptDTO
8
+{
9
+	
10
+	/** 
11
+	 * pid的发放数据
12
+	 **/
13
+	public $pid_rpt_list;
14
+	
15
+	/** 
16
+	 * 渠道关系id的发放数据
17
+	 **/
18
+	public $relation_rpt_list;	
19
+}
20
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/RpcResult.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 返回模型
5
+ * @author auto create
6
+ */
7
+class RpcResult
8
+{
9
+	
10
+	/** 
11
+	 * 分页模型
12
+	 **/
13
+	public $data;	
14
+}
15
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/ScopeInfo.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 商品库范围信息
5
+ * @author auto create
6
+ */
7
+class ScopeInfo
8
+{
9
+	
10
+	/** 
11
+	 * 是否品牌精选,0不是,1是
12
+	 **/
13
+	public $superior_brand;	
14
+}
15
+?>

+ 120 - 0
extend/TaobaoSdk/top/domain/Sku.php

@@ -0,0 +1,120 @@
1
+<?php
2
+
3
+/**
4
+ * Sku列表
5
+ * @author auto create
6
+ */
7
+class Sku
8
+{
9
+	
10
+	/** 
11
+	 * 商品级别的条形码
12
+	 **/
13
+	public $barcode;
14
+	
15
+	/** 
16
+	 * 基础色数据
17
+	 **/
18
+	public $change_prop;
19
+	
20
+	/** 
21
+	 * sku创建日期 时间格式:yyyy-MM-dd HH:mm:ss
22
+	 **/
23
+	public $created;
24
+	
25
+	/** 
26
+	 * skuDeliveryTimeType
27
+	 **/
28
+	public $delivery_time_type;
29
+	
30
+	/** 
31
+	 * 扩展sku的id
32
+	 **/
33
+	public $extra_id;
34
+	
35
+	/** 
36
+	 * 
37
+	 **/
38
+	public $gmt_modified;
39
+	
40
+	/** 
41
+	 * sku所属商品id(注意:iid近期即将废弃,请用num_iid参数)
42
+	 **/
43
+	public $iid;
44
+	
45
+	/** 
46
+	 * 扩展sku的备注信息
47
+	 **/
48
+	public $memo;
49
+	
50
+	/** 
51
+	 * sku最后修改日期 时间格式:yyyy-MM-dd HH:mm:ss
52
+	 **/
53
+	public $modified;
54
+	
55
+	/** 
56
+	 * sku所属商品数字id
57
+	 **/
58
+	public $num_iid;
59
+	
60
+	/** 
61
+	 * 商家设置的外部id。天猫和集市的卖家,需要登录才能获取到自己的商家编码,不能获取到他人的商家编码。
62
+	 **/
63
+	public $outer_id;
64
+	
65
+	/** 
66
+	 * 属于这个sku的商品的价格 取值范围:0-100000000;精确到2位小数;单位:元。如:200.07,表示:200元7分。
67
+	 **/
68
+	public $price;
69
+	
70
+	/** 
71
+	 * sku的销售属性组合字符串(颜色,大小,等等,可通过类目API获取某类目下的销售属性),格式是p1:v1;p2:v2
72
+	 **/
73
+	public $properties;
74
+	
75
+	/** 
76
+	 * sku所对应的销售属性的中文名字串,格式如:pid1:vid1:pid_name1:vid_name1;pid2:vid2:pid_name2:vid_name2……
77
+	 **/
78
+	public $properties_name;
79
+	
80
+	/** 
81
+	 * 属于这个sku的商品的数量,
82
+	 **/
83
+	public $quantity;
84
+	
85
+	/** 
86
+	 * sku级别发货时间
87
+	 **/
88
+	public $sku_delivery_time;
89
+	
90
+	/** 
91
+	 * skuFeature
92
+	 **/
93
+	public $sku_feature;
94
+	
95
+	/** 
96
+	 * sku的id
97
+	 **/
98
+	public $sku_id;
99
+	
100
+	/** 
101
+	 * 表示SKu上的产品规格信息
102
+	 **/
103
+	public $sku_spec_id;
104
+	
105
+	/** 
106
+	 * specId
107
+	 **/
108
+	public $spec_id;
109
+	
110
+	/** 
111
+	 * sku状态。 normal:正常 ;delete:删除
112
+	 **/
113
+	public $status;
114
+	
115
+	/** 
116
+	 * 商品在付款减库存的状态下,该sku上未付款的订单数量
117
+	 **/
118
+	public $with_hold_quantity;	
119
+}
120
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/SpCampaign.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 定向计划集合-仅支持联系商务或运营小二申请定向计划合集字段权限
5
+ * @author auto create
6
+ */
7
+class SpCampaign
8
+{
9
+	
10
+	/** 
11
+	 * 定向计划申请链接
12
+	 **/
13
+	public $sp_apply_link;
14
+	
15
+	/** 
16
+	 * 定向计划活动ID
17
+	 **/
18
+	public $sp_cid;
19
+	
20
+	/** 
21
+	 * 定向是否锁佣,0=不锁佣 1=锁佣
22
+	 **/
23
+	public $sp_lock_status;
24
+	
25
+	/** 
26
+	 * 定向计划名称
27
+	 **/
28
+	public $sp_name;
29
+	
30
+	/** 
31
+	 * 定向佣金率
32
+	 **/
33
+	public $sp_rate;
34
+	
35
+	/** 
36
+	 * 定向计划是否可用 1-可用 0-不可用
37
+	 **/
38
+	public $sp_status;	
39
+}
40
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/StateSubsidyInfo.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * 国补信息
5
+ * @author auto create
6
+ */
7
+class StateSubsidyInfo
8
+{
9
+	
10
+	/** 
11
+	 * 最高优惠金额(元,如15代表15 元),入参具体IP时,仅展示该IP最高优惠金额
12
+	 **/
13
+	public $max_discount;
14
+	
15
+	/** 
16
+	 * 最高优惠比例(%),入参具体IP时,仅展示该IP最高优惠比例。
17
+	 **/
18
+	public $max_rebate;
19
+	
20
+	/** 
21
+	 * 最低优惠金额(元,如15代表15 元),入参具体IP时,仅展示该IP最低优惠金额
22
+	 **/
23
+	public $min_discount;
24
+	
25
+	/** 
26
+	 * 最低优惠比例(%),入参具体IP时,仅展示该IP最低优惠比例。
27
+	 **/
28
+	public $min_rebate;
29
+	
30
+	/** 
31
+	 * 国补生效区域(省份)。不入参IP时展示各可用省份;入参IP时,全国可用商品展示各可用省份,区域可用商品仅展示IP对应省份。
32
+	 **/
33
+	public $province_list;	
34
+}
35
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/TbkItemDetail.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 仅淘宝客商品,字段值根据API赋权等级输出
5
+ * @author auto create
6
+ */
7
+class TbkItemDetail
8
+{
9
+	
10
+	/** 
11
+	 * 输入的(新)商品ID
12
+	 **/
13
+	public $input_item_iid;
14
+	
15
+	/** 
16
+	 * 商品基本信息
17
+	 **/
18
+	public $item_basic_info;
19
+	
20
+	/** 
21
+	 * 商品ID
22
+	 **/
23
+	public $item_id;
24
+	
25
+	/** 
26
+	 * 预售信息
27
+	 **/
28
+	public $presale_info;
29
+	
30
+	/** 
31
+	 * 价格促销信息
32
+	 **/
33
+	public $price_promotion_info;
34
+	
35
+	/** 
36
+	 * 淘客推广信息
37
+	 **/
38
+	public $publish_info;	
39
+}
40
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/TbkSpread.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 传播形式对象列表
5
+ * @author auto create
6
+ */
7
+class TbkSpread
8
+{
9
+	
10
+	/** 
11
+	 * 传播形式, 目前只支持短链接
12
+	 **/
13
+	public $content;
14
+	
15
+	/** 
16
+	 * 调用错误信息;由于是批量接口,请重点关注每条请求返回的结果,如果非OK,则说明该结果对应的content不正常,请酌情处理;
17
+	 **/
18
+	public $err_msg;	
19
+}
20
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/TbkSpreadRequest.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * 请求列表,内部包含多个url
5
+ * @author auto create
6
+ */
7
+class TbkSpreadRequest
8
+{
9
+	
10
+	/** 
11
+	 * 原始url, 只支持uland.taobao.com,s.click.taobao.com, ai.taobao.com,temai.taobao.com的域名转换,否则判错
12
+	 **/
13
+	public $url;	
14
+}
15
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/TmallRankInfo.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 天猫榜单信息
5
+ * @author auto create
6
+ */
7
+class TmallRankInfo
8
+{
9
+	
10
+	/** 
11
+	 * 榜单排行描述
12
+	 **/
13
+	public $tmall_rank_text;
14
+	
15
+	/** 
16
+	 * 榜单url
17
+	 **/
18
+	public $tmall_rank_url;	
19
+}
20
+?>

+ 25 - 0
extend/TaobaoSdk/top/domain/TopDownloadRecordDo.php

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * results
5
+ * @author auto create
6
+ */
7
+class TopDownloadRecordDo
8
+{
9
+	
10
+	/** 
11
+	 * 文件创建时间
12
+	 **/
13
+	public $created;
14
+	
15
+	/** 
16
+	 * 下载链接状态。1:未下载。2:已下载
17
+	 **/
18
+	public $status;
19
+	
20
+	/** 
21
+	 * 下载链接
22
+	 **/
23
+	public $url;	
24
+}
25
+?>

+ 35 - 0
extend/TaobaoSdk/top/domain/TopNInfoDTO.php

@@ -0,0 +1,35 @@
1
+<?php
2
+
3
+/**
4
+ * 前N件佣金信息-前N件佣金生效或预热时透出以下字段
5
+ * @author auto create
6
+ */
7
+class TopNInfoDTO
8
+{
9
+	
10
+	/** 
11
+	 * 前N件佣金结束时间
12
+	 **/
13
+	public $topn_end_time;
14
+	
15
+	/** 
16
+	 * 前N件剩余库存
17
+	 **/
18
+	public $topn_quantity;
19
+	
20
+	/** 
21
+	 * 前N件佣金率
22
+	 **/
23
+	public $topn_rate;
24
+	
25
+	/** 
26
+	 * 前N件佣金开始时间
27
+	 **/
28
+	public $topn_start_time;
29
+	
30
+	/** 
31
+	 * 前N件初始总库存
32
+	 **/
33
+	public $topn_total_count;	
34
+}
35
+?>

+ 40 - 0
extend/TaobaoSdk/top/domain/TouMaterials.php

@@ -0,0 +1,40 @@
1
+<?php
2
+
3
+/**
4
+ * 返回结果
5
+ * @author auto create
6
+ */
7
+class TouMaterials
8
+{
9
+	
10
+	/** 
11
+	 * 结束时间,Unix时间戳
12
+	 **/
13
+	public $end_time;
14
+	
15
+	/** 
16
+	 * 物料id
17
+	 **/
18
+	public $material_id;
19
+	
20
+	/** 
21
+	 * 物料集合名称
22
+	 **/
23
+	public $material_name;
24
+	
25
+	/** 
26
+	 * 物料类型,1: 商品;2:权益
27
+	 **/
28
+	public $material_type;
29
+	
30
+	/** 
31
+	 * 开始时间,Unix时间戳
32
+	 **/
33
+	public $start_time;
34
+	
35
+	/** 
36
+	 * 物料主题类型, 1促销活动;2热门主题;3精选榜单;4行业频道等;5其他
37
+	 **/
38
+	public $subject;	
39
+}
40
+?>

+ 25 - 0
extend/TaobaoSdk/top/domain/TradeConfirmFee.php

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * 获取到的交易确认收货费用
5
+ * @author auto create
6
+ */
7
+class TradeConfirmFee
8
+{
9
+	
10
+	/** 
11
+	 * 确认收货的金额(不包含邮费)。精确到2位小数;单位:元。如:200.07,表示:200元7分
12
+	 **/
13
+	public $confirm_fee;
14
+	
15
+	/** 
16
+	 * 需确认收货的邮费,当不是最后一笔收货或者没有邮费时是0.00。精确到2位小数;单位:元。如:200.07,表示:200元7分
17
+	 **/
18
+	public $confirm_post_fee;
19
+	
20
+	/** 
21
+	 * 是否是最后一笔订单(只对子订单有效,当其他子订单都是交易完成时,返回true,否则false)
22
+	 **/
23
+	public $is_last_order;	
24
+}
25
+?>

+ 25 - 0
extend/TaobaoSdk/top/domain/Ucrowdrankitems.php

@@ -0,0 +1,25 @@
1
+<?php
2
+
3
+/**
4
+ * 物料评估-商品列表
5
+ * @author auto create
6
+ */
7
+class Ucrowdrankitems
8
+{
9
+	
10
+	/** 
11
+	 * 物料评估-商品佣金率,如:1234表示12.34%,material_id=41377时选填
12
+	 **/
13
+	public $commirate;
14
+	
15
+	/** 
16
+	 * 物料评估-商品ID,material_id=41377时必填
17
+	 **/
18
+	public $item_id;
19
+	
20
+	/** 
21
+	 * 物料评估-商品价格,单位:元,material_id=41377时选填
22
+	 **/
23
+	public $price;	
24
+}
25
+?>

+ 15 - 0
extend/TaobaoSdk/top/domain/UpdateStatusResult.php

@@ -0,0 +1,15 @@
1
+<?php
2
+
3
+/**
4
+ * model
5
+ * @author auto create
6
+ */
7
+class UpdateStatusResult
8
+{
9
+	
10
+	/** 
11
+	 * 暂停成功
12
+	 **/
13
+	public $update_success;	
14
+}
15
+?>

+ 45 - 0
extend/TaobaoSdk/top/domain/VegasCpaReportDTO.php

@@ -0,0 +1,45 @@
1
+<?php
2
+
3
+/**
4
+ * 数据列表
5
+ * @author auto create
6
+ */
7
+class VegasCpaReportDTO
8
+{
9
+	
10
+	/** 
11
+	 * 统计日期(统计活动期内,截止 统计日期 的数据)
12
+	 **/
13
+	public $biz_date;
14
+	
15
+	/** 
16
+	 * 活动相关数据信息
17
+	 **/
18
+	public $ext_info;
19
+	
20
+	/** 
21
+	 * 媒体三段式id,当查询数据为pid维度时返回该字段
22
+	 **/
23
+	public $pid;
24
+	
25
+	/** 
26
+	 * 数据类型:1预估 2结算
27
+	 **/
28
+	public $query_type;
29
+	
30
+	/** 
31
+	 * rid,当查询数据为rid维度时返回该字段
32
+	 **/
33
+	public $relation_id;
34
+	
35
+	/** 
36
+	 * 奖励金额;按入参是预估/结算,区分获得金额为预估or可结算结果;
37
+	 **/
38
+	public $reward_amount;
39
+	
40
+	/** 
41
+	 * 符合奖励要求的累计用户数;按入参是预估/结算,区分用户数为预估or可结算结果;
42
+	 **/
43
+	public $union30d_lx_uv;	
44
+}
45
+?>

+ 45 - 0
extend/TaobaoSdk/top/domain/Video.php

@@ -0,0 +1,45 @@
1
+<?php
2
+
3
+/**
4
+ * 商品视频关联记录
5
+ * @author auto create
6
+ */
7
+class Video
8
+{
9
+	
10
+	/** 
11
+	 * 视频关联记录创建时间(格式:yyyy-MM-dd HH:mm:ss)
12
+	 **/
13
+	public $created;
14
+	
15
+	/** 
16
+	 * 视频关联记录的id,和商品相对应
17
+	 **/
18
+	public $id;
19
+	
20
+	/** 
21
+	 * 视频记录关联的商品的数字id(注意:iid近期即将废弃,请用num_iid参数)
22
+	 **/
23
+	public $iid;
24
+	
25
+	/** 
26
+	 * 视频关联记录修改时间(格式:yyyy-MM-dd HH:mm:ss)
27
+	 **/
28
+	public $modified;
29
+	
30
+	/** 
31
+	 * 视频记录所关联的商品的数字id
32
+	 **/
33
+	public $num_iid;
34
+	
35
+	/** 
36
+	 * video的url连接地址。淘秀里视频记录里面存储的url地址
37
+	 **/
38
+	public $url;
39
+	
40
+	/** 
41
+	 * video的id,对应于视频在淘秀的存储记录
42
+	 **/
43
+	public $video_id;	
44
+}
45
+?>

+ 20 - 0
extend/TaobaoSdk/top/domain/Youjiacouponinfo.php

@@ -0,0 +1,20 @@
1
+<?php
2
+
3
+/**
4
+ * 有价券信息
5
+ * @author auto create
6
+ */
7
+class Youjiacouponinfo
8
+{
9
+	
10
+	/** 
11
+	 * 有价券商品id
12
+	 **/
13
+	public $item_id;
14
+	
15
+	/** 
16
+	 * 商品链接
17
+	 **/
18
+	public $url;	
19
+}
20
+?>

+ 26 - 0
extend/TaobaoSdk/top/fileTest.php

@@ -0,0 +1,26 @@
1
+<?php
2
+    include "TopSdk.php";
3
+    date_default_timezone_set('Asia/Shanghai'); 
4
+
5
+    $c = new TopClient;
6
+    $c->appkey = '*********';
7
+    $c->secretKey = '*******************';
8
+    // $req = new TradeVoucherUploadRequest;
9
+    // $req->setFileName("example");
10
+    // $req->setFileData("@/Users/xt/Downloads/1.jpg");
11
+    // $req->setSellerNick("奥利奥官方旗舰店");
12
+    // $req->setBuyerNick("101NufynDYcbjf2cFQDd62j8M/mjtyz6RoxQ2OL1c0e/Bc=");
13
+    // var_dump($c->execute($req));
14
+
15
+    $req2 = new TradeVoucherUploadRequest;
16
+    $req2->setFileName("example");
17
+
18
+    $myPic = array(
19
+            'type' => 'application/octet-stream',
20
+            'content' => file_get_contents('/Users/xt/Downloads/1.jpg')
21
+            );
22
+    $req2->setFileData($myPic);
23
+    $req2->setSellerNick("奥利奥官方旗舰店");
24
+    $req2->setBuyerNick("101NufynDYcbjf2cFQDd62j8M/mjtyz6RoxQ2OL1c0e/Bc=");
25
+    var_dump($c->execute($req2));
26
+?>

+ 32 - 0
extend/TaobaoSdk/top/request/AppipGetRequest.php

@@ -0,0 +1,32 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.appip.get request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2022.09.19
7
+ */
8
+class AppipGetRequest
9
+{
10
+	
11
+	private $apiParas = array();
12
+	
13
+	public function getApiMethodName()
14
+	{
15
+		return "taobao.appip.get";
16
+	}
17
+	
18
+	public function getApiParas()
19
+	{
20
+		return $this->apiParas;
21
+	}
22
+	
23
+	public function check()
24
+	{
25
+		
26
+	}
27
+	
28
+	public function putOtherTextParam($key, $value) {
29
+		$this->apiParas[$key] = $value;
30
+		$this->$key = $value;
31
+	}
32
+}

+ 48 - 0
extend/TaobaoSdk/top/request/AreasGetRequest.php

@@ -0,0 +1,48 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.areas.get request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2022.05.25
7
+ */
8
+class AreasGetRequest
9
+{
10
+	/** 
11
+	 * 需返回的字段列表.可选值:Area 结构中的所有字段;多个字段之间用","分隔.如:id,type,name,parent_id,zip.
12
+	 **/
13
+	private $fields;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setFields($fields)
18
+	{
19
+		$this->fields = $fields;
20
+		$this->apiParas["fields"] = $fields;
21
+	}
22
+
23
+	public function getFields()
24
+	{
25
+		return $this->fields;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.areas.get";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+		RequestCheckUtil::checkNotNull($this->fields,"fields");
42
+	}
43
+	
44
+	public function putOtherTextParam($key, $value) {
45
+		$this->apiParas[$key] = $value;
46
+		$this->$key = $value;
47
+	}
48
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountLoginRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.login request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountLoginRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.login";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountLoginbytokenRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.loginbytoken request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountLoginbytokenRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.loginbytoken";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountLogindoublecheckRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.logindoublecheck request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountLogindoublecheckRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.logindoublecheck";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountNewlogindoublecheckRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.newlogindoublecheck request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountNewlogindoublecheckRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.newlogindoublecheck";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountPasswordResetRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.password.reset request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountPasswordResetRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.password.reset";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountRegisterRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.register request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountRegisterRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.register";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountRegistercodeCheckRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.registercode.check request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountRegistercodeCheckRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.registercode.check";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountRegistercodeSendRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.registercode.send request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountRegistercodeSendRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.registercode.send";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 47 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountResetcodeCheckRequest.php

@@ -0,0 +1,47 @@
1
+<?php
2
+/**
3
+ * TOP API: taobao.baichuan.openaccount.resetcode.check request
4
+ * 
5
+ * @author auto create
6
+ * @since 1.0, 2018.07.26
7
+ */
8
+class BaichuanOpenaccountResetcodeCheckRequest
9
+{
10
+	/** 
11
+	 * name
12
+	 **/
13
+	private $name;
14
+	
15
+	private $apiParas = array();
16
+	
17
+	public function setName($name)
18
+	{
19
+		$this->name = $name;
20
+		$this->apiParas["name"] = $name;
21
+	}
22
+
23
+	public function getName()
24
+	{
25
+		return $this->name;
26
+	}
27
+
28
+	public function getApiMethodName()
29
+	{
30
+		return "taobao.baichuan.openaccount.resetcode.check";
31
+	}
32
+	
33
+	public function getApiParas()
34
+	{
35
+		return $this->apiParas;
36
+	}
37
+	
38
+	public function check()
39
+	{
40
+		
41
+	}
42
+	
43
+	public function putOtherTextParam($key, $value) {
44
+		$this->apiParas[$key] = $value;
45
+		$this->$key = $value;
46
+	}
47
+}

+ 0 - 0
extend/TaobaoSdk/top/request/BaichuanOpenaccountResetcodeSendRequest.php


Неке датотеке нису приказане због велике количине промена