更新采集

This commit is contained in:
mkm 2023-10-10 14:54:50 +08:00
parent 21b6701da2
commit febc285049
145 changed files with 12017 additions and 55 deletions

View File

@ -0,0 +1,385 @@
<?php
namespace app\common\service;
use app\common\model\system\Extend;
use Exception;
use taobao\LtInflector;
use taobao\ResultSet;
use taobao\TopLogger;
class TopClient
{
public $appkey;
public $secretKey;
public $gatewayUrl = "http://gw.api.taobao.com/router/rest";
public $format = "xml";
public $connectTimeout;
public $readTimeout;
/** 是否打开入参check**/
public $checkRequest = true;
protected $signMethod = "md5";
protected $apiVersion = "2.0";
protected $sdkVersion = "top-sdk-php-20180326";
public function getAppkey()
{
return $this->appkey;
}
public function __construct($appkey = "",$secretKey = ""){
$this->appkey = $appkey;
$this->secretKey = $secretKey ;
}
protected function generateSign($params)
{
ksort($params);
$stringToBeSigned = $this->secretKey;
foreach ($params as $k => $v)
{
if(!is_array($v) && "@" != substr($v, 0, 1))
{
$stringToBeSigned .= "$k$v";
}
}
unset($k, $v);
$stringToBeSigned .= $this->secretKey;
return strtoupper(md5($stringToBeSigned));
}
public function curl($url, $postFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (is_array($postFields) && 0 < count($postFields))
{
$postBodyString = "";
$postMultipart = false;
foreach ($postFields as $k => $v)
{
if("@" != substr($v, 0, 1))//判断是不是文件上传
{
$postBodyString .= "$k=" . urlencode($v) . "&";
}
else//文件上传用multipart/form-data否则用www-form-urlencoded
{
$postMultipart = true;
if(class_exists('\CURLFile')){
$postFields[$k] = new \CURLFile(substr($v, 1));
}
}
}
unset($k, $v);
curl_setopt($ch, CURLOPT_POST, true);
if ($postMultipart)
{
if (class_exists('\CURLFile')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
} else {
if (defined('CURLOPT_SAFE_UPLOAD')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
}
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
}
else
{
$header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8");
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
}
}
$reponse = curl_exec($ch);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
public function curl_with_memory_file($url, $postFields = null, $fileFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
//生成分隔符
$delimiter = '-------------' . uniqid();
//先将post的普通数据生成主体字符串
$data = '';
if($postFields != null){
foreach ($postFields as $name => $content) {
$data .= "--" . $delimiter . "\r\n";
$data .= 'Content-Disposition: form-data; name="' . $name . '"';
//multipart/form-data 不需要urlencode参见 http:stackoverflow.com/questions/6603928/should-i-url-encode-post-data
$data .= "\r\n\r\n" . $content . "\r\n";
}
unset($name,$content);
}
//将上传的文件生成主体字符串
if($fileFields != null){
foreach ($fileFields as $name => $file) {
$data .= "--" . $delimiter . "\r\n";
$data .= 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $file['name'] . "\" \r\n";
$data .= 'Content-Type: ' . $file['type'] . "\r\n\r\n";//多了个文档类型
$data .= $file['content'] . "\r\n";
}
unset($name,$file);
}
//主体结束的分隔符
$data .= "--" . $delimiter . "--";
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER , array(
'Content-Type: multipart/form-data; boundary=' . $delimiter,
'Content-Length: ' . strlen($data))
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reponse = curl_exec($ch);
unset($data);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
{
$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
$logger->conf["separator"] = "^_^";
$logData = array(
date("Y-m-d H:i:s"),
$apiName,
$this->appkey,
$localIp,
PHP_OS,
$this->sdkVersion,
$requestUrl,
$errorCode,
str_replace("\n","",$responseTxt)
);
$logger->log($logData);
}
public function execute($request, $session = null,$bestUrl = null)
{
$result = new ResultSet();
if($this->checkRequest) {
try {
$request->check();
} catch (Extend $e) {
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
}
//组装系统参数
$sysParams["app_key"] = $this->appkey;
$sysParams["v"] = $this->apiVersion;
$sysParams["format"] = $this->format;
$sysParams["sign_method"] = $this->signMethod;
$sysParams["method"] = $request->getApiMethodName();
$sysParams["timestamp"] = date("Y-m-d H:i:s");
if (null != $session)
{
$sysParams["session"] = $session;
}
$apiParams = array();
//获取业务参数
$apiParams = $request->getApiParas();
//系统参数放入GET请求串
if($bestUrl){
$requestUrl = $bestUrl."?";
$sysParams["partner_id"] = $this->getClusterTag();
}else{
$requestUrl = $this->gatewayUrl."?";
$sysParams["partner_id"] = $this->sdkVersion;
}
//签名
$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams));
foreach ($sysParams as $sysParamKey => $sysParamValue)
{
// if(strcmp($sysParamKey,"timestamp") != 0)
$requestUrl .= "$sysParamKey=" . urlencode($sysParamValue) . "&";
}
$fileFields = array();
foreach ($apiParams as $key => $value) {
if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
$value['name'] = $key;
$fileFields[$key] = $value;
unset($apiParams[$key]);
}
}
// $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
$requestUrl = substr($requestUrl, 0, -1);
//发起HTTP请求
try
{
if(count($fileFields) > 0){
$resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
}else{
$resp = $this->curl($requestUrl, $apiParams);
}
}
catch (Extend $e)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
unset($apiParams);
unset($fileFields);
//解析TOP返回结果
$respWellFormed = false;
if ("json" == $this->format)
{
$respObject = json_decode($resp);
if (null !== $respObject)
{
$respWellFormed = true;
foreach ($respObject as $propKey => $propValue)
{
$respObject = $propValue;
}
}
}
else if("xml" == $this->format)
{
$respObject = @simplexml_load_string($resp);
if (false !== $respObject)
{
$respWellFormed = true;
}
}
//返回的HTTP文本不是标准JSON或者XML记下错误日志
if (false === $respWellFormed)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
$result->code = 0;
$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
return $result;
}
//如果TOP返回了错误码记录到业务错误日志中
if (isset($respObject->code))
{
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
$logger->log(array(
date("Y-m-d H:i:s"),
$resp
));
}
return $respObject;
}
public function exec($paramsArray)
{
if (!isset($paramsArray["method"]))
{
trigger_error("No api name passed");
}
$inflector = new LtInflector;
$inflector->conf["separator"] = ".";
$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request";
if (!class_exists($requestClassName))
{
trigger_error("No such api: " . $paramsArray["method"]);
}
$session = isset($paramsArray["session"]) ? $paramsArray["session"] : null;
$req = new $requestClassName;
foreach($paramsArray as $paraKey => $paraValue)
{
$inflector->conf["separator"] = "_";
$setterMethodName = $inflector->camelize($paraKey);
$inflector->conf["separator"] = ".";
$setterMethodName = "set" . $inflector->camelize($setterMethodName);
if (method_exists($req, $setterMethodName))
{
$req->$setterMethodName($paraValue);
}
}
return $this->execute($req, $session);
}
private function getClusterTag()
{
return substr($this->sdkVersion,0,11)."-cluster".substr($this->sdkVersion,11);
}
}

View File

