添加后台代理代码
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
199
codes/agent/game/dlweb/api/third/taobao/top/ClusterTopClient.php
Normal file
199
codes/agent/game/dlweb/api/third/taobao/top/ClusterTopClient.php
Normal 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); }
|
||||
}
|
||||
?>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
107
codes/agent/game/dlweb/api/third/taobao/top/RequestCheckUtil.php
Normal file
107
codes/agent/game/dlweb/api/third/taobao/top/RequestCheckUtil.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
/**
|
||||
* API入参静态检查类
|
||||
* 可以对API的参数类型、长度、最大值等进行校验
|
||||
*
|
||||
**/
|
||||
class RequestCheckUtil
|
||||
{
|
||||
/**
|
||||
* 校验字段 fieldName 的值$value非空
|
||||
*
|
||||
**/
|
||||
public static function checkNotNull($value,$fieldName) {
|
||||
|
||||
if(self::checkEmpty($value)){
|
||||
throw new Exception("client-check-error:Missing Required Arguments: " .$fieldName , 40);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验字段fieldName的值value 的长度
|
||||
*
|
||||
**/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验字段fieldName的值value的最大列表长度
|
||||
*
|
||||
**/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验字段fieldName的值value 的最大值
|
||||
*
|
||||
**/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验字段fieldName的值value 的最小值
|
||||
*
|
||||
**/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 检验字段fieldName的值value是否是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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验$value是否非空
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
21
codes/agent/game/dlweb/api/third/taobao/top/ResultSet.php
Normal file
21
codes/agent/game/dlweb/api/third/taobao/top/ResultSet.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* 返回的默认类
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2015-01-20
|
||||
*/
|
||||
class ResultSet
|
||||
{
|
||||
|
||||
/**
|
||||
* 返回的错误码
|
||||
**/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* 返回的错误信息
|
||||
**/
|
||||
public $msg;
|
||||
|
||||
}
|
||||
214
codes/agent/game/dlweb/api/third/taobao/top/SpiUtils.php
Normal file
214
codes/agent/game/dlweb/api/third/taobao/top/SpiUtils.php
Normal file
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
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']; // 只获取参与签名的头部字段
|
||||
$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.") || $this->startsWith($remoteIp,"40.205.145.");
|
||||
}
|
||||
|
||||
private static function getFormMap(){
|
||||
$resultArray = array();
|
||||
foreach($_POST as $key=>$v) {
|
||||
$resultArray[$k] = $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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
378
codes/agent/game/dlweb/api/third/taobao/top/TopClient.php
Normal file
378
codes/agent/game/dlweb/api/third/taobao/top/TopClient.php
Normal file
@@ -0,0 +1,378 @@
|
||||
<?php
|
||||
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-20151012";
|
||||
|
||||
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_string($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(!is_string($v))
|
||||
continue ;
|
||||
|
||||
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)
|
||||
{
|
||||
// PHP8兼容性修复:CURLOPT_SAFE_UPLOAD在PHP8中已被移除
|
||||
if (class_exists('\CURLFile')) {
|
||||
// PHP8中安全上传是默认启用的,不需要设置
|
||||
if (defined('CURLOPT_SAFE_UPLOAD') && version_compare(phpversion(), '8.0') < 0) {
|
||||
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
|
||||
}
|
||||
} else {
|
||||
if (defined('CURLOPT_SAFE_UPLOAD') && version_compare(phpversion(), '8.0') < 0) {
|
||||
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 (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");
|
||||
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);
|
||||
}
|
||||
}
|
||||
43
codes/agent/game/dlweb/api/third/taobao/top/TopLogger.php
Normal file
43
codes/agent/game/dlweb/api/third/taobao/top/TopLogger.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
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);
|
||||
}
|
||||
}
|
||||
?>
|
||||
35
codes/agent/game/dlweb/api/third/taobao/top/domain/Area.php
Normal file
35
codes/agent/game/dlweb/api/third/taobao/top/domain/Area.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 地址区域结构
|
||||
* @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;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 返回结果对象
|
||||
* @author auto create
|
||||
*/
|
||||
class BizResult
|
||||
{
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
**/
|
||||
public $err_code;
|
||||
|
||||
/**
|
||||
* 返回结果
|
||||
**/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* 返回信息描述
|
||||
**/
|
||||
public $msg;
|
||||
|
||||
/**
|
||||
* true表示成功,false表示失败
|
||||
**/
|
||||
public $success;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 1
|
||||
* @author auto create
|
||||
*/
|
||||
class FcPartnerSmsDetailDto
|
||||
{
|
||||
|
||||
/**
|
||||
* 公共回传参数
|
||||
**/
|
||||
public $extend;
|
||||
|
||||
/**
|
||||
* 短信接收号码
|
||||
**/
|
||||
public $rec_num;
|
||||
|
||||
/**
|
||||
* 短信错误码
|
||||
**/
|
||||
public $result_code;
|
||||
|
||||
/**
|
||||
* 模板编码
|
||||
**/
|
||||
public $sms_code;
|
||||
|
||||
/**
|
||||
* 短信发送内容
|
||||
**/
|
||||
public $sms_content;
|
||||
|
||||
/**
|
||||
* 短信接收时间
|
||||
**/
|
||||
public $sms_receiver_time;
|
||||
|
||||
/**
|
||||
* 短信发送时间
|
||||
**/
|
||||
public $sms_send_time;
|
||||
|
||||
/**
|
||||
* 发送状态 1:等待回执,2:发送失败,3:发送成功
|
||||
**/
|
||||
public $sms_status;
|
||||
}
|
||||
?>
|
||||
@@ -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;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 无
|
||||
* @author auto create
|
||||
*/
|
||||
class Result
|
||||
{
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
**/
|
||||
public $code;
|
||||
|
||||
/**
|
||||
* 无
|
||||
**/
|
||||
public $model;
|
||||
|
||||
/**
|
||||
* 原因
|
||||
**/
|
||||
public $msg;
|
||||
|
||||
/**
|
||||
* 结果
|
||||
**/
|
||||
public $success;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 批量异步任务的子任务结果
|
||||
* @author auto create
|
||||
*/
|
||||
class Subtask
|
||||
{
|
||||
|
||||
/**
|
||||
* 标记子任务是否成功。为true表示子任务成功,用户可以按照正确执行的结果格式解析sub_task_result。为false表示子任务失败了,用户需要按照失败的结果格式解析sub_task_result(里面只有sub_code和sub_msg)
|
||||
**/
|
||||
public $is_success;
|
||||
|
||||
/**
|
||||
* 子任务的有效请求参数,以json格式进行key:value的组合
|
||||
**/
|
||||
public $sub_task_request;
|
||||
|
||||
/**
|
||||
* 子任务返回的结果,以json格式进行key:value组合,可以和单个api请求结果解析复用。以获取交易订单详情为例:子任务执行成功返回的结果格式为:{“trade”:{"tid":123456,"seller_nick":"淘宝卖家"}};子任务执行失败结果格式为{"sub_code":"isv.trade-not-exist","sub_msg":"交易订单不存在"}
|
||||
**/
|
||||
public $sub_task_result;
|
||||
}
|
||||
?>
|
||||
52
codes/agent/game/dlweb/api/third/taobao/top/domain/Task.php
Normal file
52
codes/agent/game/dlweb/api/third/taobao/top/domain/Task.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 批量异步任务结果
|
||||
* @author auto create
|
||||
*/
|
||||
class Task
|
||||
{
|
||||
|
||||
/**
|
||||
* 下载文件的MD5校验码,通过此校验码可以检查下载的文件是否是完整的。
|
||||
**/
|
||||
public $check_code;
|
||||
|
||||
/**
|
||||
* 任务创建时间
|
||||
**/
|
||||
public $created;
|
||||
|
||||
/**
|
||||
* 大任务结果下载地址。当创建的认任务是大数据量的任务时,获取结果会返回此字段,同时subtasks列表会为空。
|
||||
通过这个地址可以下载到结果的结构体,格式同普通任务下载的一样。
|
||||
每次获取到的地址只能下载一次。下载的文件加上后缀名.zip打开。
|
||||
**/
|
||||
public $download_url;
|
||||
|
||||
/**
|
||||
* 此任务是由哪个api产生的
|
||||
**/
|
||||
public $method;
|
||||
|
||||
/**
|
||||
* 定时类型任务的执行时间点
|
||||
**/
|
||||
public $schedule;
|
||||
|
||||
/**
|
||||
* 异步任务处理状态。new(还未开始处理),doing(处理中),done(处理结束)。
|
||||
**/
|
||||
public $status;
|
||||
|
||||
/**
|
||||
* 子任务处理结果,如果任务还没有处理完,返回的结果列表为空。如果任务处理完毕,返回子任务结果列表
|
||||
**/
|
||||
public $subtasks;
|
||||
|
||||
/**
|
||||
* 异步任务id。创建异步任务时返回的任务id号
|
||||
**/
|
||||
public $task_id;
|
||||
}
|
||||
?>
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.flow.charge.province request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.30
|
||||
*/
|
||||
class AlibabaAliqinFcFlowChargeProvinceRequest
|
||||
{
|
||||
/**
|
||||
* 需要充值的流量
|
||||
**/
|
||||
private $grade;
|
||||
|
||||
/**
|
||||
* 唯一流水号
|
||||
**/
|
||||
private $outRechargeId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
**/
|
||||
private $phoneNum;
|
||||
|
||||
/**
|
||||
* 充值原因
|
||||
**/
|
||||
private $reason;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setGrade($grade)
|
||||
{
|
||||
$this->grade = $grade;
|
||||
$this->apiParas["grade"] = $grade;
|
||||
}
|
||||
|
||||
public function getGrade()
|
||||
{
|
||||
return $this->grade;
|
||||
}
|
||||
|
||||
public function setOutRechargeId($outRechargeId)
|
||||
{
|
||||
$this->outRechargeId = $outRechargeId;
|
||||
$this->apiParas["out_recharge_id"] = $outRechargeId;
|
||||
}
|
||||
|
||||
public function getOutRechargeId()
|
||||
{
|
||||
return $this->outRechargeId;
|
||||
}
|
||||
|
||||
public function setPhoneNum($phoneNum)
|
||||
{
|
||||
$this->phoneNum = $phoneNum;
|
||||
$this->apiParas["phone_num"] = $phoneNum;
|
||||
}
|
||||
|
||||
public function getPhoneNum()
|
||||
{
|
||||
return $this->phoneNum;
|
||||
}
|
||||
|
||||
public function setReason($reason)
|
||||
{
|
||||
$this->reason = $reason;
|
||||
$this->apiParas["reason"] = $reason;
|
||||
}
|
||||
|
||||
public function getReason()
|
||||
{
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.flow.charge.province";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->grade,"grade");
|
||||
RequestCheckUtil::checkNotNull($this->outRechargeId,"outRechargeId");
|
||||
RequestCheckUtil::checkNotNull($this->phoneNum,"phoneNum");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.flow.charge request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.30
|
||||
*/
|
||||
class AlibabaAliqinFcFlowChargeRequest
|
||||
{
|
||||
/**
|
||||
* 需要充值的流量
|
||||
**/
|
||||
private $grade;
|
||||
|
||||
/**
|
||||
* 唯一流水号
|
||||
**/
|
||||
private $outRechargeId;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
**/
|
||||
private $phoneNum;
|
||||
|
||||
/**
|
||||
* 充值原因
|
||||
**/
|
||||
private $reason;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setGrade($grade)
|
||||
{
|
||||
$this->grade = $grade;
|
||||
$this->apiParas["grade"] = $grade;
|
||||
}
|
||||
|
||||
public function getGrade()
|
||||
{
|
||||
return $this->grade;
|
||||
}
|
||||
|
||||
public function setOutRechargeId($outRechargeId)
|
||||
{
|
||||
$this->outRechargeId = $outRechargeId;
|
||||
$this->apiParas["out_recharge_id"] = $outRechargeId;
|
||||
}
|
||||
|
||||
public function getOutRechargeId()
|
||||
{
|
||||
return $this->outRechargeId;
|
||||
}
|
||||
|
||||
public function setPhoneNum($phoneNum)
|
||||
{
|
||||
$this->phoneNum = $phoneNum;
|
||||
$this->apiParas["phone_num"] = $phoneNum;
|
||||
}
|
||||
|
||||
public function getPhoneNum()
|
||||
{
|
||||
return $this->phoneNum;
|
||||
}
|
||||
|
||||
public function setReason($reason)
|
||||
{
|
||||
$this->reason = $reason;
|
||||
$this->apiParas["reason"] = $reason;
|
||||
}
|
||||
|
||||
public function getReason()
|
||||
{
|
||||
return $this->reason;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.flow.charge";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->grade,"grade");
|
||||
RequestCheckUtil::checkNotNull($this->outRechargeId,"outRechargeId");
|
||||
RequestCheckUtil::checkNotNull($this->phoneNum,"phoneNum");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.flow.grade request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.30
|
||||
*/
|
||||
class AlibabaAliqinFcFlowGradeRequest
|
||||
{
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.flow.grade";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.flow.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.30
|
||||
*/
|
||||
class AlibabaAliqinFcFlowQueryRequest
|
||||
{
|
||||
/**
|
||||
* 唯一流水号
|
||||
**/
|
||||
private $outId;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setOutId($outId)
|
||||
{
|
||||
$this->outId = $outId;
|
||||
$this->apiParas["out_id"] = $outId;
|
||||
}
|
||||
|
||||
public function getOutId()
|
||||
{
|
||||
return $this->outId;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.flow.query";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.sms.num.query request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.01
|
||||
*/
|
||||
class AlibabaAliqinFcSmsNumQueryRequest
|
||||
{
|
||||
/**
|
||||
* 短信发送流水
|
||||
**/
|
||||
private $bizId;
|
||||
|
||||
/**
|
||||
* 分页参数,页码
|
||||
**/
|
||||
private $currentPage;
|
||||
|
||||
/**
|
||||
* 分页参数,每页数量。最大值50
|
||||
**/
|
||||
private $pageSize;
|
||||
|
||||
/**
|
||||
* 短信发送日期,支持近30天记录查询,格式yyyyMMdd
|
||||
**/
|
||||
private $queryDate;
|
||||
|
||||
/**
|
||||
* 短信接收号码
|
||||
**/
|
||||
private $recNum;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setBizId($bizId)
|
||||
{
|
||||
$this->bizId = $bizId;
|
||||
$this->apiParas["biz_id"] = $bizId;
|
||||
}
|
||||
|
||||
public function getBizId()
|
||||
{
|
||||
return $this->bizId;
|
||||
}
|
||||
|
||||
public function setCurrentPage($currentPage)
|
||||
{
|
||||
$this->currentPage = $currentPage;
|
||||
$this->apiParas["current_page"] = $currentPage;
|
||||
}
|
||||
|
||||
public function getCurrentPage()
|
||||
{
|
||||
return $this->currentPage;
|
||||
}
|
||||
|
||||
public function setPageSize($pageSize)
|
||||
{
|
||||
$this->pageSize = $pageSize;
|
||||
$this->apiParas["page_size"] = $pageSize;
|
||||
}
|
||||
|
||||
public function getPageSize()
|
||||
{
|
||||
return $this->pageSize;
|
||||
}
|
||||
|
||||
public function setQueryDate($queryDate)
|
||||
{
|
||||
$this->queryDate = $queryDate;
|
||||
$this->apiParas["query_date"] = $queryDate;
|
||||
}
|
||||
|
||||
public function getQueryDate()
|
||||
{
|
||||
return $this->queryDate;
|
||||
}
|
||||
|
||||
public function setRecNum($recNum)
|
||||
{
|
||||
$this->recNum = $recNum;
|
||||
$this->apiParas["rec_num"] = $recNum;
|
||||
}
|
||||
|
||||
public function getRecNum()
|
||||
{
|
||||
return $this->recNum;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.sms.num.query";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->currentPage,"currentPage");
|
||||
RequestCheckUtil::checkNotNull($this->pageSize,"pageSize");
|
||||
RequestCheckUtil::checkNotNull($this->queryDate,"queryDate");
|
||||
RequestCheckUtil::checkNotNull($this->recNum,"recNum");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.sms.num.send request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.05.24
|
||||
*/
|
||||
class AlibabaAliqinFcSmsNumSendRequest
|
||||
{
|
||||
/**
|
||||
* 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用
|
||||
**/
|
||||
private $extend;
|
||||
|
||||
/**
|
||||
* 短信接收号码。支持单个或多个手机号码,传入号码为11位手机号码,不能加0或+86。群发短信需传入多个号码,以英文逗号分隔,一次调用最多传入200个号码。示例:18600000000,13911111111,13322222222
|
||||
**/
|
||||
private $recNum;
|
||||
|
||||
/**
|
||||
* 短信签名,传入的短信签名必须是在阿里大鱼“管理中心-短信签名管理”中的可用签名。如“阿里大鱼”已在短信签名管理中通过审核,则可传入”阿里大鱼“(传参时去掉引号)作为短信签名。短信效果示例:【阿里大鱼】欢迎使用阿里大鱼服务。
|
||||
**/
|
||||
private $smsFreeSignName;
|
||||
|
||||
/**
|
||||
* 短信模板变量,传参规则{"key":"value"},key的名字须和申请模板中的变量名一致,多个变量之间以逗号隔开。示例:针对模板“验证码${code},您正在进行${product}身份验证,打死不要告诉别人哦!”,传参时需传入{"code":"1234","product":"alidayu"}
|
||||
**/
|
||||
private $smsParam;
|
||||
|
||||
/**
|
||||
* 短信模板ID,传入的模板必须是在阿里大鱼“管理中心-短信模板管理”中的可用模板。示例:SMS_585014
|
||||
**/
|
||||
private $smsTemplateCode;
|
||||
|
||||
/**
|
||||
* 短信类型,传入值请填写normal
|
||||
**/
|
||||
private $smsType;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setExtend($extend)
|
||||
{
|
||||
$this->extend = $extend;
|
||||
$this->apiParas["extend"] = $extend;
|
||||
}
|
||||
|
||||
public function getExtend()
|
||||
{
|
||||
return $this->extend;
|
||||
}
|
||||
|
||||
public function setRecNum($recNum)
|
||||
{
|
||||
$this->recNum = $recNum;
|
||||
$this->apiParas["rec_num"] = $recNum;
|
||||
}
|
||||
|
||||
public function getRecNum()
|
||||
{
|
||||
return $this->recNum;
|
||||
}
|
||||
|
||||
public function setSmsFreeSignName($smsFreeSignName)
|
||||
{
|
||||
$this->smsFreeSignName = $smsFreeSignName;
|
||||
$this->apiParas["sms_free_sign_name"] = $smsFreeSignName;
|
||||
}
|
||||
|
||||
public function getSmsFreeSignName()
|
||||
{
|
||||
return $this->smsFreeSignName;
|
||||
}
|
||||
|
||||
public function setSmsParam($smsParam)
|
||||
{
|
||||
$this->smsParam = $smsParam;
|
||||
$this->apiParas["sms_param"] = $smsParam;
|
||||
}
|
||||
|
||||
public function getSmsParam()
|
||||
{
|
||||
return $this->smsParam;
|
||||
}
|
||||
|
||||
public function setSmsTemplateCode($smsTemplateCode)
|
||||
{
|
||||
$this->smsTemplateCode = $smsTemplateCode;
|
||||
$this->apiParas["sms_template_code"] = $smsTemplateCode;
|
||||
}
|
||||
|
||||
public function getSmsTemplateCode()
|
||||
{
|
||||
return $this->smsTemplateCode;
|
||||
}
|
||||
|
||||
public function setSmsType($smsType)
|
||||
{
|
||||
$this->smsType = $smsType;
|
||||
$this->apiParas["sms_type"] = $smsType;
|
||||
}
|
||||
|
||||
public function getSmsType()
|
||||
{
|
||||
return $this->smsType;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.sms.num.send";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->recNum,"recNum");
|
||||
RequestCheckUtil::checkNotNull($this->smsFreeSignName,"smsFreeSignName");
|
||||
RequestCheckUtil::checkNotNull($this->smsTemplateCode,"smsTemplateCode");
|
||||
RequestCheckUtil::checkNotNull($this->smsType,"smsType");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.tts.num.singlecall request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.05.24
|
||||
*/
|
||||
class AlibabaAliqinFcTtsNumSinglecallRequest
|
||||
{
|
||||
/**
|
||||
* 被叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500
|
||||
**/
|
||||
private $calledNum;
|
||||
|
||||
/**
|
||||
* 被叫号显,传入的显示号码必须是阿里大鱼“管理中心-号码管理”中申请或购买的号码
|
||||
**/
|
||||
private $calledShowNum;
|
||||
|
||||
/**
|
||||
* 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用
|
||||
**/
|
||||
private $extend;
|
||||
|
||||
/**
|
||||
* TTS模板ID,传入的模板必须是在阿里大鱼“管理中心-语音TTS模板管理”中的可用模板
|
||||
**/
|
||||
private $ttsCode;
|
||||
|
||||
/**
|
||||
* 文本转语音(TTS)模板变量,传参规则{"key":"value"},key的名字须和TTS模板中的变量名一致,多个变量之间以逗号隔开,示例:{"name":"xiaoming","code":"1234"}
|
||||
**/
|
||||
private $ttsParam;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setCalledNum($calledNum)
|
||||
{
|
||||
$this->calledNum = $calledNum;
|
||||
$this->apiParas["called_num"] = $calledNum;
|
||||
}
|
||||
|
||||
public function getCalledNum()
|
||||
{
|
||||
return $this->calledNum;
|
||||
}
|
||||
|
||||
public function setCalledShowNum($calledShowNum)
|
||||
{
|
||||
$this->calledShowNum = $calledShowNum;
|
||||
$this->apiParas["called_show_num"] = $calledShowNum;
|
||||
}
|
||||
|
||||
public function getCalledShowNum()
|
||||
{
|
||||
return $this->calledShowNum;
|
||||
}
|
||||
|
||||
public function setExtend($extend)
|
||||
{
|
||||
$this->extend = $extend;
|
||||
$this->apiParas["extend"] = $extend;
|
||||
}
|
||||
|
||||
public function getExtend()
|
||||
{
|
||||
return $this->extend;
|
||||
}
|
||||
|
||||
public function setTtsCode($ttsCode)
|
||||
{
|
||||
$this->ttsCode = $ttsCode;
|
||||
$this->apiParas["tts_code"] = $ttsCode;
|
||||
}
|
||||
|
||||
public function getTtsCode()
|
||||
{
|
||||
return $this->ttsCode;
|
||||
}
|
||||
|
||||
public function setTtsParam($ttsParam)
|
||||
{
|
||||
$this->ttsParam = $ttsParam;
|
||||
$this->apiParas["tts_param"] = $ttsParam;
|
||||
}
|
||||
|
||||
public function getTtsParam()
|
||||
{
|
||||
return $this->ttsParam;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.tts.num.singlecall";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->calledNum,"calledNum");
|
||||
RequestCheckUtil::checkNotNull($this->calledShowNum,"calledShowNum");
|
||||
RequestCheckUtil::checkNotNull($this->ttsCode,"ttsCode");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.voice.num.doublecall request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.06
|
||||
*/
|
||||
class AlibabaAliqinFcVoiceNumDoublecallRequest
|
||||
{
|
||||
/**
|
||||
* 被叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500
|
||||
**/
|
||||
private $calledNum;
|
||||
|
||||
/**
|
||||
* 被叫号码侧的号码显示,传入的显示号码可以是阿里大鱼“管理中心-号码管理”中申请通过的号码。显示号码格式如下057188773344,4001112222,95500。显示号码也可以为主叫号码。
|
||||
**/
|
||||
private $calledShowNum;
|
||||
|
||||
/**
|
||||
* 主叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500
|
||||
**/
|
||||
private $callerNum;
|
||||
|
||||
/**
|
||||
* 主叫号码侧的号码显示,传入的显示号码必须是阿里大鱼“管理中心-号码管理”中申请通过的号码。显示号码格式如下057188773344,4001112222,95500
|
||||
**/
|
||||
private $callerShowNum;
|
||||
|
||||
/**
|
||||
* 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用
|
||||
**/
|
||||
private $extend;
|
||||
|
||||
/**
|
||||
* 通话超时时长,如接通后到达120秒时,通话会因为超时自动挂断。若无需设置超时时长,可不传。
|
||||
**/
|
||||
private $sessionTimeOut;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setCalledNum($calledNum)
|
||||
{
|
||||
$this->calledNum = $calledNum;
|
||||
$this->apiParas["called_num"] = $calledNum;
|
||||
}
|
||||
|
||||
public function getCalledNum()
|
||||
{
|
||||
return $this->calledNum;
|
||||
}
|
||||
|
||||
public function setCalledShowNum($calledShowNum)
|
||||
{
|
||||
$this->calledShowNum = $calledShowNum;
|
||||
$this->apiParas["called_show_num"] = $calledShowNum;
|
||||
}
|
||||
|
||||
public function getCalledShowNum()
|
||||
{
|
||||
return $this->calledShowNum;
|
||||
}
|
||||
|
||||
public function setCallerNum($callerNum)
|
||||
{
|
||||
$this->callerNum = $callerNum;
|
||||
$this->apiParas["caller_num"] = $callerNum;
|
||||
}
|
||||
|
||||
public function getCallerNum()
|
||||
{
|
||||
return $this->callerNum;
|
||||
}
|
||||
|
||||
public function setCallerShowNum($callerShowNum)
|
||||
{
|
||||
$this->callerShowNum = $callerShowNum;
|
||||
$this->apiParas["caller_show_num"] = $callerShowNum;
|
||||
}
|
||||
|
||||
public function getCallerShowNum()
|
||||
{
|
||||
return $this->callerShowNum;
|
||||
}
|
||||
|
||||
public function setExtend($extend)
|
||||
{
|
||||
$this->extend = $extend;
|
||||
$this->apiParas["extend"] = $extend;
|
||||
}
|
||||
|
||||
public function getExtend()
|
||||
{
|
||||
return $this->extend;
|
||||
}
|
||||
|
||||
public function setSessionTimeOut($sessionTimeOut)
|
||||
{
|
||||
$this->sessionTimeOut = $sessionTimeOut;
|
||||
$this->apiParas["session_time_out"] = $sessionTimeOut;
|
||||
}
|
||||
|
||||
public function getSessionTimeOut()
|
||||
{
|
||||
return $this->sessionTimeOut;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.voice.num.doublecall";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->calledNum,"calledNum");
|
||||
RequestCheckUtil::checkNotNull($this->calledShowNum,"calledShowNum");
|
||||
RequestCheckUtil::checkNotNull($this->callerNum,"callerNum");
|
||||
RequestCheckUtil::checkNotNull($this->callerShowNum,"callerShowNum");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: alibaba.aliqin.fc.voice.num.singlecall request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.01
|
||||
*/
|
||||
class AlibabaAliqinFcVoiceNumSinglecallRequest
|
||||
{
|
||||
/**
|
||||
* 被叫号码,支持国内手机号与固话号码,格式如下057188773344,13911112222,4001112222,95500
|
||||
**/
|
||||
private $calledNum;
|
||||
|
||||
/**
|
||||
* 被叫号显,传入的显示号码必须是阿里大鱼“管理中心-号码管理”中申请通过的号码
|
||||
**/
|
||||
private $calledShowNum;
|
||||
|
||||
/**
|
||||
* 公共回传参数,在“消息返回”中会透传回该参数;举例:用户可以传入自己下级的会员ID,在消息返回时,该会员ID会包含在内,用户可以根据该会员ID识别是哪位会员使用了你的应用
|
||||
**/
|
||||
private $extend;
|
||||
|
||||
/**
|
||||
* 语音文件ID,传入的语音文件必须是在阿里大鱼“管理中心-语音文件管理”中的可用语音文件
|
||||
**/
|
||||
private $voiceCode;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setCalledNum($calledNum)
|
||||
{
|
||||
$this->calledNum = $calledNum;
|
||||
$this->apiParas["called_num"] = $calledNum;
|
||||
}
|
||||
|
||||
public function getCalledNum()
|
||||
{
|
||||
return $this->calledNum;
|
||||
}
|
||||
|
||||
public function setCalledShowNum($calledShowNum)
|
||||
{
|
||||
$this->calledShowNum = $calledShowNum;
|
||||
$this->apiParas["called_show_num"] = $calledShowNum;
|
||||
}
|
||||
|
||||
public function getCalledShowNum()
|
||||
{
|
||||
return $this->calledShowNum;
|
||||
}
|
||||
|
||||
public function setExtend($extend)
|
||||
{
|
||||
$this->extend = $extend;
|
||||
$this->apiParas["extend"] = $extend;
|
||||
}
|
||||
|
||||
public function getExtend()
|
||||
{
|
||||
return $this->extend;
|
||||
}
|
||||
|
||||
public function setVoiceCode($voiceCode)
|
||||
{
|
||||
$this->voiceCode = $voiceCode;
|
||||
$this->apiParas["voice_code"] = $voiceCode;
|
||||
}
|
||||
|
||||
public function getVoiceCode()
|
||||
{
|
||||
return $this->voiceCode;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "alibaba.aliqin.fc.voice.num.singlecall";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->calledNum,"calledNum");
|
||||
RequestCheckUtil::checkNotNull($this->calledShowNum,"calledShowNum");
|
||||
RequestCheckUtil::checkNotNull($this->voiceCode,"voiceCode");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.appip.get request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2014.11.26
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.areas.get request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.04.13
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.httpdns.get request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.24
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.kfc.keyword.search request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.19
|
||||
*/
|
||||
class KfcKeywordSearchRequest
|
||||
{
|
||||
/**
|
||||
* 应用点,分为一级应用点、二级应用点。其中一级应用点通常是指某一个系统或产品,比如淘宝的商品应用(taobao_auction);二级应用点,是指一级应用点下的具体的分类,比如商品标题(title)、商品描述(content)。不同的二级应用可以设置不同关键词。
|
||||
|
||||
这里的apply参数是由一级应用点与二级应用点合起来的字符(一级应用点+"."+二级应用点),如taobao_auction.title。
|
||||
|
||||
|
||||
通常apply参数是不需要传递的。如有特殊需求(比如特殊的过滤需求,需要自己维护一套自己词库),需传递此参数。
|
||||
**/
|
||||
private $apply;
|
||||
|
||||
/**
|
||||
* 需要过滤的文本信息
|
||||
**/
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* 发布信息的淘宝会员名,可以不传
|
||||
**/
|
||||
private $nick;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setApply($apply)
|
||||
{
|
||||
$this->apply = $apply;
|
||||
$this->apiParas["apply"] = $apply;
|
||||
}
|
||||
|
||||
public function getApply()
|
||||
{
|
||||
return $this->apply;
|
||||
}
|
||||
|
||||
public function setContent($content)
|
||||
{
|
||||
$this->content = $content;
|
||||
$this->apiParas["content"] = $content;
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
public function setNick($nick)
|
||||
{
|
||||
$this->nick = $nick;
|
||||
$this->apiParas["nick"] = $nick;
|
||||
}
|
||||
|
||||
public function getNick()
|
||||
{
|
||||
return $this->nick;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.kfc.keyword.search";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->content,"content");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.time.get request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.03.28
|
||||
*/
|
||||
class TimeGetRequest
|
||||
{
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.time.get";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.top.auth.token.create request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.04.15
|
||||
*/
|
||||
class TopAuthTokenCreateRequest
|
||||
{
|
||||
/**
|
||||
* 授权code,grantType==authorization_code 时需要
|
||||
**/
|
||||
private $code;
|
||||
|
||||
/**
|
||||
* 与生成code的uuid配对
|
||||
**/
|
||||
private $uuid;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setCode($code)
|
||||
{
|
||||
$this->code = $code;
|
||||
$this->apiParas["code"] = $code;
|
||||
}
|
||||
|
||||
public function getCode()
|
||||
{
|
||||
return $this->code;
|
||||
}
|
||||
|
||||
public function setUuid($uuid)
|
||||
{
|
||||
$this->uuid = $uuid;
|
||||
$this->apiParas["uuid"] = $uuid;
|
||||
}
|
||||
|
||||
public function getUuid()
|
||||
{
|
||||
return $this->uuid;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.top.auth.token.create";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->code,"code");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.top.auth.token.refresh request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2015.08.20
|
||||
*/
|
||||
class TopAuthTokenRefreshRequest
|
||||
{
|
||||
/**
|
||||
* grantType==refresh_token 时需要
|
||||
**/
|
||||
private $refreshToken;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setRefreshToken($refreshToken)
|
||||
{
|
||||
$this->refreshToken = $refreshToken;
|
||||
$this->apiParas["refresh_token"] = $refreshToken;
|
||||
}
|
||||
|
||||
public function getRefreshToken()
|
||||
{
|
||||
return $this->refreshToken;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.top.auth.token.refresh";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->refreshToken,"refreshToken");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.top.ipout.get request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2015.09.07
|
||||
*/
|
||||
class TopIpoutGetRequest
|
||||
{
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.top.ipout.get";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.top.secret.get request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2016.04.06
|
||||
*/
|
||||
class TopSecretGetRequest
|
||||
{
|
||||
/**
|
||||
* 伪随机数
|
||||
**/
|
||||
private $randomNum;
|
||||
|
||||
/**
|
||||
* 秘钥版本号
|
||||
**/
|
||||
private $secretVersion;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setRandomNum($randomNum)
|
||||
{
|
||||
$this->randomNum = $randomNum;
|
||||
$this->apiParas["random_num"] = $randomNum;
|
||||
}
|
||||
|
||||
public function getRandomNum()
|
||||
{
|
||||
return $this->randomNum;
|
||||
}
|
||||
|
||||
public function setSecretVersion($secretVersion)
|
||||
{
|
||||
$this->secretVersion = $secretVersion;
|
||||
$this->apiParas["secret_version"] = $secretVersion;
|
||||
}
|
||||
|
||||
public function getSecretVersion()
|
||||
{
|
||||
return $this->secretVersion;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.top.secret.get";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->randomNum,"randomNum");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.topats.result.get request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2014.04.11
|
||||
*/
|
||||
class TopatsResultGetRequest
|
||||
{
|
||||
/**
|
||||
* 任务id号,创建任务时返回的task_id
|
||||
**/
|
||||
private $taskId;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setTaskId($taskId)
|
||||
{
|
||||
$this->taskId = $taskId;
|
||||
$this->apiParas["task_id"] = $taskId;
|
||||
}
|
||||
|
||||
public function getTaskId()
|
||||
{
|
||||
return $this->taskId;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.topats.result.get";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->taskId,"taskId");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* TOP API: taobao.topats.task.delete request
|
||||
*
|
||||
* @author auto create
|
||||
* @since 1.0, 2014.03.27
|
||||
*/
|
||||
class TopatsTaskDeleteRequest
|
||||
{
|
||||
/**
|
||||
* 需要取消的任务ID
|
||||
**/
|
||||
private $taskId;
|
||||
|
||||
private $apiParas = array();
|
||||
|
||||
public function setTaskId($taskId)
|
||||
{
|
||||
$this->taskId = $taskId;
|
||||
$this->apiParas["task_id"] = $taskId;
|
||||
}
|
||||
|
||||
public function getTaskId()
|
||||
{
|
||||
return $this->taskId;
|
||||
}
|
||||
|
||||
public function getApiMethodName()
|
||||
{
|
||||
return "taobao.topats.task.delete";
|
||||
}
|
||||
|
||||
public function getApiParas()
|
||||
{
|
||||
return $this->apiParas;
|
||||
}
|
||||
|
||||
public function check()
|
||||
{
|
||||
|
||||
RequestCheckUtil::checkNotNull($this->taskId,"taskId");
|
||||
}
|
||||
|
||||
public function putOtherTextParam($key, $value) {
|
||||
$this->apiParas[$key] = $value;
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user