@ -53,8 +53,11 @@ use crmeb\jobs\TestJob;
use crmeb\services\PayService;
use crmeb\services\CombinePayService;
use app\common\model\user\User;
use app\common\service\TopClient;
use app\controller\api\Ceshi;
use taobao\request\TbkItemInfoGetRequest;
use app\common\repositories\store\product\ProductRepository;
use think\facade\App;
/**
* Class Auth
@ -64,11 +67,113 @@ use app\controller\api\Ceshi;
*/
class Auth extends BaseController
{
public function caiji()
{
$url=$this->request->host();
$parmas = $this->request->param();
$query=parse_url($parmas['url']);
$itemId=$this->convertUrlQuery($query['query']);
$c = new TopClient;
$c->appkey = '34537213';
$c->secretKey = '4a35f3657156580c1f533750295c54c4';
$req = new TbkItemInfoGetRequest;
$req->setNumIids($itemId['itemId']);
$resp = $c->execute($req);
$res=$resp->results->n_tbk_item;
$images=[];
$filename = basename($res->pict_url); // 获取文件名
$destination = public_path('uploads').'img/' . $filename; // 目标路径
$pict_url= $url.'/uploads/img/'.$filename;
file_put_contents($destination, file_get_contents($res->pict_url));
if($resp && isset($resp->small_images) && isset($resp->small_images->string)){
foreach($resp->small_images->string as $k=>$v){
$filename = basename($v); // 获取文件名
$destination = public_path('uploads').'img/' . $filename; // 目标路径
file_put_contents($destination, file_get_contents($v));
$images[]=$url.'/uploads/img/'.$filename;
}
}
$data=[
"image" => $pict_url,
"slider_image" =>$images,
"store_name" => json_decode(json_encode($res->title),true)[0],
"store_info" => json_decode(json_encode($res->cat_leaf_name),true)[0],
"keyword" => "",
"bar_code" => "",
"guarantee_template_id" => "",
"cate_id" => $parmas['cate_id'],
"mer_cate_id" => [],
"unit_name" => $parmas['unit_name'],
"sort" => 0,
"is_show" => "",
"is_good" => 0,
"is_gift_bag" => 0,
"integral_rate" => -1,
"video_link" => "",
"temp_id" => 399,
"content" => $images,
"spec_type" => 0,
"extension_type" => 0,
"attr" => [],
"mer_labels" => [],
"delivery_way" => [
0 => "1",
1 => "2"
],
"delivery_free" => 0,
"param_temp_id" => [],
"extend" => [],
"source_product_id" => "",
"stock" => "100",
"brand_id" => "",
"once_max_count" => 0,
"once_min_count" => 0,
"pay_limit" => 0,
"attrValue" => [
0 => [
"image" => $pict_url,
"price" => bcsub($res->reserve_price,($res->reserve_price*0.05),2),
"cost" => 0,
"ot_price" => 0,
"svip_price" => null,
"stock" => 100,
"bar_code" => "",
"weight" => 0,
"volume" => 0,
],
],
"give_coupon_ids" => [],
"type" => 0,
"svip_price" => 0,
"svip_price_type" => 0,
"params" => [],
"mer_id" => $parmas['mer_id'],
"status" => 0,
"mer_status" => 1,
"rate" => 3,
];
$a= app()->make( ProductRepository::class)->create($data,0,1);
// 下载图片并保存到目标路径
return app('json')->success($a);
}
function convertUrlQuery($query)
{
$queryParts = explode('&', $query);
$params = array();
foreach ($queryParts as $param) {
$item = explode('=', $param);
$params[$item[0]] = $item[1];
}
return $params;
}
public function dotest()
{
$data = [
"tempId" => "ADMIN_PAY_SUCCESS_CODE",
"id" => 113
"id" => 113
];
try {
$client = app()->make(JgPush::class);
@ -84,7 +189,7 @@ class Auth extends BaseController
public function test()
{
$type = $this->request->param('type');
$res=[];
$res = [];
switch ($type) {
case 1:
$res = (app()->make(Ceshi::class))->Merchant_reconciliation_download();
@ -109,21 +214,21 @@ class Auth extends BaseController
break;
}
return app('json')->success(json_decode($res, true));
// $data = [
// 'tempId' => '',
// 'id' => '',
// ];
// Queue::push(SendSmsJob::class,$data);
// $status = app()->make(SystemNoticeConfigRepository::class)->getNoticeStatusByConstKey($data['tempId']);
// if ($status['notice_sms'] == 1) {
// SmsService::sendMessage($data);
// }
// if ($status['notice_wechat'] == 1) {
// app()->make(WechatTemplateMessageService::class)->sendTemplate($data);
// }
// if ($status['notice_routine'] == 1) {
// app()->make(WechatTemplateMessageService::class)->subscribeSendTemplate($data);
// }
// $data = [
// 'tempId' => '',
// 'id' => '',
// ];
// Queue::push(SendSmsJob::class,$data);
// $status = app()->make(SystemNoticeConfigRepository::class)->getNoticeStatusByConstKey($data['tempId']);
// if ($status['notice_sms'] == 1) {
// SmsService::sendMessage($data);
// }
// if ($status['notice_wechat'] == 1) {
// app()->make(WechatTemplateMessageService::class)->sendTemplate($data);
// }
// if ($status['notice_routine'] == 1) {
// app()->make(WechatTemplateMessageService::class)->subscribeSendTemplate($data);
// }
}
/**
@ -142,9 +247,9 @@ class Auth extends BaseController
if (!$account)
return app('json')->fail('请输入账号');
$user = $repository->accountByUser($this->request->param('account'));
// if($auth_token && $user){
// return app('json')->fail('用户已存在');
// }
// if($auth_token && $user){
// return app('json')->fail('用户已存在');
// }
if (!$user) $this->loginFailure($account);
if (!password_verify($pwd = (string)$this->request->param('password'), $user['pwd'])) $this->loginFailure($account);
$auth = $this->parseAuthToken($auth_token);
@ -176,7 +281,6 @@ class Auth extends BaseController
$fail_key = 'api_login_freeze_' . $account;
Cache::set($fail_key, 1, 15 * 60);
throw new ValidateException('账号或密码错误次数太多,请稍后在尝试');
} else {
Cache::set($key, $numb, 5 * 60);
@ -225,7 +329,7 @@ class Auth extends BaseController
// 判断是否是商户,并且有没有完善信息
// 这里有点小问题以后要修改
$store_service = Db::name('store_service')->where('uid', $data['uid'])->find();
if ($store_service) {
$mer_arr = Db::name('merchant')->where('mer_id', $store_service['mer_id'])->where('is_del', 0)->field('type_id,mer_avatar,mer_banner,business_status,mer_info,category_id,service_phone,mer_address,uid,mer_name,create_time,update_time,mer_settlement_agree_status,is_margin,street_id')->find();
if ($mer_arr && $mer_arr['mer_avatar'] != '' && $mer_arr['mer_banner'] != '' && $mer_arr['mer_info'] && $mer_arr['service_phone'] != '' && $mer_arr['mer_address'] != '') {
@ -245,7 +349,7 @@ class Auth extends BaseController
$thirdparty = Db::name('user_thirdparty_token')->where('user_id', $user->uid)->select();
$thirdList = [];
foreach($thirdparty as $v) {
foreach ($thirdparty as $v) {
$temp = [
'account' => $v['account'],
'user_type' => $v['user_type'],
@ -279,16 +383,16 @@ class Auth extends BaseController
if (!$merchant) {
return app('json')->fail('没有店铺');
}
if($merchant['is_margin'] == 10){
if ($merchant['is_margin'] == 10) {
return app('json')->fail('保证金已缴纳');
}
if($merchant['margin'] == 0){
if ($merchant['margin'] == 0) {
$margin = Db::name('MerchantType')->where('mer_type_id', $merchant['type_id'])->value('margin');
$margin = bcsub($margin,$merchant['paid_margin'],2);
}else{
$margin=$merchant['margin'];
$margin = bcsub($margin, $merchant['paid_margin'], 2);
} else {
$margin = $merchant['margin'];
}
if($margin==0){
if ($margin == 0) {
return app('json')->fail('当前金额为0,不能进行充值');
}
$orderSn = "bzj" . date('YmdHis') . uniqid();
@ -313,7 +417,7 @@ class Auth extends BaseController
];
$payType = 'weixinApp';
$service = new PayService($payType, $param);
$payInfo = $service->pay(User::where(['uid'=>$user['uid']])->find());
$payInfo = $service->pay(User::where(['uid' => $user['uid']])->find());
return app('json')->success($payInfo);
}
@ -321,8 +425,8 @@ class Auth extends BaseController
{
$user = $this->request->userInfo();
[$page, $limit] = $this->getPage();
$count = Db::name('margin_order')->where('uid', $user['uid'])->where('paid',1)->count();
$list = Db::name('margin_order')->where('uid', $user['uid'])->where('paid',1)->page($page, $limit)->order('order_id', 'desc')->select()->toArray();
$count = Db::name('margin_order')->where('uid', $user['uid'])->where('paid', 1)->count();
$list = Db::name('margin_order')->where('uid', $user['uid'])->where('paid', 1)->page($page, $limit)->order('order_id', 'desc')->select()->toArray();
return app('json')->success(compact('count', 'list'));
}
@ -552,7 +656,7 @@ class Auth extends BaseController
if ($sms_limit && $limit > $sms_limit) {
return app('json')->fail('请求太频繁请稍后再试');
}
// if(!env('APP_DEBUG', false)){
// if(!env('APP_DEBUG', false)){
try {
$sms_code = str_pad(random_int(1, 9999), 4, 0, STR_PAD_LEFT);
$sms_time = systemConfig('sms_time') ? systemConfig('sms_time') : 30;
@ -560,10 +664,10 @@ class Auth extends BaseController
} catch (Exception $e) {
return app('json')->fail($e->getMessage());
}
// }else{
// $sms_code = 1234;
// $sms_time = 5;
// }
// }else{
// $sms_code = 1234;
// $sms_time = 5;
// }
$sms_key = app()->make(SmsService::class)->sendSmsKey($data['phone'], $data['type']);
Cache::set($sms_key, $sms_code, $sms_time * 60);
Cache::set($sms_limit_key, $limit + 1, 60);
@ -889,9 +993,9 @@ class Auth extends BaseController
$phone = $data['purePhoneNumber'];
$user = $userRepository->accountByUser($phone);
// if($user && $auth_token){
// return app('json')->fail('用户已存在');
// }
// if($user && $auth_token){
// return app('json')->fail('用户已存在');
// }
$auth = $this->parseAuthToken($auth_token);
if ($user && $auth) {
$userRepository->syncBaseAuth($auth, $user);
@ -1026,7 +1130,7 @@ class Auth extends BaseController
$merIdArray = $queryMerBuilder->fetchSql(false)->column('mer_id');
$queryBuilder = $queryBuilder->whereIn('mer_id', $merIdArray);
if ($cityCode) {
$cityCodeArray = explode(',', $cityCode );
$cityCodeArray = explode(',', $cityCode);
if (count($cityCodeArray) == 1) {
$queryBuilder = $queryBuilder->where('city_code', $cityCode);
}
@ -1114,7 +1218,7 @@ class Auth extends BaseController
$merIdArray = $queryMerBuilder->fetchSql(false)->column('mer_id');
$queryBuilder = $queryBuilder->whereIn('mer_id', $merIdArray);
if ($cityCode) {
$cityCodeArray = explode(',', $cityCode );
$cityCodeArray = explode(',', $cityCode);
if (count($cityCodeArray) == 1) {
$queryBuilder = $queryBuilder->where('city_code', $cityCode);
}
@ -1174,7 +1278,7 @@ class Auth extends BaseController
}
$list = $list->toArray();
};
foreach($list as $k=>$v) {
foreach ($list as $k => $v) {
$list[$k]['order_sn'] = !empty($orderIdList[$v['order_id']]) ? $orderIdList[$v['order_id']] : '';
}
return app('json')->success(compact('count', 'list'));
@ -1240,7 +1344,7 @@ class Auth extends BaseController
'where' => $this->request->param(),
'mer_num' => $merNum
];
return app('json')->success($data);
return app('json')->success($data);
}
//根据地址信息查询商品数
@ -1319,7 +1423,7 @@ class Auth extends BaseController
$expiresTime = $this->request->param('expires_time', '');
$user = $this->request->userInfo();
$uid = $user->uid;
$tokenInfo = Db::name('user_thirdparty_token')->where(['user_type'=>$userType, 'user_id'=>$uid])->find();
$tokenInfo = Db::name('user_thirdparty_token')->where(['user_type' => $userType, 'user_id' => $uid])->find();
if ($tokenInfo) {
$updData = [
'account' => $account,
@ -1327,7 +1431,7 @@ class Auth extends BaseController
'expires_time' => $expiresTime,
'create_time' => date('Y-m-d H:i:s')
];
Db::name('user_thirdparty_token')->where(['user_type'=>$userType, 'user_id'=>$uid])->update($updData);
Db::name('user_thirdparty_token')->where(['user_type' => $userType, 'user_id' => $uid])->update($updData);
} else {
$insertData = [
'user_id' => $uid,
@ -1414,8 +1518,8 @@ class Auth extends BaseController
$phoneBrand = $this->request->param('phone_brand', '');
$queryBuilder = Db::name('AppUpdate')->where('type', $type);
if ($type == 3) {
$android = (Db::name('AppUpdate')->where('type', 1)->where('phone_brand','')->order('id', 'desc')->find()) ?? (object)[];
$ios = (Db::name('AppUpdate')->where('type', 2)->where('phone_brand','')->order('id', 'desc')->find()) ?? (object)[];
$android = (Db::name('AppUpdate')->where('type', 1)->where('phone_brand', '')->order('id', 'desc')->find()) ?? (object)[];
$ios = (Db::name('AppUpdate')->where('type', 2)->where('phone_brand', '')->order('id', 'desc')->find()) ?? (object)[];
return app('json')->success(compact('android', 'ios'));
} else {
if ($version) {
@ -1423,7 +1527,7 @@ class Auth extends BaseController
}
if ($phoneBrand) {
$spos = false;
foreach($brandArray as $b) {
foreach ($brandArray as $b) {
$pos = stripos($phoneBrand, $b);
if ($pos !== false) {
$spos = true;
@ -1439,7 +1543,7 @@ class Auth extends BaseController
$appInfo = (Db::name('AppUpdate')->where('type', $type)->where('version', '>', $version)->find()) ?? (object)[];
}
}
return app('json')->success(compact('appInfo'));
}
@ -1451,7 +1555,7 @@ class Auth extends BaseController
Log::info("同步商户申请状态数据:" . json_encode(request()->param()));
$repository = app()->make(MerchantIntentionRepository::class);
if (!$repository->getWhereCount(['mer_intention_id' => $id, 'is_del' => 0]))
return app('json')->fail('数据不存在');
return app('json')->fail('数据不存在');
$status = $this->request->post('status', 0);
$remark = $this->request->post('remark', '');
$type = $this->request->post('type', 1);
@ -1468,7 +1572,7 @@ class Auth extends BaseController
$repository->updateStatus($id, $data);
$intention = Db::name('merchant_intention')->where('mer_intention_id', $id)->where('type', 1)->find();
$merLicenseImage = '';
if (!empty($intention['images'])) {
if (!empty($intention['images'])) {
$merLicenseImageArray = explode(',', $intention['images']);
$merLicenseImage = $merLicenseImageArray[0] ?? '';
}
@ -1492,10 +1596,10 @@ class Auth extends BaseController
$merId = Db::name('merchant_intention')->where('mer_intention_id', $id)->where('type', 2)->value('mer_id', 0);
Db::name('merchant')->where('mer_id', $merId)->where('status', 1)->update(['business_status' => ($status == 1 ? 2 : 3)]);
if ($status == 1) {
Db::name('merchant')->where('mer_id', $merId)->update(['mer_settlement_agree_status'=>1]);
Db::name('merchant')->where('mer_id', $merId)->update(['mer_settlement_agree_status' => 1]);
}
}
return app('json')->success('同步成功');
}

View File

@ -98,6 +98,7 @@ class Product extends BaseController
$product_type=0;//普通商品
}
$data['update_time'] = date('Y-m-d H:i:s');
halt($data);
$this->repository->create($data,$product_type,1);
return app('json')->success('添加成功');
}

View File

@ -0,0 +1,47 @@
<?php
class ApplicationVar
{
var $save_file;
var $application = null;
var $app_data = '';
var $__writed = false;
function __construct()
{
$this->save_file = __DIR__.'/httpdns.conf' ;
$this->application = array();
}
public function setValue($var_name,$var_value)
{
if (!is_string($var_name) || empty($var_name))
return false;
$this->application[$var_name] = $var_value;
}
public function write(){
$this->app_data = @serialize($this->application);
$this->__writeToFile();
}
public function getValue()
{
if (!is_file($this->save_file))
$this->__writeToFile();
return @unserialize(@file_get_contents($this->save_file));
}
function __writeToFile()
{
$fp = @fopen($this->save_file,"w");
if(flock($fp , LOCK_EX | LOCK_NB)){
@fwrite($fp,$this->app_data);
flock($fp , LOCK_UN);
}
@fclose($fp);
}
}
?>

View File

@ -0,0 +1,78 @@
<?php
class Autoloader{
/**
* 类库自动加载,写死路径,确保不加载其他文件。
* @param string $class 对象类名
* @return void
*/
public static function autoload($class) {
$name = $class;
if(false !== strpos($name,'\\')){
$name = strstr($class, '\\', true);
}
$filename = TOP_AUTOLOADER_PATH."/top/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/top/request/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/top/domain/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/aliyun/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/aliyun/request/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/aliyun/domain/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/dingtalk/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/dingtalk/request/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/dingtalk/domain/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
$filename = TOP_AUTOLOADER_PATH."/QimenCloud/top/request/".$name.".php";
if(is_file($filename)) {
include $filename;
return;
}
}
}
spl_autoload_register('Autoloader::autoload');
?>

View File

@ -0,0 +1,199 @@
<?php
class ClusterTopClient extends TopClient {
private static $dnsconfig;
private static $syncDate = 0;
private static $applicationVar ;
private static $cfgDuration = 10;
public function __construct($appkey = "",$secretKey = ""){
ClusterTopClient::$applicationVar = new ApplicationVar;
$this->appkey = $appkey;
$this->secretKey = $secretKey ;
$saveConfig = ClusterTopClient::$applicationVar->getValue();
if($saveConfig){
$tmpConfig = $saveConfig['dnsconfig'];
ClusterTopClient::$dnsconfig = $this->object_to_array($tmpConfig);
unset($tmpConfig);
ClusterTopClient::$syncDate = $saveConfig['syncDate'];
if(!ClusterTopClient::$syncDate)
ClusterTopClient::$syncDate = 0;
}
}
public function __destruct(){
if(ClusterTopClient::$dnsconfig && ClusterTopClient::$syncDate){
ClusterTopClient::$applicationVar->setValue("dnsconfig",ClusterTopClient::$dnsconfig);
ClusterTopClient::$applicationVar->setValue("syncDate",ClusterTopClient::$syncDate);
ClusterTopClient::$applicationVar->write();
}
}
public function execute($request = null, $session = null,$bestUrl = null){
$currentDate = date('U');
$syncDuration = $this->getDnsConfigSyncDuration();
$bestUrl = $this->getBestVipUrl($this->gatewayUrl,$request->getApiMethodName(),$session);
if($currentDate - ClusterTopClient::$syncDate > $syncDuration * 60){
$httpdns = new HttpdnsGetRequest;
ClusterTopClient::$dnsconfig = json_decode(parent::execute($httpdns,null,$bestUrl)->result,true);
$syncDate = date('U');
ClusterTopClient::$syncDate = $syncDate ;
}
return parent::execute($request,$session,$bestUrl);
}
private function getDnsConfigSyncDuration(){
if(ClusterTopClient::$cfgDuration){
return ClusterTopClient::$cfgDuration;
}
if(!ClusterTopClient::$dnsconfig){
return ClusterTopClient::$cfgDuration;
}
$config = json_encode(ClusterTopClient::$dnsconfig);
if(!$config){
return ClusterTopClient::$cfgDuration;
}
$config = ClusterTopClient::$dnsconfig['config'];
$duration = $config['interval'];
ClusterTopClient::$cfgDuration = $duration;
return ClusterTopClient::$cfgDuration;
}
private function getBestVipUrl($url,$apiname = null,$session = null){
$config = ClusterTopClient::$dnsconfig['config'];
$degrade = $config['degrade'];
if(strcmp($degrade,'true') == 0){
return $url;
}
$currentEnv = $this->getEnvByApiName($apiname,$session);
$vip = $this->getVipByEnv($url,$currentEnv);
if($vip)
return $vip;
return $url;
}
private function getVipByEnv($comUrl,$currentEnv){
$urlSchema = parse_url($comUrl);
if(!$urlSchema)
return null;
if(!ClusterTopClient::$dnsconfig['env'])
return null;
if(!array_key_exists($currentEnv,ClusterTopClient::$dnsconfig['env']))
return null;
$hostList = ClusterTopClient::$dnsconfig['env'][$currentEnv];
if(!$hostList)
return null ;
$vipList = null;
foreach ($hostList as $key => $value) {
if(strcmp($key,$urlSchema['host']) == 0 && strcmp($value['proto'],$urlSchema['scheme']) == 0){
$vipList = $value;
break;
}
}
$vip = $this->getRandomWeightElement($vipList['vip']);
if($vip){
return $urlSchema['scheme']."://".$vip.$urlSchema['path'];
}
return null;
}
private function getEnvByApiName($apiName,$session=""){
$apiCfgArray = ClusterTopClient::$dnsconfig['api'];
if($apiCfgArray){
if(array_key_exists($apiName,$apiCfgArray)){
$apiCfg = $apiCfgArray[$apiName];
if(array_key_exists('user',$apiCfg)){
$userFlag = $apiCfg['user'];
$flag = $this->getUserFlag($session);
if($userFlag && $flag ){
return $this->getEnvBySessionFlag($userFlag,$flag);
}else{
return $this->getRandomWeightElement($apiCfg['rule']);
}
}
}
}
return $this->getDeafultEnv();
}
private function getUserFlag($session){
if($session && strlen($session) > 5){
if($session[0] == '6' || $session[0] == '7'){
return $session[strlen($session) -1];
}else if($session[0] == '5' || $session[0] == '8'){
return $session[5];
}
}
return null;
}
private function getEnvBySessionFlag($targetConfig,$flag){
if($flag){
$userConf = ClusterTopClient::$dnsconfig['user'];
$cfgArry = $userConf[$targetConfig];
foreach ($cfgArry as $key => $value) {
if(in_array($flag,$value))
return $key;
}
}else{
return null;
}
}
private function getRandomWeightElement($elements){
$totalWeight = 0;
if($elements){
foreach ($elements as $ele) {
$weight = $this->getElementWeight($ele);
$r = $this->randomFloat() * ($weight + $totalWeight);
if($r >= $totalWeight){
$selected = $ele;
}
$totalWeight += $weight;
}
if($selected){
return $this->getElementValue($selected);
}
}
return null;
}
private function getElementWeight($ele){
$params = explode('|', $ele);
return floatval($params[1]);
}
private function getElementValue($ele){
$params = explode('|', $ele);
return $params[0];
}
private function getDeafultEnv(){
return ClusterTopClient::$dnsconfig['config']['def_env'];
}
private static function startsWith($haystack, $needle) {
return $needle === "" || strpos($haystack, $needle) === 0;
}
private function object_to_array($obj)
{
$_arr= is_object($obj) ? get_object_vars($obj) : $obj;
foreach($_arr as $key=> $val)
{
$val= (is_array($val) || is_object($val))? $this->object_to_array($val) : $val;
$arr[$key] = $val;
}
return$arr;
}
private function randomFloat($min = 0, $max = 1) { return $min + mt_rand() / mt_getrandmax() * ($max - $min); }
}
?>

View File

@ -0,0 +1,23 @@
<?php
class HttpdnsGetRequest
{
private $apiParas = array();
public function getApiMethodName()
{
return "taobao.httpdns.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check(){}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace taobao;
class LtInflector
{
public $conf = array("separator" => "_");
public function camelize($uncamelized_words)
{
$uncamelized_words = $this->conf["separator"] . str_replace($this->conf["separator"] , " ", strtolower($uncamelized_words));
return ltrim(str_replace(" ", "", ucwords($uncamelized_words)), $this->conf["separator"] );
}
public function uncamelize($camelCaps)
{
return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $this->conf["separator"] . "$2", $camelCaps));
}
}

View File

@ -0,0 +1,384 @@
<?php
class QimenCloudClient
{
public $appkey;
public $secretKey;
public $targetAppkey = "";
public $gatewayUrl = null;
public $format = "xml";
public $connectTimeout;
public $readTimeout;
/** 是否打开入参check**/
public $checkRequest = true;
protected $signMethod = "md5";
protected $apiVersion = "2.0";
protected $sdkVersion = "top-sdk-php-20151012";
public function getAppkey()
{
return $this->appkey;
}
public function __construct($appkey = "",$secretKey = ""){
$this->appkey = $appkey;
$this->secretKey = $secretKey ;
}
protected function generateSign($params)
{
ksort($params);
$stringToBeSigned = $this->secretKey;
foreach ($params as $k => $v)
{
if(!is_array($v) && "@" != substr($v, 0, 1))
{
$stringToBeSigned .= "$k$v";
}
}
unset($k, $v);
$stringToBeSigned .= $this->secretKey;
return strtoupper(md5($stringToBeSigned));
}
public function curl($url, $postFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (is_array($postFields) && 0 < count($postFields))
{
$postBodyString = "";
$postMultipart = false;
foreach ($postFields as $k => $v)
{
if("@" != substr($v, 0, 1))//判断是不是文件上传
{
$postBodyString .= "$k=" . urlencode($v) . "&";
}
else//文件上传用multipart/form-data否则用www-form-urlencoded
{
$postMultipart = true;
if(class_exists('\CURLFile')){
$postFields[$k] = new \CURLFile(substr($v, 1));
}
}
}
unset($k, $v);
curl_setopt($ch, CURLOPT_POST, true);
if ($postMultipart)
{
if (class_exists('\CURLFile')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
} else {
if (defined('CURLOPT_SAFE_UPLOAD')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
}
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
}
else
{
$header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8");
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
}
}
$reponse = curl_exec($ch);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
public function curl_with_memory_file($url, $postFields = null, $fileFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "top-sdk-php" );
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
//生成分隔符
$delimiter = '-------------' . uniqid();
//先将post的普通数据生成主体字符串
$data = '';
if($postFields != null){
foreach ($postFields as $name => $content) {
$data .= "--" . $delimiter . "\r\n";
$data .= 'Content-Disposition: form-data; name="' . $name . '"';
//multipart/form-data 不需要urlencode参见 http:stackoverflow.com/questions/6603928/should-i-url-encode-post-data
$data .= "\r\n\r\n" . $content . "\r\n";
}
unset($name,$content);
}
//将上传的文件生成主体字符串
if($fileFields != null){
foreach ($fileFields as $name => $file) {
$data .= "--" . $delimiter . "\r\n";
$data .= 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $file['name'] . "\" \r\n";
$data .= 'Content-Type: ' . $file['type'] . "\r\n\r\n";//多了个文档类型
$data .= $file['content'] . "\r\n";
}
unset($name,$file);
}
//主体结束的分隔符
$data .= "--" . $delimiter . "--";
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER , array(
'Content-Type: multipart/form-data; boundary=' . $delimiter,
'Content-Length: ' . strlen($data))
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reponse = curl_exec($ch);
unset($data);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
{
$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
$logger->conf["separator"] = "^_^";
$logData = array(
date("Y-m-d H:i:s"),
$apiName,
$this->appkey,
$localIp,
PHP_OS,
$this->sdkVersion,
$requestUrl,
$errorCode,
str_replace("\n","",$responseTxt)
);
$logger->log($logData);
}
public function execute($request, $session = null,$bestUrl = null)
{
if($this->gatewayUrl == null) {
throw new Exception("client-check-error:Need Set gatewayUrl.", 40);
}
$result = new ResultSet();
if($this->checkRequest) {
try {
$request->check();
} catch (Exception $e) {
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
}
//组装系统参数
$sysParams["app_key"] = $this->appkey;
$sysParams["v"] = $this->apiVersion;
$sysParams["format"] = $this->format;
$sysParams["sign_method"] = $this->signMethod;
$sysParams["method"] = $request->getApiMethodName();
$sysParams["timestamp"] = date("Y-m-d H:i:s");
$sysParams["target_app_key"] = $this->targetAppkey;
if (null != $session)
{
$sysParams["session"] = $session;
}
$apiParams = array();
//获取业务参数
$apiParams = $request->getApiParas();
//系统参数放入GET请求串
if($bestUrl){
$requestUrl = $bestUrl."?";
$sysParams["partner_id"] = $this->getClusterTag();
}else{
$requestUrl = $this->gatewayUrl."?";
$sysParams["partner_id"] = $this->sdkVersion;
}
//签名
$sysParams["sign"] = $this->generateSign(array_merge($apiParams, $sysParams));
foreach ($sysParams as $sysParamKey => $sysParamValue)
{
// if(strcmp($sysParamKey,"timestamp") != 0)
$requestUrl .= "$sysParamKey=" . urlencode($sysParamValue) . "&";
}
$fileFields = array();
foreach ($apiParams as $key => $value) {
if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
$value['name'] = $key;
$fileFields[$key] = $value;
unset($apiParams[$key]);
}
}
// $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
$requestUrl = substr($requestUrl, 0, -1);
//发起HTTP请求
try
{
if(count($fileFields) > 0){
$resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
}else{
$resp = $this->curl($requestUrl, $apiParams);
}
}
catch (Exception $e)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
unset($apiParams);
unset($fileFields);
//解析TOP返回结果
$respWellFormed = false;
if ("json" == $this->format)
{
$respObject = json_decode($resp);
if (null !== $respObject)
{
$respWellFormed = true;
foreach ($respObject as $propKey => $propValue)
{
$respObject = $propValue;
}
}
}
else if("xml" == $this->format)
{
$respObject = @simplexml_load_string($resp);
if (false !== $respObject)
{
$respWellFormed = true;
}
}
//返回的HTTP文本不是标准JSON或者XML记下错误日志
if (false === $respWellFormed)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
$result->code = 0;
$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
return $result;
}
//如果TOP返回了错误码记录到业务错误日志中
if (isset($respObject->code))
{
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
$logger->log(array(
date("Y-m-d H:i:s"),
$resp
));
}
return $respObject;
}
public function exec($paramsArray)
{
if (!isset($paramsArray["method"]))
{
trigger_error("No api name passed");
}
$inflector = new LtInflector;
$inflector->conf["separator"] = ".";
$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request";
if (!class_exists($requestClassName))
{
trigger_error("No such api: " . $paramsArray["method"]);
}
$session = isset($paramsArray["session"]) ? $paramsArray["session"] : null;
$req = new $requestClassName;
foreach($paramsArray as $paraKey => $paraValue)
{
$inflector->conf["separator"] = "_";
$setterMethodName = $inflector->camelize($paraKey);
$inflector->conf["separator"] = ".";
$setterMethodName = "set" . $inflector->camelize($setterMethodName);
if (method_exists($req, $setterMethodName))
{
$req->$setterMethodName($paraValue);
}
}
return $this->execute($req, $session);
}
private function getClusterTag()
{
return substr($this->sdkVersion,0,11)."-cluster".substr($this->sdkVersion,11);
}
}

View File

@ -0,0 +1,111 @@
<?php
namespace taobao;
use Exception;
/**
* API<EFBFBD><EFBFBD>ξ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* <EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD>API<EFBFBD>IJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͡<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD>Ƚ<EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><EFBFBD>
*
**/
class RequestCheckUtil
{
/**
* У<EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD> fieldName <EFBFBD><EFBFBD>ֵ$value<75>ǿ<EFBFBD>
*
**/
public static function checkNotNull($value,$fieldName) {
if(self::checkEmpty($value)){
throw new Exception("client-check-error:Missing Required Arguments: " .$fieldName , 40);
}
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>fieldName<EFBFBD><EFBFBD>ֵvalue <EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
*
**/
public static function checkMaxLength($value,$maxLength,$fieldName){
if(!self::checkEmpty($value) && mb_strlen($value , "UTF-8") > $maxLength){
throw new Exception("client-check-error:Invalid Arguments:the length of " .$fieldName . " can not be larger than " . $maxLength . "." , 41);
}
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>fieldName<EFBFBD><EFBFBD>ֵvalue<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*
**/
public static function checkMaxListSize($value,$maxSize,$fieldName) {
if(self::checkEmpty($value))
return ;
$list=preg_split("/,/",$value);
if(count($list) > $maxSize){
throw new Exception("client-check-error:Invalid Arguments:the listsize(the string split by \",\") of ". $fieldName . " must be less than " . $maxSize . " ." , 41);
}
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>fieldName<EFBFBD><EFBFBD>ֵvalue <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
*
**/
public static function checkMaxValue($value,$maxValue,$fieldName){
if(self::checkEmpty($value))
return ;
self::checkNumeric($value,$fieldName);
if($value > $maxValue){
throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " can not be larger than " . $maxValue ." ." , 41);
}
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>fieldName<EFBFBD><EFBFBD>ֵvalue <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Сֵ
*
**/
public static function checkMinValue($value,$minValue,$fieldName) {
if(self::checkEmpty($value))
return ;
self::checkNumeric($value,$fieldName);
if($value < $minValue){
throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " can not be less than " . $minValue . " ." , 41);
}
}
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>fieldName<EFBFBD><EFBFBD>ֵvalue<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD>number
*
**/
protected static function checkNumeric($value,$fieldName) {
if(!is_numeric($value))
throw new Exception("client-check-error:Invalid Arguments:the value of " . $fieldName . " is not number : " . $value . " ." , 41);
}
/**
* У<EFBFBD><EFBFBD>$value<75>Ƿ<EFBFBD>ǿ<EFBFBD>
* if not set ,return true;
* if is null , return true;
*
*
**/
public static function checkEmpty($value) {
if(!isset($value))
return true ;
if($value === null )
return true;
if(is_array($value) && count($value) == 0)
return true;
if(is_string($value) &&trim($value) === "")
return true;
return false;
}
}
?>

View File

@ -0,0 +1,22 @@
<?php
namespace taobao;
/**
* 返回的默认类
*
* @author auto create
* @since 1.0, 2015-01-20
*/
class ResultSet
{
/**
* 返回的错误码
**/
public $code;
/**
* 返回的错误信息
**/
public $msg;
}

221
extend/taobao/SpiUtils.php Normal file
View File

@ -0,0 +1,221 @@
<?php
namespace taobao;
class SpiUtils{
private static $top_sign_list = "HTTP_TOP_SIGN_LIST";
private static $timestamp = "timestamp";
private static $header_real_ip = array("X_Real_IP", "X_Forwarded_For", "Proxy_Client_IP",
"WL_Proxy_Client_IP", "HTTP_CLIENT_IP", "HTTP_X_FORWARDED_FOR");
/**
* 校验SPI请求签名适用于所有GET请求及不包含文件参数的POST请求。
*
* @param request 请求对象
* @param secret app对应的secret
* @return true校验通过false校验不通过
*/
public static function checkSign4FormRequest($secret){
return self::checkSign(null,null,$secret);
}
/**
* 校验SPI请求签名适用于请求体是xml/json等可用文本表示的POST请求。
*
* @param request 请求对象
* @param body 请求体的文本内容
* @param secret app对应的secret
* @return true校验通过false校验不通过
*/
public static function checkSign4TextRequest($body,$secret){
return self::checkSign(null,$body,$secret);
}
/**
* 校验SPI请求签名适用于带文件上传的POST请求。
*
* @param request 请求对象
* @param form 除了文件参数以外的所有普通文本参数的map集合
* @param secret app对应的secret
* @return true校验通过false校验不通过
*/
public static function checkSign4FileRequest($form, $secret){
return self::checkSign($form, null, $secret);
}
private static function checkSign($form, $body, $secret) {
$params = array();
// 1. 获取header参数
$headerMap = self::getHeaderMap();
foreach ($headerMap as $k => $v){
$params[$k] = $v ;
}
// 2. 获取url参数
$queryMap = self::getQueryMap();
foreach ($queryMap as $k => $v){
$params[$k] = $v ;
}
// 3. 获取form参数
if ($form == null && $body == null) {
$formMap = self::getFormMap();
foreach ($formMap as $k => $v){
$params[$k] = $v ;
}
} else if ($form != null) {
foreach ($form as $k => $v){
$params[$k] = $v ;
}
}
if($body == null){
$body = file_get_contents('php://input');
}
$remoteSign = $queryMap["sign"];
$localSign = self::sign($params, $body, $secret);
if (strcmp($remoteSign, $localSign) == 0) {
return true;
} else {
$paramStr = self::getParamStrFromMap($params);
self::logCommunicationError($remoteSign,$localSign,$paramStr,$body);
return false;
}
}
private static function getHeaderMap() {
$headerMap = array();
$signList = $_SERVER['HTTP_TOP_SIGN_LIST']; // 只获取参与签名的头部字段
if(!$signList) {
return $headerMap;
}
$signList = trim($signList);
if (strlen($signList) > 0){
$params = split(",", $signList);
foreach ($_SERVER as $k => $v){
if (substr($k, 0, 5) == 'HTTP_'){
foreach($params as $kk){
$upperkey = strtoupper($kk);
if(self::endWith($k,$upperkey)){
$headerMap[$kk] = $v;
}
}
}
}
}
return $headerMap;
}
private static function getQueryMap(){
$queryStr = $_SERVER["QUERY_STRING"];
$resultArray = array();
foreach (explode('&', $queryStr) as $pair) {
list($key, $value) = explode('=', $pair);
if (strpos($key, '.') !== false) {
list($subKey, $subVal) = explode('.', $key);
if (preg_match('/(?P<name>\w+)\[(?P<index>\w+)\]/', $subKey, $matches)) {
$resultArray[$matches['name']][$matches['index']][$subVal] = $value;
} else {
$resultArray[$subKey][$subVal] = urldecode($value);
}
} else {
$resultArray[$key] = urldecode($value);
}
}
return $resultArray;
}
private static function checkRemoteIp(){
$remoteIp = $_SERVER["REMOTE_ADDR"];
foreach ($header_real_ip as $k){
$realIp = $_SERVER[$k];
$realIp = trim($realIp);
if(strlen($realIp) > 0 && strcasecmp("unknown",$realIp)){
$remoteIp = $realIp;
break;
}
}
return self::startsWith($remoteIp,"140.205.144.") || self::startsWith($remoteIp,"40.205.145.");
}
private static function getFormMap(){
$resultArray = array();
foreach($_POST as $key=>$v) {
$resultArray[$key] = $v ;
}
return $resultArray ;
}
private static function startsWith($haystack, $needle) {
return $needle === "" || strpos($haystack, $needle) === 0;
}
private static function endWith($haystack, $needle) {
$length = strlen($needle);
if($length == 0)
{
return true;
}
return (substr($haystack, -$length) === $needle);
}
private static function checkTimestamp(){
$ts = $_POST['timestamp'];
if($ts){
$clientTimestamp = strtotime($ts);
$current = $_SERVER['REQUEST_TIME'];
return ($current - $clientTimestamp) <= 5*60*1000;
}else{
return false;
}
}
private static function getParamStrFromMap($params){
ksort($params);
$stringToBeSigned = "";
foreach ($params as $k => $v)
{
if(strcmp("sign", $k) != 0)
{
$stringToBeSigned .= "$k$v";
}
}
unset($k, $v);
return $stringToBeSigned;
}
private static function sign($params,$body,$secret){
ksort($params);
$stringToBeSigned = $secret;
$stringToBeSigned .= self::getParamStrFromMap($params);
if($body)
$stringToBeSigned .= $body;
$stringToBeSigned .= $secret;
return strtoupper(md5($stringToBeSigned));
}
protected static function logCommunicationError($remoteSign, $localSign, $paramStr, $body)
{
$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_". date("Y-m-d") . ".log";
$logger->conf["separator"] = "^_^";
$logData = array(
"checkTopSign error" ,
"remoteSign=".$remoteSign ,
"localSign=".$localSign ,
"paramStr=".$paramStr ,
"body=".$body
);
$logger->log($logData);
}
private static function clear_blank($str, $glue='')
{
$replace = array(" ", "\r", "\n", "\t"); return str_replace($replace, $glue, $str);
}
}
?>

View File

@ -0,0 +1,45 @@
<?php
namespace taobao;
class TopLogger
{
public $conf = array(
"separator" => "\t",
"log_file" => ""
);
private $fileHandle;
protected function getFileHandle()
{
if (null === $this->fileHandle)
{
if (empty($this->conf["log_file"]))
{
trigger_error("no log file spcified.");
}
$logDir = dirname($this->conf["log_file"]);
if (!is_dir($logDir))
{
mkdir($logDir, 0777, true);
}
$this->fileHandle = fopen($this->conf["log_file"], "a");
}
return $this->fileHandle;
}
public function log($logData)
{
if ("" == $logData || array() == $logData)
{
return false;
}
if (is_array($logData))
{
$logData = implode($this->conf["separator"], $logData);
}
$logData = $logData. "\n";
fwrite($this->getFileHandle(), $logData);
}
}
?>

40
extend/taobao/TopSdk.php Normal file
View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,255 @@
<?php
class AliyunClient
{
public $accessKeyId;
public $accessKeySecret;
public $serverUrl = "http://ecs.aliyuncs.com/";
public $format = "json";
public $connectTimeout = 3000;//3秒
public $readTimeout = 80000;//80秒
/** 是否打开入参check**/
public $checkRequest = true;
protected $signatureMethod = "HMAC-SHA1";
protected $signatureVersion = "1.0";
protected $dateTimeFormat = 'Y-m-d\TH:i:s\Z'; // ISO8601规范
protected $sdkVersion = "1.0";
public function execute($request)
{
if($this->checkRequest) {
try {
$request->check();
} catch (Exception $e) {
$result->code = $e->getCode();
$result->message = $e->getMessage();
return $result;
}
}
//获取业务参数
$apiParams = $request->getApiParas();
//组装系统参数
$apiParams["AccessKeyId"] = $this->accessKeyId;
$apiParams["Format"] = $this->format;//
$apiParams["SignatureMethod"] = $this->signatureMethod;
$apiParams["SignatureVersion"] = $this->signatureVersion;
$apiParams["SignatureNonce"] = uniqid();
date_default_timezone_set("GMT");
$apiParams["TimeStamp"] = date($this->dateTimeFormat);
$apiParams["partner_id"] = $this->sdkVersion;
$apiNameArray = split("\.", $request->getApiMethodName());
$apiParams["Action"] = $apiNameArray[3];
$apiParams["Version"] = $apiNameArray[4];
//签名
$apiParams["Signature"] = $this->computeSignature($apiParams, $this->accessKeySecret);
//系统参数放入GET请求串
$requestUrl = rtrim($this->serverUrl,"/") . "/?";
foreach ($apiParams as $apiParamKey => $apiParamValue)
{
$requestUrl .= "$apiParamKey=" . urlencode($apiParamValue) . "&";
}
$requestUrl = substr($requestUrl, 0, -1);
//发起HTTP请求
try
{
$resp = $this->curl($requestUrl, null);
}
catch (Exception $e)
{
$this->logCommunicationError($apiParams["Action"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
if ("json" == $this->format)
{
return json_decode($e->getMessage());
}
else if("xml" == $this->format)
{
return @simplexml_load_string($e->getMessage());
}
}
//解析API返回结果
$respWellFormed = false;
if ("json" == $this->format)
{
$respObject = json_decode($resp);
if (null !== $respObject)
{
$respWellFormed = true;
}
}
else if("xml" == $this->format)
{
$respObject = @simplexml_load_string($resp);
if (false !== $respObject)
{
$respWellFormed = true;
}
}
//返回的HTTP文本不是标准JSON或者XML记下错误日志
if (false === $respWellFormed)
{
$this->logCommunicationError($apiParams["Action"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
$result->code = 0;
$result->message = "HTTP_RESPONSE_NOT_WELL_FORMED";
return $result;
}
//如果TOP返回了错误码记录到业务错误日志中
if (isset($respObject->code))
{
$logger = new LtLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . $this->appkey . "_" . date("Y-m-d") . ".log";
$logger->log(array(
date("Y-m-d H:i:s"),
$resp
));
}
return $respObject;
}
public function exec($paramsArray)
{
if (!isset($paramsArray["Action"]))
{
trigger_error("No api name passed");
}
$inflector = new LtInflector;
$inflector->conf["separator"] = ".";
$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["Action"], 7))) . "Request";
if (!class_exists($requestClassName))
{
trigger_error("No such api: " . $paramsArray["Action"]);
}
$req = new $requestClassName;
foreach($paramsArray as $paraKey => $paraValue)
{
$inflector->conf["separator"] = "_";
$setterMethodName = $inflector->camelize($paraKey);
$inflector->conf["separator"] = ".";
$setterMethodName = "set" . $inflector->camelize($setterMethodName);
if (method_exists($req, $setterMethodName))
{
$req->$setterMethodName($paraValue);
}
}
return $this->execute($req, $session);
}
protected function percentEncode($str)
{
// 使用urlencode编码后将"+","*","%7E"做替换即满足 API规定的编码规范
$res = urlencode($str);
$res = preg_replace('/\+/', '%20', $res);
$res = preg_replace('/\*/', '%2A', $res);
$res = preg_replace('/%7E/', '~', $res);
return $res;
}
protected function computeSignature($parameters, $accessKeySecret)
{
// 将参数Key按字典顺序排序
ksort($parameters);
// 生成规范化请求字符串
$canonicalizedQueryString = '';
foreach($parameters as $key => $value)
{
$canonicalizedQueryString .= '&' . $this->percentEncode($key)
. '=' . $this->percentEncode($value);
}
// 生成用于计算签名的字符串 stringToSign
$stringToSign = 'GET&%2F&' . $this->percentencode(substr($canonicalizedQueryString, 1));
// 计算签名注意accessKeySecret后面要加上字符'&'
$signature = base64_encode(hash_hmac('sha1', $stringToSign, $accessKeySecret . '&', true));
return $signature;
}
public function curl($url, $postFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (is_array($postFields) && 0 < count($postFields))
{
$postBodyString = "";
$postMultipart = false;
foreach ($postFields as $k => $v)
{
if("@" != substr($v, 0, 1))//判断是不是文件上传
{
$postBodyString .= "$k=" . urlencode($v) . "&";
}
else//文件上传用multipart/form-data否则用www-form-urlencoded
{
$postMultipart = true;
}
}
unset($k, $v);
curl_setopt($ch, CURLOPT_POST, true);
if ($postMultipart)
{
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
}
else
{
curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
}
}
$reponse = curl_exec($ch);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
curl_close($ch);
return $reponse;
}
protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
{
$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
$logger = new LtLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . $this->accessKeyId . "_" . date("Y-m-d") . ".log";
$logger->conf["separator"] = "^_^";
$logData = array(
date("Y-m-d H:i:s"),
$apiName,
$this->accessKeyId,
$localIp,
PHP_OS,
$this->sdkVersion,
$requestUrl,
$errorCode,
str_replace("\n","",$responseTxt)
);
$logger->log($logData);
}
}

View File

@ -0,0 +1,656 @@
<?php
class DingTalkClient
{
/**@Author chaohui.zch copy from TopClient and modify 2016-12-14 **/
/**@Author chaohui.zch modify $gatewayUrl 2017-07-18 **/
public $gatewayUrl = "https://eco.taobao.com/router/rest";
public $format = "xml";
public $connectTimeout;
public $readTimeout;
public $apiCallType;
public $httpMethod;
/** 是否打开入参check**/
public $checkRequest = true;
protected $apiVersion = "2.0";
protected $sdkVersion = "dingtalk-sdk-php-20161214";
public function __construct($apiCallType = null, $httpMethod = null, $format = "xml"){
$this->apiCallType = $apiCallType;
$this->httpMethod = $httpMethod;
$this->format = $format;
}
public function curl($url, $postFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (is_array($postFields) && 0 < count($postFields))
{
$postBodyString = "";
$postMultipart = false;
foreach ($postFields as $k => $v)
{
if("@" != substr($v, 0, 1))//判断是不是文件上传
{
$postBodyString .= "$k=" . urlencode($v) . "&";
}
else//文件上传用multipart/form-data否则用www-form-urlencoded
{
$postMultipart = true;
if(class_exists('\CURLFile')){
$postFields[$k] = new \CURLFile(substr($v, 1));
}
}
}
unset($k, $v);
curl_setopt($ch, CURLOPT_POST, true);
if ($postMultipart)
{
if (class_exists('\CURLFile')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
} else {
if (defined('CURLOPT_SAFE_UPLOAD')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
}
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
}
else
{
$header = array("content-type: application/x-www-form-urlencoded; charset=UTF-8");
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_POSTFIELDS, substr($postBodyString,0,-1));
}
}
$reponse = curl_exec($ch);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
public function curl_get($url,$apiFields = null)
{
$ch = curl_init();
foreach ($apiFields as $key => $value)
{
if(!is_string($value)){
$value = json_encode($value);
}
$url .= "&" ."$key=" . urlencode($value);
}
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
if ($this->readTimeout)
{
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout)
{
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
//https ignore ssl check ?
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" )
{
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
$reponse = curl_exec($ch);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
public function curl_json($url, $postFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
if (is_array($postFields) && 0 < count($postFields))
{
$postBodyString = "";
$postMultipart = false;
foreach ($postFields as $k => $v)
{
if(!is_string($v)){
$v = json_encode($v);
}
if("@" != substr($v, 0, 1))//判断是不是文件上传
{
$postBodyString .= "$k=" . urlencode($v) . "&";
}
else//文件上传用multipart/form-data否则用www-form-urlencoded
{
$postMultipart = true;
if(class_exists('\CURLFile')){
$postFields[$k] = new \CURLFile(substr($v, 1));
}
}
}
unset($k, $v);
curl_setopt($ch, CURLOPT_POST, true);
if ($postMultipart)
{
if (class_exists('\CURLFile')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
} else {
if (defined('CURLOPT_SAFE_UPLOAD')) {
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
}
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $postFields);
}
else {
$header = array("Content-Type: application/json; charset=utf-8", "Content-Length:".strlen(json_encode($postFields)));
curl_setopt($ch,CURLOPT_HTTPHEADER,$header);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postFields));
}
}
$reponse = curl_exec($ch);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
public function curl_with_memory_file($url, $postFields = null, $fileFields = null)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FAILONERROR, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if ($this->readTimeout) {
curl_setopt($ch, CURLOPT_TIMEOUT, $this->readTimeout);
}
if ($this->connectTimeout) {
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->connectTimeout);
}
curl_setopt ( $ch, CURLOPT_USERAGENT, "dingtalk-sdk-php" );
//https 请求
if(strlen($url) > 5 && strtolower(substr($url,0,5)) == "https" ) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
}
//生成分隔符
$delimiter = '-------------' . uniqid();
//先将post的普通数据生成主体字符串
$data = '';
if($postFields != null){
foreach ($postFields as $name => $content) {
$data .= "--" . $delimiter . "\r\n";
$data .= 'Content-Disposition: form-data; name="' . $name . '"';
//multipart/form-data 不需要urlencode参见 http:stackoverflow.com/questions/6603928/should-i-url-encode-post-data
$data .= "\r\n\r\n" . $content . "\r\n";
}
unset($name,$content);
}
//将上传的文件生成主体字符串
if($fileFields != null){
foreach ($fileFields as $name => $file) {
$data .= "--" . $delimiter . "\r\n";
$data .= 'Content-Disposition: form-data; name="' . $name . '"; filename="' . $file['filename'] . "\" \r\n";
$data .= 'Content-Type: ' . $file['type'] . "\r\n\r\n";//多了个文档类型
$data .= $file['content'] . "\r\n";
}
unset($name,$file);
}
//主体结束的分隔符
$data .= "--" . $delimiter . "--";
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER , array(
'Content-Type: multipart/form-data; boundary=' . $delimiter,
'Content-Length: ' . strlen($data))
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$reponse = curl_exec($ch);
unset($data);
if (curl_errno($ch))
{
throw new Exception(curl_error($ch),0);
}
else
{
$httpStatusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if (200 !== $httpStatusCode)
{
throw new Exception($reponse,$httpStatusCode);
}
}
curl_close($ch);
return $reponse;
}
protected function logCommunicationError($apiName, $requestUrl, $errorCode, $responseTxt)
{
$localIp = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : "CLI";
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_comm_err_" . "_" . date("Y-m-d") . ".log";
$logger->conf["separator"] = "^_^";
$logData = array(
date("Y-m-d H:i:s"),
$apiName,
$localIp,
PHP_OS,
$this->sdkVersion,
$requestUrl,
$errorCode,
str_replace("\n","",$responseTxt)
);
$logger->log($logData);
}
public function execute($request, $session = null,$bestUrl = null){
if(DingTalkConstant::$CALL_TYPE_OAPI == $this->apiCallType){
return $this->_executeOapi($request, $session, $bestUrl, null, null, null, null);
}else{
return $this->_execute($request, $session, $bestUrl);
}
}
public function executeWithAccessKey($request, $bestUrl = null, $accessKey, $accessSecret){
return $this->executeWithCorpId($request, $bestUrl, $accessKey, $accessSecret, null, null);
}
public function executeWithSuiteTicket($request,$bestUrl = null, $accessKey, $accessSecret, $suiteTicket){
return $this->executeWithCorpId($request,$bestUrl, $accessKey, $accessSecret, $suiteTicket, null);
}
public function executeWithCorpId($request, $bestUrl = null, $accessKey, $accessSecret, $suiteTicket, $corpId) {
if(DingTalkConstant::$CALL_TYPE_OAPI == $this->apiCallType){
return $this->_executeOapi($request, null, $bestUrl,$accessKey, $accessSecret, $suiteTicket, $corpId);
}else{
return $this->_execute($request, null, $bestUrl);
}
}
private function _executeOapi($request, $session = null,$bestUrl = null,$accessKey, $accessSecret, $suiteTicket, $corpId){
$result = new ResultSet();
if($this->checkRequest) {
try {
$request->check();
} catch (Exception $e) {
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
}
$sysParams["method"] = $request->getApiMethodName();
//系统参数放入GET请求串
if($bestUrl){
if(strpos($bestUrl,'?') === false){
$requestUrl = $bestUrl."?";
}else{
$requestUrl = $bestUrl;
}
}else{
$requestUrl = $this->gatewayUrl."?";
}
if(null != $accessKey){
$timestamp = $this->getMillisecond();
// 验证签名有效性
$canonicalString = $this->getCanonicalStringForIsv($timestamp, $suiteTicket);
$signature = $this->computeSignature($accessSecret, $canonicalString);
$queryParams["accessKey"] = $accessKey;
$queryParams["signature"] = $signature;
$queryParams["timestamp"] = $timestamp+"";
if($suiteTicket != null) {
$queryParams["suiteTicket"] = $suiteTicket;
}
if($corpId != null){
$queryParams["corpId"] = $corpId;
}
foreach ($queryParams as $queryParamKey => $queryParamValue) {
$requestUrl .= "$queryParamKey=" . urlencode($queryParamValue) . "&";
}
}else{
$requestUrl .= "access_token=" . urlencode($session) . "&";
}
$apiParams = array();
//获取业务参数
$apiParams = $request->getApiParas();
$fileFields = array();
foreach ($apiParams as $key => $value) {
if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
$value['name'] = $key;
$fileFields[$key] = $value;
unset($apiParams[$key]);
}
}
// $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
$requestUrl = substr($requestUrl, 0, -1);
//发起HTTP请求
try
{
if(count($fileFields) > 0){
$resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
}else{
if(DingTalkConstant::$METHOD_POST == $this->httpMethod){
$resp = $this->curl_json($requestUrl, $apiParams);
}else{
$resp = $this->curl_get($requestUrl, $apiParams);
}
}
}
catch (Exception $e)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
unset($apiParams);
unset($fileFields);
//解析TOP返回结果
$respWellFormed = false;
if ("json" == $this->format)
{
$respObject = json_decode($resp);
if (null !== $respObject)
{
$respWellFormed = true;
}
}
else if("xml" == $this->format)
{
$respObject = @simplexml_load_string($resp);
if (false !== $respObject)
{
$respWellFormed = true;
}
}
//返回的HTTP文本不是标准JSON或者XML记下错误日志
if (false === $respWellFormed)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
$result->code = 0;
$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
return $result;
}
//如果TOP返回了错误码记录到业务错误日志中
if (isset($respObject->code))
{
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . "_" . date("Y-m-d") . ".log";
$logger->log(array(
date("Y-m-d H:i:s"),
$resp
));
}
return $respObject;
}
private function getMillisecond() {
list($s1, $s2) = explode(' ', microtime());
return (float)sprintf('%.0f', (floatval($s1) + floatval($s2)) * 1000);
}
private function getCanonicalStringForIsv($timestamp, $suiteTicket) {
$result = $timestamp;
if($suiteTicket != null) {
$result .= "\n".$suiteTicket;
}
return $result;
}
private function computeSignature($accessSecret, $canonicalString){
$s = hash_hmac('sha256', $canonicalString, $accessSecret, true);
return base64_encode($s);
}
private function _execute($request, $session = null,$bestUrl = null)
{
$result = new ResultSet();
if($this->checkRequest) {
try {
$request->check();
} catch (Exception $e) {
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
}
//组装系统参数
$sysParams["v"] = $this->apiVersion;
$sysParams["format"] = $this->format;
$sysParams["method"] = $request->getApiMethodName();
$sysParams["timestamp"] = date("Y-m-d H:i:s");
if (null != $session)
{
$sysParams["session"] = $session;
}
$apiParams = array();
//获取业务参数
$apiParams = $request->getApiParas();
//系统参数放入GET请求串
if($bestUrl){
if(strpos($bestUrl,'?') === false){
$requestUrl = $bestUrl."?";
}else{
$requestUrl = $bestUrl;
}
$sysParams["partner_id"] = $this->getClusterTag();
}else{
$requestUrl = $this->gatewayUrl."?";
$sysParams["partner_id"] = $this->sdkVersion;
}
foreach ($sysParams as $sysParamKey => $sysParamValue)
{
// if(strcmp($sysParamKey,"timestamp") != 0)
$requestUrl .= "$sysParamKey=" . urlencode($sysParamValue) . "&";
}
$fileFields = array();
foreach ($apiParams as $key => $value) {
if(is_array($value) && array_key_exists('type',$value) && array_key_exists('content',$value) ){
$value['name'] = $key;
$fileFields[$key] = $value;
unset($apiParams[$key]);
}
}
// $requestUrl .= "timestamp=" . urlencode($sysParams["timestamp"]) . "&";
$requestUrl = substr($requestUrl, 0, -1);
//发起HTTP请求
try
{
if(count($fileFields) > 0){
$resp = $this->curl_with_memory_file($requestUrl, $apiParams, $fileFields);
}else{
$resp = $this->curl($requestUrl, $apiParams);
}
}
catch (Exception $e)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_ERROR_" . $e->getCode(),$e->getMessage());
$result->code = $e->getCode();
$result->msg = $e->getMessage();
return $result;
}
unset($apiParams);
unset($fileFields);
//解析TOP返回结果
$respWellFormed = false;
if ("json" == $this->format)
{
$respObject = json_decode($resp);
if (null !== $respObject)
{
$respWellFormed = true;
foreach ($respObject as $propKey => $propValue)
{
$respObject = $propValue;
}
}
}
else if("xml" == $this->format)
{
$respObject = @simplexml_load_string($resp);
if (false !== $respObject)
{
$respWellFormed = true;
}
}
//返回的HTTP文本不是标准JSON或者XML记下错误日志
if (false === $respWellFormed)
{
$this->logCommunicationError($sysParams["method"],$requestUrl,"HTTP_RESPONSE_NOT_WELL_FORMED",$resp);
$result->code = 0;
$result->msg = "HTTP_RESPONSE_NOT_WELL_FORMED";
return $result;
}
//如果TOP返回了错误码记录到业务错误日志中
if (isset($respObject->code))
{
$logger = new TopLogger;
$logger->conf["log_file"] = rtrim(TOP_SDK_WORK_DIR, '\\/') . '/' . "logs/top_biz_err_" . "_" . date("Y-m-d") . ".log";
$logger->log(array(
date("Y-m-d H:i:s"),
$resp
));
}
return $respObject;
}
public function exec($paramsArray)
{
if (!isset($paramsArray["method"]))
{
trigger_error("No api name passed");
}
$inflector = new LtInflector;
$inflector->conf["separator"] = ".";
$requestClassName = ucfirst($inflector->camelize(substr($paramsArray["method"], 7))) . "Request";
if (!class_exists($requestClassName))
{
trigger_error("No such dingtalk-api: " . $paramsArray["method"]);
}
$session = isset($paramsArray["session"]) ? $paramsArray["session"] : null;
$req = new $requestClassName;
foreach($paramsArray as $paraKey => $paraValue)
{
$inflector->conf["separator"] = "_";
$setterMethodName = $inflector->camelize($paraKey);
$inflector->conf["separator"] = ".";
$setterMethodName = "set" . $inflector->camelize($setterMethodName);
if (method_exists($req, $setterMethodName))
{
$req->$setterMethodName($paraValue);
}
}
return $this->execute($req, $session);
}
private function getClusterTag()
{
return substr($this->sdkVersion,0,11)."-cluster".substr($this->sdkVersion,11);
}
}

View File

@ -0,0 +1,18 @@
<?php
/**
* Created by PhpStorm.
* User: zuodeng
* Date: 2018/7/18
* Time: 上午11:31
*/
class DingTalkConstant
{
static $CALL_TYPE_OAPI = "oapi";
static $CALL_TYPE_TOP = "top";
static $METHOD_POST = "POST";
static $METHOD_GET = "GET";
static $FORMAT_JSON = "json";
static $FORMAT_XML = "xml";
}

View File

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

View File

@ -0,0 +1,50 @@
<?php
/**
* 百亿补贴信息
* @author auto create
*/
class BybtInfoDTO
{
/**
* 百亿补贴品牌logo
**/
public $bybt_brand_logo;
/**
* 百亿补贴专属券面额,仅限百亿补贴场景透出
**/
public $bybt_coupon_amount;
/**
* 商品的百亿补贴开始时间
**/
public $bybt_end_time;
/**
* 百亿补贴商品特征标签eg.今日发货、晚发补偿、限购一件等
**/
public $bybt_item_tags;
/**
* 全网对比参考价格
**/
public $bybt_lowest_price;
/**
* 百亿补贴白底图
**/
public $bybt_pic_url;
/**
* 百亿补贴页面实时价
**/
public $bybt_show_price;
/**
* 商品的百亿补贴结束时间
**/
public $bybt_start_time;
}
?>

View File

@ -0,0 +1,15 @@
<?php
/**
* data
* @author auto create
*/
class Data
{
/**
* data
**/
public $data;
}
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* 选品库详细信息
* @author auto create
*/
class FavoritesDetail
{
/**
* 选品库id
**/
public $favorites_id;
/**
* 选品库标题
**/
public $favorites_title;
}
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* 选品库信息
* @author auto create
*/
class FavoritesInfo
{
/**
* 选品库详细信息
**/
public $favorites_list;
/**
* 选品库总数量
**/
public $total_count;
}
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* 属性值feature
* @author auto create
*/
class Feature
{
/**
* 属性键
**/
public $attr_key;
/**
* 属性值
**/
public $attr_value;
}
?>

View File

@ -0,0 +1,560 @@
<?php
/**
* Item(商品)结构
* @author auto create
*/
class Item
{
/**
* 售后服务ID,该字段仅在taobao.item.get接口中返回
**/
public $after_sale_id;
/**
* 商品上传后的状态。onsale出售中instock库中
**/
public $approve_status;
/**
* 返点比例
**/
public $auction_point;
/**
* 代充商品类型。只有少数类目下的商品可以标记上此字段具体哪些类目可以上传可以通过taobao.itemcat.features.get获得。在代充商品的类目下不传表示不标记商品类型交易搜索中就不能通过标记搜到相关的交易了。可选类型time_card(点卡软件代充)fee_card(话费软件代充)
**/
public $auto_fill;
/**
* 自动重发,true/false
**/
public $auto_repost;
/**
* 商品级别的条形码
**/
public $barcode;
/**
* 基础色数据
**/
public $change_prop;
/**
* 天猫超市扩展字段,天猫超市专用。
**/
public $chaoshi_extends_info;
/**
* 支持3期、6期、12期免息
**/
public $charge_free_list;
/**
* 商品所属的叶子类目 id
**/
public $cid;
/**
* 货到付款运费模板ID
**/
public $cod_postage_id;
/**
* 属性值的备注格式pid:vid:备注信息1;pid2:vid2:备注信息2;
**/
public $cpv_memo;
/**
* Item的发布时间目前仅供taobao.item.add和taobao.item.get可用
**/
public $created;
/**
* 村淘特有商品级数据结构
**/
public $cuntao_item_specific;
/**
* 定制工具Id
**/
public $custom_made_type_id;
/**
* 下架时间格式yyyy-MM-dd HH:mm:ss
**/
public $delist_time;
/**
* 发货时间信息
**/
public $delivery_time;
/**
* 商品描述, 字数要大于5个字节小于25000个字节
**/
public $desc;
/**
* 宝贝描述规范化模块锚点信息
**/
public $desc_module_info;
/**
* 商品描述模块化模块列表由List转化成jsonArray存入后端逻辑验证通过拼装成模块内容+锚点导航后存入desc中。数据结构具体参见Item_Desc_Module
**/
public $desc_modules;
/**
* 商品url
**/
public $detail_url;
/**
* ems费用,格式5.00;单位:元;精确到:分
**/
public $ems_fee;
/**
* 快递费用,格式5.00;单位:元;精确到:分
**/
public $express_fee;
/**
* 宝贝特征值只有在Top支持的特征值才能保存到宝贝上
**/
public $features;
/**
* 食品安全信息,包括:生产许可证编号、产品标准号、厂名、厂址等
**/
public $food_security;
/**
* 运费承担方式,seller卖家承担buyer(买家承担)
**/
public $freight_payer;
/**
* 全球购商品采购地信息(地区/国家),代表全球购商品的产地信息。
**/
public $global_stock_country;
/**
* 全球购商品发货地,发货地现在有两种类型:&ldquo;国内&rdquo;&ldquo;海外及港澳台&rdquo;参数值为1时代表&ldquo;国内&rdquo;值为2时代表&ldquo;海外及港澳台&rdquo;
**/
public $global_stock_delivery_place;
/**
* 全球购商品卖家包税承诺当值为true时代表卖家承诺包税。
**/
public $global_stock_tax_free_promise;
/**
* 全球购商品采购地信息(库存类型),有两种库存类型:现货和代购;参数值为1时代表现货值为2时代表代购
**/
public $global_stock_type;
/**
* 支持会员打折,true/false
**/
public $has_discount;
/**
* 是否有发票,true/false
**/
public $has_invoice;
/**
* 橱窗推荐,true/false
**/
public $has_showcase;
/**
* 是否有保修,true/false
**/
public $has_warranty;
/**
* 商品id(注意iid近期即将废弃请用num_iid参数)
**/
public $iid;
/**
* 加价幅度。如果为0代表系统代理幅度。在竞拍中为了超越上一个出价会员需要在当前出价上增加金额这个金额就是加价幅度。卖家在发布宝贝的时候可以自定义加价幅度也可以让系统自动代理加价。系统自动代理加价的加价幅度随着当前出价金额的增加而增加我们建议会员使用系统自动代理加价并请买家在出价前看清楚加价幅度的具体金额。另外需要注意是此功能只适用于拍卖的商品。以下是系统自动代理加价幅度表当前价加价幅度 1-40 1 、41-100 2 、101-2005 、201-500 10、501-100115、001-200025、2001-500050、5001-1000010010001以上 200
**/
public $increment;
/**
* 用户内店宝贝装修模板id
**/
public $inner_shop_auction_template_id;
/**
* 针对当前商品的自定义属性值
**/
public $input_custom_cpv;
/**
* 用户自行输入的类目属性ID串。结构&quot;pid1,pid2,pid3&quot;,如:&quot;20000&quot;(表示品牌) 通常一个类目下用户可输入的关键属性不超过1个。
**/
public $input_pids;
/**
* 用户自行输入的子属性名和属性值,结构:&quot;父属性值;一级子属性名;一级子属性值;二级子属性名;自定义输入值,....&quot;,如:&ldquo;耐克;耐克系列;科比系列;科比系列;2K5&rdquo;input_str需要与input_pids一一对应通常一个类目下用户可输入的关键属性不超过1个。所有属性别名加起来不能超过 3999字节。
**/
public $input_str;
/**
* 是否是3D淘宝的商品
**/
public $is3_d;
/**
* true:商品是区域限售商品false:商品不是区域限售商品。
**/
public $is_area_sale;
/**
* 是否为达尔文挂接成功了的商品
**/
public $is_cspu;
/**
* 是否在外部网店显示
**/
public $is_ex;
/**
* 非分销商品0代销1经销2
**/
public $is_fenxiao;
/**
* 是否24小时闪电发货
**/
public $is_lightning_consignment;
/**
* 商品是否为先行赔付taobao.items.search和taobao.items.vip.search专用
**/
public $is_prepay;
/**
* 是否在淘宝显示
**/
public $is_taobao;
/**
* 是否定时上架商品
**/
public $is_timing;
/**
* 虚拟商品的状态字段
**/
public $is_virtual;
/**
* 标示商品是否为新品。值含义true-false-否。
**/
public $is_xinpin;
/**
* 商品图片列表(包括主图)。fields中只设置item_img可以返回ItemImg结构体中所有字段如果设置为item_img.id、item_img.url、item_img.position等形式就只会返回相应的字段
**/
public $item_imgs;
/**
* itemRectangleImgs
**/
public $item_rectangle_imgs;
/**
* 表示商品的体积用于按体积计费的运费模板。该值的单位为立方米m3。该值支持两种格式的设置格式1bulk:3,单位为立方米(m3),表示直接设置为商品的体积。格式2weight:10;breadth:10;height:10单位为米m
**/
public $item_size;
/**
* 商品的重量用于按重量计费的运费模板。注意单位为kg
**/
public $item_weight;
/**
* 商品无线主图
**/
public $item_wireless_imgs;
/**
* 门店大屏图
**/
public $large_screen_image_url;
/**
* 上架时间格式yyyy-MM-dd HH:mm:ss
**/
public $list_time;
/**
* 本地生活电子交易凭证业务,目前此字段只涉及到的信息为有效期:如果有效期为起止日期类型此值为2012-08-06,2012-08-16如果有效期为【购买成功日 至】类型则格式为2012-08-16如果有效期为天数类型则格式为3
**/
public $locality_life;
/**
* 商品所在地
**/
public $location;
/**
* 商品修改时间格式yyyy-MM-dd HH:mm:ss
**/
public $modified;
/**
* 宝贝主图视频的数据信息包括视频ID视频缩略图URL视频时长视频状态等信息。
**/
public $mpic_video;
/**
* 家装分阶段价格数据结构
**/
public $ms_payment;
/**
* 是否为新消保法中的7天无理由退货
**/
public $newprepay;
/**
* 卖家昵称
**/
public $nick;
/**
* 商品数量
**/
public $num;
/**
* 商品数字id
**/
public $num_iid;
/**
* 是否绑定o2o
**/
public $o2o_bind_service;
/**
* 是否淘1站商品
**/
public $one_station;
/**
* 商家外部编码(可与商家外部系统对接)
**/
public $outer_id;
/**
* 用户外店装修模板id
**/
public $outer_shop_auction_template_id;
/**
* 用于保存拍卖有关的信息
**/
public $paimai_info;
/**
* 周期销售库存
**/
public $period_sold_quantity;
/**
* 商品主图片地址
**/
public $pic_url;
/**
* 平邮费用,格式5.00;单位:元;精确到:分
**/
public $post_fee;
/**
* 宝贝所属的运费模板ID如果没有返回则说明没有使用运费模板
**/
public $postage_id;
/**
* 商品价格格式5.00;单位:元;精确到:分
**/
public $price;
/**
* 宝贝所属产品的id(可能为空). 该字段可以通过taobao.products.search 得到
**/
public $product_id;
/**
* 消保类型,多个类型以,分割。可取以下值2假一赔三47天无理由退换货taobao.items.search和taobao.items.vip.search专用
**/
public $promoted_service;
/**
* 商品属性图片列表。fields中只设置prop_img可以返回PropImg结构体中所有字段如果设置为prop_img.id、prop_img.url、prop_img.properties、prop_img.position等形式就只会返回相应的字段
**/
public $prop_imgs;
/**
* 属性值别名
**/
public $property_alias;
/**
* 商品属性 格式pid:vid;pid:vid
**/
public $props;
/**
* 商品属性名称。标识着props内容里面的pid和vid所对应的名称。格式为pid1:vid1:pid_name1:vid_name1;pid2:vid2:pid_name2:vid_name2&hellip;&hellip;(<strong>注:</strong><font color="red">属性名称中的冒号&quot;:&quot;被转换为:&quot;#cln#&quot;; 分号&quot;;&quot;被转换为:&quot;#scln#&quot;</font>)
**/
public $props_name;
/**
* 商品资质的信息用URLEncoder做过转换使用时需要URLDecoder转换回来默认字符集为UTF-8
**/
public $qualification;
/**
* 商品所属卖家的信用等级数1表示1心2表示2心&hellip;&hellip;,只有调用商品搜索:taobao.items.get和taobao.items.search的时候才能返回
**/
public $score;
/**
* 秒杀商品类型。打上秒杀标记的商品用户只能下架并不能再上架其他任何编辑或删除操作都不能进行。如果用户想取消秒杀标记需要联系小二进行操作。如果秒杀结束需要自由编辑请联系活动负责人小二去掉秒杀标记。可选类型web_only(只能通过web网络秒杀)wap_only(只能通过wap网络秒杀)web_and_wap(既能通过web秒杀也能通过wap秒杀)
**/
public $second_kill;
/**
* 商品卖点信息天猫商家使用字段最长150个字符。
**/
public $sell_point;
/**
* 是否承诺退换货服务!
**/
public $sell_promise;
/**
* 商品所属的店铺内卖家自定义类目列表
**/
public $seller_cids;
/**
* Sku列表。fields中只设置sku可以返回Sku结构体中所有字段如果设置为sku.sku_id、sku.properties、sku.quantity等形式就只会返回相应的字段
**/
public $skus;
/**
* 商品销量
**/
public $sold_quantity;
/**
* 手机类目spu 确认信息字段
**/
public $spu_confirm;
/**
* 商品新旧程度(全新:new,闲置:unused二手second)
**/
public $stuff_status;
/**
* 商品是否支持拍下减库存:1支持;2取消支持(付款减库存);0(默认)不更改 集市卖家默认拍下减库存; 商城卖家默认付款减库存
**/
public $sub_stock;
/**
* 是否支持分期免息
**/
public $support_charge_free;
/**
* 页面模板id
**/
public $template_id;
/**
* 商品标题,不能超过60字节
**/
public $title;
/**
* 商品类型(fixed:一口价;auction:拍卖)注:取消团购
**/
public $type;
/**
* 有效期,7或者14默认是14天
**/
public $valid_thru;
/**
* 商品竖图
**/
public $vertical_imgs;
/**
* 该字段废弃,请勿使用。
**/
public $video_id;
/**
* 商品视频列表(目前只支持单个视频关联)。fields中只设置video可以返回Video结构体中所有字段如果设置为video.id、video.video_id、video.url等形式就只会返回相应的字段
**/
public $videos;
/**
* 商品是否违规违规true , 不违规false
**/
public $violation;
/**
* 商品30天交易量只有调用商品搜索:taobao.items.get和taobao.items.search的时候才能返回
**/
public $volume;
/**
* 不带html标签的desc文本信息该字段只在taobao.item.get接口中返回
**/
public $wap_desc;
/**
* 适合wap应用的商品详情url 该字段只在taobao.item.get接口中返回
**/
public $wap_detail_url;
/**
* 白底图URL
**/
public $white_bg_image;
/**
* 无线的宝贝描述
**/
public $wireless_desc;
/**
* 预扣库存,即付款减库存的商品现在有多少处于未付款状态的订单
**/
public $with_hold_quantity;
/**
* 商品所属的商家的旺旺在线状况taobao.items.search和taobao.items.vip.search专用
**/
public $ww_status;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 商品图片结构
* @author auto create
*/
class ItemImg
{
/**
* 图片创建时间 时间格式yyyy-MM-dd HH:mm:ss
**/
public $created;
/**
* 商品图片的id和商品相对应主图id默认为0
**/
public $id;
/**
* 图片放在第几张(多图时可设置)
**/
public $position;
/**
* 图片链接地址
**/
public $url;
}
?>

View File

@ -0,0 +1,29 @@
<?php
/**
* KFC 关键词过滤匹配结果
* @author auto create
*/
class KfcSearchResult
{
/**
* 过滤后的文本:
当匹配到B等级的词时文本中的关键词被替换为*content即为关键词替换后的文本
其他情况content始终为null
**/
public $content;
/**
* 匹配到的关键词的等级值为null或为A、B、C、D。
当匹配不到关键词时值为null否则值为A、B、C、D中的一个。
A、B、C、D等级按严重程度从高至低排列。
**/
public $level;
/**
* 是否匹配到关键词,匹配到则为true.
**/
public $matched;
}
?>

View File

@ -0,0 +1,40 @@
<?php
/**
* 用户地址
* @author auto create
*/
class Location
{
/**
* 详细地址最大256个字节128个中文
**/
public $address;
/**
* 所在城市(中文名称)
**/
public $city;
/**
* 国家名称
**/
public $country;
/**
* /只适用于物流API
**/
public $district;
/**
* 所在省份(中文名称)
**/
public $state;
/**
* 邮政编码
**/
public $zip;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 猫超买返卡信息
* @author auto create
*/
class MaifanPromotionDTO
{
/**
* 猫超买返卡总数,-1代表不限量其他大于等于0的值为总数
**/
public $maifan_promotion_condition;
/**
* 猫超买返卡面额
**/
public $maifan_promotion_discount;
/**
* 猫超买返卡活动结束时间
**/
public $maifan_promotion_end_time;
/**
* 猫超买返卡活动开始时间
**/
public $maifan_promotion_start_time;
}
?>

View File

@ -0,0 +1,75 @@
<?php
/**
* resultList
* @author auto create
*/
class MapData
{
/**
* 优惠门槛类型: 1 满元 2 满件
**/
public $condition_type;
/**
* 优惠类型: 1 减钱 2 打折
**/
public $discount_type;
/**
* 权益信息展示结束时间,精确到毫秒时间戳
**/
public $display_end_time;
/**
* 权益信息展示开始时间,精确到毫秒时间戳
**/
public $display_start_time;
/**
* 店铺信息-卖家昵称
**/
public $nick;
/**
* 权益扩展信息
**/
public $promotion_extend;
/**
* 权益信息
**/
public $promotion_list;
/**
* 权益类型。1 有价券(需要购买的店铺券或单品券) 2 公开券(直接领取的店铺券或单品券) 3 妈妈券(妈妈渠道领取的店铺券或单品券) 4.品类券 跨店可用券可与123叠加
**/
public $promotion_type;
/**
* 权益信息-剩余库存(权益剩余库存量)
**/
public $remain_count;
/**
* 店铺信息-卖家ID
**/
public $seller_id;
/**
* 店铺信息-店铺logo
**/
public $shop_picture_url;
/**
* 店铺信息-店铺名称
**/
public $shop_title;
/**
* 权益信息-总量(权益初始库存量)
**/
public $total_count;
}
?>

View File

@ -0,0 +1,220 @@
<?php
/**
* 淘宝客商品
* @author auto create
*/
class NTbkItem
{
/**
* 叶子类目名称
**/
public $cat_leaf_name;
/**
* 一级类目名称
**/
public $cat_name;
/**
* 是否包邮
**/
public $free_shipment;
/**
* 好评率是否高于行业均值
**/
public $h_good_rate;
/**
* 成交转化是否高于行业均值
**/
public $h_pay_rate30;
/**
* 是否是热门商品0不是1是
**/
public $hot_flag;
/**
* 退款率是否低于行业均值
**/
public $i_rfd_rate;
/**
* 入参的商品ID
**/
public $input_num_iid;
/**
* 是否加入消费者保障
**/
public $is_prepay;
/**
* 商品链接
**/
public $item_url;
/**
* 聚划算信息-聚淘结束时间(毫秒)
**/
public $ju_online_end_time;
/**
* 聚划算信息-聚淘开始时间(毫秒)
**/
public $ju_online_start_time;
/**
* 聚划算满减 -结束时间(毫秒)
**/
public $ju_play_end_time;
/**
* 聚划算满减 -开始时间(毫秒)
**/
public $ju_play_start_time;
/**
* 聚划算信息-商品预热结束时间(毫秒)
**/
public $ju_pre_show_end_time;
/**
* 聚划算信息-商品预热开始时间(毫秒)
**/
public $ju_pre_show_start_time;
/**
* 跨店满减信息
**/
public $kuadian_promotion_info;
/**
* 商品库类型,支持多库类型输出,以英文逗号分隔“,”分隔1:营销商品主推库如果值为空则不属于1这种商品类型
**/
public $material_lib_type;
/**
* 店铺名称
**/
public $nick;
/**
* 商品ID
**/
public $num_iid;
/**
* 商品主图
**/
public $pict_url;
/**
* 1聚划算满减满N件减X元满N件X折满N件X元 2天猫限时抢前N分钟每件X元前N分钟满N件每件X元前N件每件X元
**/
public $play_info;
/**
* 预售商品-定金(元)
**/
public $presale_deposit;
/**
* 预售商品-商品优惠信息
**/
public $presale_discount_fee_text;
/**
* 预售商品-付定金结束时间(毫秒)
**/
public $presale_end_time;
/**
* 预售商品-付定金开始时间(毫秒)
**/
public $presale_start_time;
/**
* 预售商品-付定金结束时间(毫秒)
**/
public $presale_tail_end_time;
/**
* 预售商品-付尾款开始时间(毫秒)
**/
public $presale_tail_start_time;
/**
* 商品所在地
**/
public $provcity;
/**
* 卖家等级
**/
public $ratesum;
/**
* 商品一口价格
**/
public $reserve_price;
/**
* 活动价
**/
public $sale_price;
/**
* 卖家id
**/
public $seller_id;
/**
* 店铺dsr 评分
**/
public $shop_dsr;
/**
* 商品小图列表
**/
public $small_images;
/**
* 是否品牌精选0不是1是
**/
public $superior_brand;
/**
* 商品标题
**/
public $title;
/**
* 天猫限时抢可售 -结束时间(毫秒)
**/
public $tmall_play_activity_end_time;
/**
* 天猫限时抢可售 -开始时间(毫秒)
**/
public $tmall_play_activity_start_time;
/**
* 卖家类型0表示集市1表示商城3表示特价版
**/
public $user_type;
/**
* 30天销量
**/
public $volume;
/**
* 折扣价(元) 若属于预售商品,付定金时间内,折扣价=预售价
**/
public $zk_final_price;
}
?>

View File

@ -0,0 +1,45 @@
<?php
/**
* oauthOtherInfo
* @author auto create
*/
class OAuthOtherInfo
{
/**
* access_token
**/
public $access_token;
/**
* avatarUrl
**/
public $avatar_url;
/**
* id
**/
public $id;
/**
* nick
**/
public $nick;
/**
* 三方平台的openId
**/
public $open_id;
/**
* 三方平台类型
**/
public $platform_type;
/**
* 三方平台的unionId
**/
public $union_id;
}
?>

View File

@ -0,0 +1,170 @@
<?php
/**
* Open Account模型
* @author auto create
*/
class OpenAccount
{
/**
* 支付宝的帐号标识
**/
public $alipay_id;
/**
* 头像url
**/
public $avatar_url;
/**
* 银行卡号
**/
public $bank_card_no;
/**
* 银行卡的拥有者姓名
**/
public $bank_card_owner_name;
/**
* 出生日期
**/
public $birthday;
/**
* 创建帐号的App Key
**/
public $create_app_key;
/**
* 帐号创建的设备的ID
**/
public $create_device_id;
/**
* 账号创建时的位置
**/
public $create_location;
/**
* 展示名
**/
public $display_name;
/**
* 数据域
**/
public $domain_id;
/**
* 邮箱
**/
public $email;
/**
* 自定义扩展信息Map的Json格式
**/
public $ext_infos;
/**
* 1 2
**/
public $gender;
/**
* 记录创建时间
**/
public $gmt_create;
/**
* 记录上次更新时间
**/
public $gmt_modified;
/**
* Open Account Id
**/
public $id;
/**
* 开发者自定义账号id
**/
public $isv_account_id;
/**
* 地区
**/
public $locale;
/**
* 登录名
**/
public $login_id;
/**
* 密码
**/
public $login_pwd;
/**
* 加密算法类型1、代表单纯MD52代表单一Salt的MD53、代表根据记录不同后的MD5
**/
public $login_pwd_encryption;
/**
* 密码加密强度
**/
public $login_pwd_intensity;
/**
* 密码salt
**/
public $login_pwd_salt;
/**
* 手机
**/
public $mobile;
/**
* 姓名
**/
public $name;
/**
* TAOBAO = 1;WEIXIN = 2;WEIBO = 3;QQ = 4;
**/
public $oauth_plateform;
/**
* 第三方oauth openid
**/
public $open_id;
/**
* 账号状态1、启用2、删除3、禁用
**/
public $status;
/**
* 账号创建类型1、通过短信创建2、ISV批量导入3、ISV OAuth创建
**/
public $type;
/**
* 记录的版本号
**/
public $version;
/**
* 旺旺
**/
public $wangwang;
/**
* 微信
**/
public $weixin;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 结果
* @author auto create
*/
class OpenAccountResult
{
/**
* 错误码
**/
public $code;
/**
* Open Account信息
**/
public $data;
/**
* 错误信息
**/
public $message;
/**
* 是否成功
**/
public $successful;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 搜索查询返回结果
* @author auto create
*/
class OpenAccountSearchResult
{
/**
* 状态码
**/
public $code;
/**
* OpenAccount的列表
**/
public $datas;
/**
* 状态信息
**/
public $message;
/**
* 查询是否成功,成功返回时有可能数据为空
**/
public $successful;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 返回的token结果
* @author auto create
*/
class OpenAccountTokenApplyResult
{
/**
* 错误码
**/
public $code;
/**
* token
**/
public $data;
/**
* 错误信息
**/
public $message;
/**
* 是否成功
**/
public $successful;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 验证成功返回token中的信息
* @author auto create
*/
class OpenAccountTokenValidateResult
{
/**
* 错误码
**/
public $code;
/**
* token中的数据
**/
public $data;
/**
* 错误信息
**/
public $message;
/**
* 是否成功
**/
public $successful;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* Open Account模型
* @author auto create
*/
class OpenaccountLong
{
/**
* 返回码
**/
public $code;
/**
* 返回数据
**/
public $data;
/**
* 返回信息
**/
public $message;
/**
* 是否成功
**/
public $successful;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* Open Account模型
* @author auto create
*/
class OpenaccountObject
{
/**
* 错误码
**/
public $code;
/**
* 返回数据
**/
public $data;
/**
* 返回信息
**/
public $message;
/**
* 是否成功
**/
public $successful;
}
?>

View File

@ -0,0 +1,25 @@
<?php
/**
* Open Account模型
* @author auto create
*/
class OpenaccountVoid
{
/**
* 错误码
**/
public $code;
/**
* 返回信息
**/
public $message;
/**
* 是否成功
**/
public $successful;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 复购订单,仅适用于手淘拉新
* @author auto create
*/
class OrderData
{
/**
* 预估佣金
**/
public $commission;
/**
* 收货时间
**/
public $confirm_receive_time;
/**
* 订单号
**/
public $order_no;
/**
* 支付时间
**/
public $pay_time;
}
?>

View File

@ -0,0 +1,137 @@
<?php
/**
* 返回product数据结构中的product_id,modified
* @author auto create
*/
class Product
{
/**
* 产品的非关键属性列表.格式:pid:vid;pid:vid.
**/
public $binds;
/**
* 产品的非关键属性字符串列表.格式同props_str(<strong>注:</strong><font color="red">属性名称中的冒号":"被转换为:"#cln#";
分号";"被转换为:"#scln#"
</font>)
**/
public $binds_str;
/**
* 商品类目名称
**/
public $cat_name;
/**
* 商品类目ID.必须是叶子类目ID
**/
public $cid;
/**
* 创建时间.格式:yyyy-mm-dd hh:mm:ss
**/
public $created;
/**
* 用户自定义属性,结构pid1:value1;pid2:value2 例如“20000:优衣库”,表示“品牌:优衣库”
**/
public $customer_props;
/**
* 产品的描述.最大25000个字节
**/
public $desc;
/**
* 修改时间.格式:yyyy-mm-dd hh:mm:ss
**/
public $modified;
/**
* 产品名称
**/
public $name;
/**
* 外部产品ID
**/
public $outer_id;
/**
* 产品的主图片地址.(绝对地址,格式:http://host/image_path)
**/
public $pic_url;
/**
* 产品的市场价.单位为元.精确到2位小数;:200.07
**/
public $price;
/**
* 产品ID
**/
public $product_id;
/**
* 产品的子图片.目前最多支持4张。fields中设置为product_imgs.id、product_imgs.url、product_imgs.position 等形式就会返回相应的字段
**/
public $product_imgs;
/**
* 产品的属性图片.比如说黄色对应的产品图片,绿色对应的产品图片。fields中设置为product_prop_imgs.id、
product_prop_imgs.props、product_prop_imgs.url、product_prop_imgs.position等形式就会返回相应的字段
**/
public $product_prop_imgs;
/**
* 销售属性值别名。格式为pid1:vid1:alias1;pid1:vid2:alia2。
**/
public $property_alias;
/**
* 产品的关键属性列表.格式pid:vid;pid:vid
**/
public $props;
/**
* 产品的关键属性字符串列表.比如:品牌:诺基亚;型号:N73(<strong>注:</strong><font color="red">属性名称中的冒号":"被转换为:"#cln#";
分号";"被转换为:"#scln#"
</font>)
**/
public $props_str;
/**
* 产品的销售属性列表.格式:pid:vid;pid:vid
**/
public $sale_props;
/**
* 产品的销售属性字符串列表.格式同props_str(<strong>注:</strong><font color="red">属性名称中的冒号":"被转换为:"#cln#";
分号";"被转换为:"#scln#"
</font>)
**/
public $sale_props_str;
/**
* 产品卖点描述长度限制20个汉字
**/
public $sell_pt;
/**
* 当前状态(0 商家确认 1 屏蔽 3 小二确认 2 未确认 -1 删除)
**/
public $status;
/**
* 淘宝标准产品编码
**/
public $tsc;
/**
* 垂直市场,33C4鞋城
**/
public $vertical_market;
}
?>

View File

@ -0,0 +1,40 @@
<?php
/**
* 返回产品图片结构中的url,id,created,modified
* @author auto create
*/
class ProductImg
{
/**
* 添加时间.格式:yyyy-mm-dd hh:mm:ss
**/
public $created;
/**
* 产品图片ID
**/
public $id;
/**
* 修改时间.格式:yyyy-mm-dd hh:mm:ss
**/
public $modified;
/**
* 图片序号。产品里的图片展示顺序,数据越小越靠前。要求是正整数。
**/
public $position;
/**
* 图片所属产品的ID
**/
public $product_id;
/**
* 图片地址.(绝对地址,格式:http://host/image_path)
**/
public $url;
}
?>

View File

@ -0,0 +1,46 @@
<?php
/**
* 产品的属性图片.比如说黄色对应的产品图片,绿色对应的产品图片。fields中设置为product_prop_imgs.id、
product_prop_imgs.props、product_prop_imgs.url、product_prop_imgs.position等形式就会返回相应的字段
* @author auto create
*/
class ProductPropImg
{
/**
* 添加时间.格式:yyyy-mm-dd hh:mm:ss
**/
public $created;
/**
* 产品属性图片ID
**/
public $id;
/**
* 修改时间.格式:yyyy-mm-dd hh:mm:ss
**/
public $modified;
/**
* 图片序号。产品里的图片展示顺序,数据越小越靠前。要求是正整数。
**/
public $position;
/**
* 图片所属产品的ID
**/
public $product_id;
/**
* 属性串(pid:vid),目前只有颜色属性.:颜色:红色表示为 1627207:28326
**/
public $props;
/**
* 图片地址.(绝对地址,格式:http://host/image_path)
**/
public $url;
}
?>

View File

@ -0,0 +1,25 @@
<?php
/**
* 权益扩展信息
* @author auto create
*/
class PromotionExtend
{
/**
* 权益链接
**/
public $promotion_url;
/**
* 权益推荐商品
**/
public $recommend_item_list;
/**
* 有价券信息
**/
public $youjia_coupon_info;
}
?>

View File

@ -0,0 +1,30 @@
<?php
/**
* 权益信息
* @author auto create
*/
class PromotionList
{
/**
* 权益起用门槛满X元可用券场景为满元精确到分如满100元可用
**/
public $entry_condition;
/**
* 权益面额,券场景为减钱,精确到分
**/
public $entry_discount;
/**
* 权益结束时间,精确到毫秒时间戳
**/
public $entry_used_end_time;
/**
* 权益开始时间,精确到毫秒时间戳
**/
public $entry_used_start_time;
}
?>

View File

@ -0,0 +1,35 @@
<?php
/**
* 商品属性图片结构
* @author auto create
*/
class PropImg
{
/**
* 图片创建时间 时间格式yyyy-MM-dd HH:mm:ss
**/
public $created;
/**
* 属性图片的id和商品相对应
**/
public $id;
/**
* 图片放在第几张(多图时可设置)
**/
public $position;
/**
* 图片所对应的属性组合的字符串
**/
public $properties;
/**
* 图片链接地址
**/
public $url;
}
?>

View File

@ -0,0 +1,60 @@
<?php
/**
* 属性值
* @author auto create
*/
class PropValue
{
/**
* 类目ID
**/
public $cid;
/**
* 属性值feature
**/
public $features;
/**
* 是否为父类目属性
**/
public $is_parent;
/**
* 属性值
**/
public $name;
/**
* 属性值别名
**/
public $name_alias;
/**
* 属性 ID
**/
public $pid;
/**
* 属性名
**/
public $prop_name;
/**
* 排列序号。取值范围:大于零的整数
**/
public $sort_order;
/**
* 状态。可选值:normal(正常),deleted(删除)
**/
public $status;
/**
* 属性值ID
**/
public $vid;
}
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* 权益推荐商品
* @author auto create
*/
class RecommendItemList
{
/**
* 权益推荐商品id
**/
public $item_id;
/**
* 商品链接
**/
public $url;
}
?>

View File

@ -0,0 +1,15 @@
<?php
/**
* data
* @author auto create
*/
class Results
{
/**
* data
**/
public $data;
}
?>

View File

@ -0,0 +1,120 @@
<?php
/**
* Sku列表
* @author auto create
*/
class Sku
{
/**
* 商品级别的条形码
**/
public $barcode;
/**
* 基础色数据
**/
public $change_prop;
/**
* sku创建日期 时间格式yyyy-MM-dd HH:mm:ss
**/
public $created;
/**
* skuDeliveryTimeType
**/
public $delivery_time_type;
/**
* 扩展sku的id
**/
public $extra_id;
/**
*
**/
public $gmt_modified;
/**
* sku所属商品id(注意iid近期即将废弃请用num_iid参数)
**/
public $iid;
/**
* 扩展sku的备注信息
**/
public $memo;
/**
* sku最后修改日期 时间格式yyyy-MM-dd HH:mm:ss
**/
public $modified;
/**
* sku所属商品数字id
**/
public $num_iid;
/**
* 商家设置的外部id。天猫和集市的卖家需要登录才能获取到自己的商家编码不能获取到他人的商家编码。
**/
public $outer_id;
/**
* 属于这个sku的商品的价格 取值范围:0-100000000;精确到2位小数;单位:元。如:200.07,表示:200元7分。
**/
public $price;
/**
* sku的销售属性组合字符串颜色大小等等可通过类目API获取某类目下的销售属性,格式是p1:v1;p2:v2
**/
public $properties;
/**
* sku所对应的销售属性的中文名字串格式如pid1:vid1:pid_name1:vid_name1;pid2:vid2:pid_name2:vid_name2……
**/
public $properties_name;
/**
* 属于这个sku的商品的数量
**/
public $quantity;
/**
* sku级别发货时间
**/
public $sku_delivery_time;
/**
* skuFeature
**/
public $sku_feature;
/**
* sku的id
**/
public $sku_id;
/**
* 表示SKu上的产品规格信息
**/
public $sku_spec_id;
/**
* specId
**/
public $spec_id;
/**
* sku状态。 normal:正常 delete:删除
**/
public $status;
/**
* 商品在付款减库存的状态下该sku上未付款的订单数量
**/
public $with_hold_quantity;
}
?>

View File

@ -0,0 +1,40 @@
<?php
/**
* 定向计划集合
* @author auto create
*/
class SpCampaign
{
/**
* 定向计划申请链接
**/
public $sp_apply_link;
/**
* 定向计划活动ID
**/
public $sp_cid;
/**
* 定向是否锁佣0=不锁佣 1=锁佣
**/
public $sp_lock_status;
/**
* 定向计划名称
**/
public $sp_name;
/**
* 定向佣金率
**/
public $sp_rate;
/**
* 定向计划是否可用 1-可用 0-不可用
**/
public $sp_status;
}
?>

View File

@ -0,0 +1,40 @@
<?php
/**
* token中的数据
* @author auto create
*/
class TokenInfo
{
/**
* token info扩展信息
**/
public $ext;
/**
* isv自己账号的唯一id
**/
public $isv_account_id;
/**
* ISV APP的登录态时长
**/
public $login_state_expire_in;
/**
* open account id
**/
public $open_account_id;
/**
* 时间戳
**/
public $timestamp;
/**
* 用于防重放的唯一id
**/
public $uuid;
}
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* token info扩展信息
* @author auto create
*/
class TokenInfoExt
{
/**
* oauthOtherInfo
**/
public $oauth_other_info;
/**
* open account当前token info中open account id对应的open account信息
**/
public $open_account;
}
?>

View File

@ -0,0 +1,25 @@
<?php
/**
* results
* @author auto create
*/
class TopDownloadRecordDo
{
/**
* 文件创建时间
**/
public $created;
/**
* 下载链接状态。1:未下载。2:已下载
**/
public $status;
/**
* 下载链接
**/
public $url;
}
?>

View File

@ -0,0 +1,35 @@
<?php
/**
* 前N件佣金信息-前N件佣金生效或预热时透出以下字段
* @author auto create
*/
class TopNInfoDTO
{
/**
* 前N件佣金结束时间
**/
public $topn_end_time;
/**
* 前N件剩余库存
**/
public $topn_quantity;
/**
* 前N件佣金率
**/
public $topn_rate;
/**
* 前N件佣金开始时间
**/
public $topn_start_time;
/**
* 前N件初始总库存
**/
public $topn_total_count;
}
?>

View File

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

View File

@ -0,0 +1,45 @@
<?php
/**
* 商品视频关联记录
* @author auto create
*/
class Video
{
/**
* 视频关联记录创建时间格式yyyy-MM-dd HH:mm:ss
**/
public $created;
/**
* 视频关联记录的id和商品相对应
**/
public $id;
/**
* 视频记录关联的商品的数字id(注意iid近期即将废弃请用num_iid参数)
**/
public $iid;
/**
* 视频关联记录修改时间格式yyyy-MM-dd HH:mm:ss
**/
public $modified;
/**
* 视频记录所关联的商品的数字id
**/
public $num_iid;
/**
* video的url连接地址。淘秀里视频记录里面存储的url地址
**/
public $url;
/**
* video的id对应于视频在淘秀的存储记录
**/
public $video_id;
}
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* 商品信息-商品关联词
* @author auto create
*/
class WordMapData
{
/**
* 链接-商品相关关联词落地页地址
**/
public $url;
/**
* 商品相关的关联词
**/
public $word;
}
?>

View File

@ -0,0 +1,20 @@
<?php
/**
* 有价券信息
* @author auto create
*/
class Youjiacouponinfo
{
/**
* 有价券商品id
**/
public $item_id;
/**
* 商品链接
**/
public $url;
}
?>

View File

@ -0,0 +1,32 @@
<?php
/**
* TOP API: taobao.appip.get request
*
* @author auto create
* @since 1.0, 2022.09.19
*/
class AppipGetRequest
{
private $apiParas = array();
public function getApiMethodName()
{
return "taobao.appip.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,48 @@
<?php
/**
* TOP API: taobao.areas.get request
*
* @author auto create
* @since 1.0, 2022.05.25
*/
class AreasGetRequest
{
/**
* 需返回的字段列表.可选值:Area 结构中的所有字段;多个字段之间用","分隔.:id,type,name,parent_id,zip.
**/
private $fields;
private $apiParas = array();
public function setFields($fields)
{
$this->fields = $fields;
$this->apiParas["fields"] = $fields;
}
public function getFields()
{
return $this->fields;
}
public function getApiMethodName()
{
return "taobao.areas.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->fields,"fields");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.login request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountLoginRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.login";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.loginbytoken request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountLoginbytokenRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.loginbytoken";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.logindoublecheck request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountLogindoublecheckRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.logindoublecheck";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.newlogindoublecheck request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountNewlogindoublecheckRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.newlogindoublecheck";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.password.reset request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountPasswordResetRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.password.reset";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.register request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountRegisterRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.register";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.registercode.check request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountRegistercodeCheckRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.registercode.check";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.registercode.send request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountRegistercodeSendRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.registercode.send";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.resetcode.check request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountResetcodeCheckRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.resetcode.check";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.openaccount.resetcode.send request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOpenaccountResetcodeSendRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.openaccount.resetcode.send";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.orderurl.get request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanOrderurlGetRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.orderurl.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.payresult.query request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanPayresultQueryRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.payresult.query";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.taoke.trace request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanTaokeTraceRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.taoke.trace";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.user.login request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanUserLoginRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.user.login";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.user.loginbytoken request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanUserLoginbytokenRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.user.loginbytoken";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* TOP API: taobao.baichuan.user.logindoublecheck request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class BaichuanUserLogindoublecheckRequest
{
/**
* name
**/
private $name;
private $apiParas = array();
public function setName($name)
{
$this->name = $name;
$this->apiParas["name"] = $name;
}
public function getName()
{
return $this->name;
}
public function getApiMethodName()
{
return "taobao.baichuan.user.logindoublecheck";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* TOP API: taobao.cloudpush.message.android request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class CloudpushMessageAndroidRequest
{
/**
* 发送的消息内容.
**/
private $body;
/**
* 推送目标: device:推送给设备; account:推送给指定帐号,all: 推送给全部
**/
private $target;
/**
* 根据Target来设定如Target=device, 则对应的值为 设备id1,设备id2. 多个值使用逗号分隔
**/
private $targetValue;
private $apiParas = array();
public function setBody($body)
{
$this->body = $body;
$this->apiParas["body"] = $body;
}
public function getBody()
{
return $this->body;
}
public function setTarget($target)
{
$this->target = $target;
$this->apiParas["target"] = $target;
}
public function getTarget()
{
return $this->target;
}
public function setTargetValue($targetValue)
{
$this->targetValue = $targetValue;
$this->apiParas["target_value"] = $targetValue;
}
public function getTargetValue()
{
return $this->targetValue;
}
public function getApiMethodName()
{
return "taobao.cloudpush.message.android";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->body,"body");
RequestCheckUtil::checkNotNull($this->target,"target");
RequestCheckUtil::checkNotNull($this->targetValue,"targetValue");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,82 @@
<?php
/**
* TOP API: taobao.cloudpush.message.ios request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class CloudpushMessageIosRequest
{
/**
* 发送的消息内容.
**/
private $body;
/**
* 推送目标: device:推送给设备; account:推送给指定帐号,all: 推送给全部
**/
private $target;
/**
* 根据Target来设定如Target=device, 则对应的值为 设备id1,设备id2. 多个值使用逗号分隔
**/
private $targetValue;
private $apiParas = array();
public function setBody($body)
{
$this->body = $body;
$this->apiParas["body"] = $body;
}
public function getBody()
{
return $this->body;
}
public function setTarget($target)
{
$this->target = $target;
$this->apiParas["target"] = $target;
}
public function getTarget()
{
return $this->target;
}
public function setTargetValue($targetValue)
{
$this->targetValue = $targetValue;
$this->apiParas["target_value"] = $targetValue;
}
public function getTargetValue()
{
return $this->targetValue;
}
public function getApiMethodName()
{
return "taobao.cloudpush.message.ios";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->body,"body");
RequestCheckUtil::checkNotNull($this->target,"target");
RequestCheckUtil::checkNotNull($this->targetValue,"targetValue");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,99 @@
<?php
/**
* TOP API: taobao.cloudpush.notice.android request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class CloudpushNoticeAndroidRequest
{
/**
* 通知摘要
**/
private $summary;
/**
* 推送目标: device:推送给设备; account:推送给指定帐号,all: 推送给全部
**/
private $target;
/**
* 根据Target来设定如Target=device, 则对应的值为 设备id1,设备id2. 多个值使用逗号分隔
**/
private $targetValue;
/**
* 通知的标题.
**/
private $title;
private $apiParas = array();
public function setSummary($summary)
{
$this->summary = $summary;
$this->apiParas["summary"] = $summary;
}
public function getSummary()
{
return $this->summary;
}
public function setTarget($target)
{
$this->target = $target;
$this->apiParas["target"] = $target;
}
public function getTarget()
{
return $this->target;
}
public function setTargetValue($targetValue)
{
$this->targetValue = $targetValue;
$this->apiParas["target_value"] = $targetValue;
}
public function getTargetValue()
{
return $this->targetValue;
}
public function setTitle($title)
{
$this->title = $title;
$this->apiParas["title"] = $title;
}
public function getTitle()
{
return $this->title;
}
public function getApiMethodName()
{
return "taobao.cloudpush.notice.android";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->summary,"summary");
RequestCheckUtil::checkNotNull($this->target,"target");
RequestCheckUtil::checkNotNull($this->targetValue,"targetValue");
RequestCheckUtil::checkNotNull($this->title,"title");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,115 @@
<?php
/**
* TOP API: taobao.cloudpush.notice.ios request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class CloudpushNoticeIosRequest
{
/**
* iOS的通知是通过APNS中心来发送的需要填写对应的环境信息. DEV:表示开发环境, PRODUCT: 表示生产环境.
**/
private $env;
/**
* 提供给IOS通知的扩展属性如角标或者声音等,注意参数值为json
**/
private $ext;
/**
* 通知摘要
**/
private $summary;
/**
* 推送目标: device:推送给设备; account:推送给指定帐号,all: 推送给全部
**/
private $target;
/**
* 根据Target来设定如Target=device, 则对应的值为 设备id1,设备id2. 多个值使用逗号分隔
**/
private $targetValue;
private $apiParas = array();
public function setEnv($env)
{
$this->env = $env;
$this->apiParas["env"] = $env;
}
public function getEnv()
{
return $this->env;
}
public function setExt($ext)
{
$this->ext = $ext;
$this->apiParas["ext"] = $ext;
}
public function getExt()
{
return $this->ext;
}
public function setSummary($summary)
{
$this->summary = $summary;
$this->apiParas["summary"] = $summary;
}
public function getSummary()
{
return $this->summary;
}
public function setTarget($target)
{
$this->target = $target;
$this->apiParas["target"] = $target;
}
public function getTarget()
{
return $this->target;
}
public function setTargetValue($targetValue)
{
$this->targetValue = $targetValue;
$this->apiParas["target_value"] = $targetValue;
}
public function getTargetValue()
{
return $this->targetValue;
}
public function getApiMethodName()
{
return "taobao.cloudpush.notice.ios";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->env,"env");
RequestCheckUtil::checkNotNull($this->summary,"summary");
RequestCheckUtil::checkNotNull($this->target,"target");
RequestCheckUtil::checkNotNull($this->targetValue,"targetValue");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,374 @@
<?php
/**
* TOP API: taobao.cloudpush.push request
*
* @author auto create
* @since 1.0, 2018.07.26
*/
class CloudpushPushRequest
{
/**
* Android对应的activity,仅仅当androidOpenType=2有效
**/
private $androidActivity;
/**
* 自定义的kv结构,开发者扩展用 针对android
**/
private $androidExtParameters;
/**
* android通知声音
**/
private $androidMusic;
/**
* 点击通知后动作,1:打开应用 2: 打开应用Activity 3:打开 url
**/
private $androidOpenType;
/**
* Android收到推送后打开对应的url,仅仅当androidOpenType=3有效
**/
private $androidOpenUrl;
/**
* 防打扰时长,取值范围为1~23
**/
private $antiHarassDuration;
/**
* 防打扰开始时间点,取值范围为0~23
**/
private $antiHarassStartTime;
/**
* 批次编号,用于活动效果统计
**/
private $batchNumber;
/**
* 推送内容
**/
private $body;
/**
* 设备类型,取值范围为:0~3云推送支持多种设备,各种设备类型编号如下: iOS设备:deviceType=0; Andriod设备:deviceType=1;如果存在此字段,则向指定的设备类型推送消息。 默认为全部(3);
**/
private $deviceType;
/**
* iOS应用图标右上角角标
**/
private $iosBadge;
/**
* 自定义的kv结构,开发者扩展用 针对iOS设备
**/
private $iosExtParameters;
/**
* iOS通知声音
**/
private $iosMusic;
/**
* 当APP不在线时候是否通过通知提醒. 针对不同设备,处理逻辑不同。 该参数只针对iOS设备生效 (remind=true & 发送消息的话(type=0)). 当你的目标设备不在线(既长连接通道不通, 我们会将这条消息的标题通过苹果的apns通道再送达一次。发apns是发送生产环境的apns需要在云推送配置的app的iOS生产证书和密码需要正确否则也发送不了。 (remind=false & 并且是发送消息的话(type=0))那么设备不在线则不会再走苹果apns发送了。
**/
private $remind;
/**
* 离线消息是否保存,若保存, 在推送时候,用户即使不在线,下一次上线则会收到
**/
private $storeOffline;
/**
* 通知的摘要
**/
private $summery;
/**
* 推送目标: device:推送给设备; account:推送给指定帐号,tag:推送给自定义标签; all: 推送给全部
**/
private $target;
/**
* 根据Target来设定如Target=device, 则对应的值为 设备id1,设备id2. 多个值使用逗号分隔.(帐号与设备有一次最多100个的限制)
**/
private $targetValue;
/**
* 离线消息保存时长,取值范围为1~72,若不填,则表示不保存离线消息
**/
private $timeout;
/**
* 推送的标题内容.
**/
private $title;
/**
* 0:表示消息(默认为0),1:表示通知
**/
private $type;
private $apiParas = array();
public function setAndroidActivity($androidActivity)
{
$this->androidActivity = $androidActivity;
$this->apiParas["android_activity"] = $androidActivity;
}
public function getAndroidActivity()
{
return $this->androidActivity;
}
public function setAndroidExtParameters($androidExtParameters)
{
$this->androidExtParameters = $androidExtParameters;
$this->apiParas["android_ext_parameters"] = $androidExtParameters;
}
public function getAndroidExtParameters()
{
return $this->androidExtParameters;
}
public function setAndroidMusic($androidMusic)
{
$this->androidMusic = $androidMusic;
$this->apiParas["android_music"] = $androidMusic;
}
public function getAndroidMusic()
{
return $this->androidMusic;
}
public function setAndroidOpenType($androidOpenType)
{
$this->androidOpenType = $androidOpenType;
$this->apiParas["android_open_type"] = $androidOpenType;
}
public function getAndroidOpenType()
{
return $this->androidOpenType;
}
public function setAndroidOpenUrl($androidOpenUrl)
{
$this->androidOpenUrl = $androidOpenUrl;
$this->apiParas["android_open_url"] = $androidOpenUrl;
}
public function getAndroidOpenUrl()
{
return $this->androidOpenUrl;
}
public function setAntiHarassDuration($antiHarassDuration)
{
$this->antiHarassDuration = $antiHarassDuration;
$this->apiParas["anti_harass_duration"] = $antiHarassDuration;
}
public function getAntiHarassDuration()
{
return $this->antiHarassDuration;
}
public function setAntiHarassStartTime($antiHarassStartTime)
{
$this->antiHarassStartTime = $antiHarassStartTime;
$this->apiParas["anti_harass_start_time"] = $antiHarassStartTime;
}
public function getAntiHarassStartTime()
{
return $this->antiHarassStartTime;
}
public function setBatchNumber($batchNumber)
{
$this->batchNumber = $batchNumber;
$this->apiParas["batch_number"] = $batchNumber;
}
public function getBatchNumber()
{
return $this->batchNumber;
}
public function setBody($body)
{
$this->body = $body;
$this->apiParas["body"] = $body;
}
public function getBody()
{
return $this->body;
}
public function setDeviceType($deviceType)
{
$this->deviceType = $deviceType;
$this->apiParas["device_type"] = $deviceType;
}
public function getDeviceType()
{
return $this->deviceType;
}
public function setIosBadge($iosBadge)
{
$this->iosBadge = $iosBadge;
$this->apiParas["ios_badge"] = $iosBadge;
}
public function getIosBadge()
{
return $this->iosBadge;
}
public function setIosExtParameters($iosExtParameters)
{
$this->iosExtParameters = $iosExtParameters;
$this->apiParas["ios_ext_parameters"] = $iosExtParameters;
}
public function getIosExtParameters()
{
return $this->iosExtParameters;
}
public function setIosMusic($iosMusic)
{
$this->iosMusic = $iosMusic;
$this->apiParas["ios_music"] = $iosMusic;
}
public function getIosMusic()
{
return $this->iosMusic;
}
public function setRemind($remind)
{
$this->remind = $remind;
$this->apiParas["remind"] = $remind;
}
public function getRemind()
{
return $this->remind;
}
public function setStoreOffline($storeOffline)
{
$this->storeOffline = $storeOffline;
$this->apiParas["store_offline"] = $storeOffline;
}
public function getStoreOffline()
{
return $this->storeOffline;
}
public function setSummery($summery)
{
$this->summery = $summery;
$this->apiParas["summery"] = $summery;
}
public function getSummery()
{
return $this->summery;
}
public function setTarget($target)
{
$this->target = $target;
$this->apiParas["target"] = $target;
}
public function getTarget()
{
return $this->target;
}
public function setTargetValue($targetValue)
{
$this->targetValue = $targetValue;
$this->apiParas["target_value"] = $targetValue;
}
public function getTargetValue()
{
return $this->targetValue;
}
public function setTimeout($timeout)
{
$this->timeout = $timeout;
$this->apiParas["timeout"] = $timeout;
}
public function getTimeout()
{
return $this->timeout;
}
public function setTitle($title)
{
$this->title = $title;
$this->apiParas["title"] = $title;
}
public function getTitle()
{
return $this->title;
}
public function setType($type)
{
$this->type = $type;
$this->apiParas["type"] = $type;
}
public function getType()
{
return $this->type;
}
public function getApiMethodName()
{
return "taobao.cloudpush.push";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->body,"body");
RequestCheckUtil::checkNotNull($this->deviceType,"deviceType");
RequestCheckUtil::checkNotNull($this->remind,"remind");
RequestCheckUtil::checkNotNull($this->storeOffline,"storeOffline");
RequestCheckUtil::checkNotNull($this->target,"target");
RequestCheckUtil::checkNotNull($this->targetValue,"targetValue");
RequestCheckUtil::checkNotNull($this->title,"title");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,81 @@
<?php
/**
* TOP API: taobao.files.get request
*
* @author auto create
* @since 1.0, 2023.10.10
*/
class FilesGetRequest
{
/**
* 搜索结束时间
**/
private $endDate;
/**
* 搜索开始时间
**/
private $startDate;
/**
* 下载链接状态。1:未下载。2:已下载
**/
private $status;
private $apiParas = array();
public function setEndDate($endDate)
{
$this->endDate = $endDate;
$this->apiParas["end_date"] = $endDate;
}
public function getEndDate()
{
return $this->endDate;
}
public function setStartDate($startDate)
{
$this->startDate = $startDate;
$this->apiParas["start_date"] = $startDate;
}
public function getStartDate()
{
return $this->startDate;
}
public function setStatus($status)
{
$this->status = $status;
$this->apiParas["status"] = $status;
}
public function getStatus()
{
return $this->status;
}
public function getApiMethodName()
{
return "taobao.files.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->endDate,"endDate");
RequestCheckUtil::checkNotNull($this->startDate,"startDate");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,32 @@
<?php
/**
* TOP API: taobao.httpdns.get request
*
* @author auto create
* @since 1.0, 2022.09.19
*/
class HttpdnsGetRequest
{
private $apiParas = array();
public function getApiMethodName()
{
return "taobao.httpdns.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,81 @@
<?php
/**
* TOP API: taobao.item.img.delete request
*
* @author auto create
* @since 1.0, 2023.03.28
*/
class ItemImgDeleteRequest
{
/**
* 商品图片ID如果是竖图请将id的值设置为1
**/
private $id;
/**
* 标记是否要删除第6张图因为第6张图与普通商品图片不是存储在同一个位置的无图片ID所以要通过一个标记来判断是否为第6张图目前第6张图业务主要用在女装业务下
**/
private $isSixthPic;
/**
* 商品数字ID
**/
private $numIid;
private $apiParas = array();
public function setId($id)
{
$this->id = $id;
$this->apiParas["id"] = $id;
}
public function getId()
{
return $this->id;
}
public function setIsSixthPic($isSixthPic)
{
$this->isSixthPic = $isSixthPic;
$this->apiParas["is_sixth_pic"] = $isSixthPic;
}
public function getIsSixthPic()
{
return $this->isSixthPic;
}
public function setNumIid($numIid)
{
$this->numIid = $numIid;
$this->apiParas["num_iid"] = $numIid;
}
public function getNumIid()
{
return $this->numIid;
}
public function getApiMethodName()
{
return "taobao.item.img.delete";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->id,"id");
RequestCheckUtil::checkNotNull($this->numIid,"numIid");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,128 @@
<?php
/**
* TOP API: taobao.item.img.upload request
*
* @author auto create
* @since 1.0, 2022.05.31
*/
class ItemImgUploadRequest
{
/**
* 商品图片id(如果是更新图片,则需要传该参数)
**/
private $id;
/**
* 商品图片内容类型:JPG;最大:3M 。支持的文件类型jpg,jpeg,png
**/
private $image;
/**
* 是否将该图片设为主图,可选值:true,false;默认值:false(非主图)
**/
private $isMajor;
/**
* 是否3:4长方形图片绑定3:4主图视频时用于上传3:4商品主图
**/
private $isRectangle;
/**
* 商品数字ID该参数必须
**/
private $numIid;
/**
* 图片序号
**/
private $position;
private $apiParas = array();
public function setId($id)
{
$this->id = $id;
$this->apiParas["id"] = $id;
}
public function getId()
{
return $this->id;
}
public function setImage($image)
{
$this->image = $image;
$this->apiParas["image"] = $image;
}
public function getImage()
{
return $this->image;
}
public function setIsMajor($isMajor)
{
$this->isMajor = $isMajor;
$this->apiParas["is_major"] = $isMajor;
}
public function getIsMajor()
{
return $this->isMajor;
}
public function setIsRectangle($isRectangle)
{
$this->isRectangle = $isRectangle;
$this->apiParas["is_rectangle"] = $isRectangle;
}
public function getIsRectangle()
{
return $this->isRectangle;
}
public function setNumIid($numIid)
{
$this->numIid = $numIid;
$this->apiParas["num_iid"] = $numIid;
}
public function getNumIid()
{
return $this->numIid;
}
public function setPosition($position)
{
$this->position = $position;
$this->apiParas["position"] = $position;
}
public function getPosition()
{
return $this->position;
}
public function getApiMethodName()
{
return "taobao.item.img.upload";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->numIid,"numIid");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,129 @@
<?php
/**
* TOP API: taobao.item.joint.img request
*
* @author auto create
* @since 1.0, 2022.05.31
*/
class ItemJointImgRequest
{
/**
* 商品图片id(如果是更新图片,则需要传该参数)
**/
private $id;
/**
* 上传的图片是否关联为商品主图
**/
private $isMajor;
/**
* 是否3:4长方形图片绑定3:4主图视频时用于上传3:4商品主图
**/
private $isRectangle;
/**
* 商品数字ID必选
**/
private $numIid;
/**
* 图片URL,图片空间图片的相对地址支持的文件类型jpg,jpeg,png
**/
private $picPath;
/**
* 图片序号
**/
private $position;
private $apiParas = array();
public function setId($id)
{
$this->id = $id;
$this->apiParas["id"] = $id;
}
public function getId()
{
return $this->id;
}
public function setIsMajor($isMajor)
{
$this->isMajor = $isMajor;
$this->apiParas["is_major"] = $isMajor;
}
public function getIsMajor()
{
return $this->isMajor;
}
public function setIsRectangle($isRectangle)
{
$this->isRectangle = $isRectangle;
$this->apiParas["is_rectangle"] = $isRectangle;
}
public function getIsRectangle()
{
return $this->isRectangle;
}
public function setNumIid($numIid)
{
$this->numIid = $numIid;
$this->apiParas["num_iid"] = $numIid;
}
public function getNumIid()
{
return $this->numIid;
}
public function setPicPath($picPath)
{
$this->picPath = $picPath;
$this->apiParas["pic_path"] = $picPath;
}
public function getPicPath()
{
return $this->picPath;
}
public function setPosition($position)
{
$this->position = $position;
$this->apiParas["position"] = $position;
}
public function getPosition()
{
return $this->position;
}
public function getApiMethodName()
{
return "taobao.item.joint.img";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->numIid,"numIid");
RequestCheckUtil::checkNotNull($this->picPath,"picPath");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,114 @@
<?php
/**
* TOP API: taobao.item.joint.propimg request
*
* @author auto create
* @since 1.0, 2022.05.31
*/
class ItemJointPropimgRequest
{
/**
* 属性图片ID。如果是新增不需要填写
**/
private $id;
/**
* 商品数字ID必选
**/
private $numIid;
/**
* 图片地址(传入图片相对地址即可,即不需包含 http://img02.taobao.net/bao/uploaded )
**/
private $picPath;
/**
* 图片序号
**/
private $position;
/**
* 属性列表。调用taobao.itemprops.get获取属性必须是颜色属性格式:pid:vid。
**/
private $properties;
private $apiParas = array();
public function setId($id)
{
$this->id = $id;
$this->apiParas["id"] = $id;
}
public function getId()
{
return $this->id;
}
public function setNumIid($numIid)
{
$this->numIid = $numIid;
$this->apiParas["num_iid"] = $numIid;
}
public function getNumIid()
{
return $this->numIid;
}
public function setPicPath($picPath)
{
$this->picPath = $picPath;
$this->apiParas["pic_path"] = $picPath;
}
public function getPicPath()
{
return $this->picPath;
}
public function setPosition($position)
{
$this->position = $position;
$this->apiParas["position"] = $position;
}
public function getPosition()
{
return $this->position;
}
public function setProperties($properties)
{
$this->properties = $properties;
$this->apiParas["properties"] = $properties;
}
public function getProperties()
{
return $this->properties;
}
public function getApiMethodName()
{
return "taobao.item.joint.propimg";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->numIid,"numIid");
RequestCheckUtil::checkNotNull($this->picPath,"picPath");
RequestCheckUtil::checkNotNull($this->properties,"properties");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,66 @@
<?php
/**
* TOP API: taobao.item.skus.get request
*
* @author auto create
* @since 1.0, 2022.05.31
*/
class ItemSkusGetRequest
{
/**
* 需返回的字段列表。可选值Sku结构体中的所有字段字段之间用“,”分隔。
**/
private $fields;
/**
* sku所属商品数字id必选。num_iid个数不能超过40个
**/
private $numIids;
private $apiParas = array();
public function setFields($fields)
{
$this->fields = $fields;
$this->apiParas["fields"] = $fields;
}
public function getFields()
{
return $this->fields;
}
public function setNumIids($numIids)
{
$this->numIids = $numIids;
$this->apiParas["num_iids"] = $numIids;
}
public function getNumIids()
{
return $this->numIids;
}
public function getApiMethodName()
{
return "taobao.item.skus.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->fields,"fields");
RequestCheckUtil::checkMaxListSize($this->fields,20,"fields");
RequestCheckUtil::checkNotNull($this->numIids,"numIids");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,49 @@
<?php
/**
* TOP API: taobao.item.update.delisting request
*
* @author auto create
* @since 1.0, 2019.10.31
*/
class ItemUpdateDelistingRequest
{
/**
* 商品数字ID该参数必须
**/
private $numIid;
private $apiParas = array();
public function setNumIid($numIid)
{
$this->numIid = $numIid;
$this->apiParas["num_iid"] = $numIid;
}
public function getNumIid()
{
return $this->numIid;
}
public function getApiMethodName()
{
return "taobao.item.update.delisting";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->numIid,"numIid");
RequestCheckUtil::checkMinValue($this->numIid,0,"numIid");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,67 @@
<?php
/**
* TOP API: taobao.item.update.listing request
*
* @author auto create
* @since 1.0, 2019.10.31
*/
class ItemUpdateListingRequest
{
/**
* 需要上架的商品的数量。取值范围:大于零的整数。如果商品有sku则上架数量默认为所有sku数量总和不可修改。否则商品数量根据设置数量调整为num
**/
private $num;
/**
* 商品数字ID该参数必须
**/
private $numIid;
private $apiParas = array();
public function setNum($num)
{
$this->num = $num;
$this->apiParas["num"] = $num;
}
public function getNum()
{
return $this->num;
}
public function setNumIid($numIid)
{
$this->numIid = $numIid;
$this->apiParas["num_iid"] = $numIid;
}
public function getNumIid()
{
return $this->numIid;
}
public function getApiMethodName()
{
return "taobao.item.update.listing";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkNotNull($this->num,"num");
RequestCheckUtil::checkMinValue($this->num,0,"num");
RequestCheckUtil::checkNotNull($this->numIid,"numIid");
RequestCheckUtil::checkMinValue($this->numIid,0,"numIid");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

View File

@ -0,0 +1,131 @@
<?php
/**
* TOP API: taobao.itempropvalues.get request
*
* @author auto create
* @since 1.0, 2022.07.19
*/
class ItempropvaluesGetRequest
{
/**
* 属性的Key支持多条以“,”分隔
**/
private $attrKeys;
/**
* 叶子类目ID ,通过taobao.itemcats.get获得叶子类目ID
**/
private $cid;
/**
* 假如传2005-01-01 00:00:00,则取所有的属性和子属性(状态为删除的属性值不返回prop_name)
**/
private $datetime;
/**
* 需要返回的字段。目前支持有cid,pid,prop_name,vid,name,name_alias,status,sort_order
**/
private $fields;
/**
* 属性和属性值 id串格式例如(pid1;pid2)(pid1:vid1;pid2:vid2)(pid1;pid2:vid2)
**/
private $pvs;
/**
* 获取类目的类型1代表集市、2代表天猫
**/
private $type;
private $apiParas = array();
public function setAttrKeys($attrKeys)
{
$this->attrKeys = $attrKeys;
$this->apiParas["attr_keys"] = $attrKeys;
}
public function getAttrKeys()
{
return $this->attrKeys;
}
public function setCid($cid)
{
$this->cid = $cid;
$this->apiParas["cid"] = $cid;
}
public function getCid()
{
return $this->cid;
}
public function setDatetime($datetime)
{
$this->datetime = $datetime;
$this->apiParas["datetime"] = $datetime;
}
public function getDatetime()
{
return $this->datetime;
}
public function setFields($fields)
{
$this->fields = $fields;
$this->apiParas["fields"] = $fields;
}
public function getFields()
{
return $this->fields;
}
public function setPvs($pvs)
{
$this->pvs = $pvs;
$this->apiParas["pvs"] = $pvs;
}
public function getPvs()
{
return $this->pvs;
}
public function setType($type)
{
$this->type = $type;
$this->apiParas["type"] = $type;
}
public function getType()
{
return $this->type;
}
public function getApiMethodName()
{
return "taobao.itempropvalues.get";
}
public function getApiParas()
{
return $this->apiParas;
}
public function check()
{
RequestCheckUtil::checkMaxListSize($this->attrKeys,20,"attrKeys");
RequestCheckUtil::checkNotNull($this->cid,"cid");
RequestCheckUtil::checkNotNull($this->fields,"fields");
RequestCheckUtil::checkMaxListSize($this->fields,20,"fields");
}
public function putOtherTextParam($key, $value) {
$this->apiParas[$key] = $value;
$this->$key = $value;
}
}

Some files were not shown because too many files have changed in this diff Show More