* adjust for sendcloud.

This commit is contained in:
wangyidong
2016-12-19 16:34:33 +08:00
parent 9447a00b75
commit 22eb0f10cd
5 changed files with 30 additions and 26 deletions
+13 -18
View File
@@ -109,7 +109,7 @@ class adminModel extends model
*/
public function registerByAPI()
{
$apiURL = 'http://www.zentao.net/user-register.json';
$apiURL = 'http://www.zentao.net/user-register.json?bind=yes&HTTP_X_REQUESTED_WITH=XMLHttpRequest';
return $this->postAPI($apiURL, $_POST);
}
@@ -121,17 +121,16 @@ class adminModel extends model
*/
public function bindByAPI()
{
$apiURL = 'http://www.zentao.net/user-login.json';
$apiURL = 'http://www.zentao.net/user-bindChanzhi.json?HTTP_X_REQUESTED_WITH=XMLHttpRequest';
return $this->postAPI($apiURL, $_POST);
}
public function getSecretKey()
{
//$apiURL = "http://www.zentao.net/user-secretKey.json";
$apiURL = "http://www.zentao.cn/user-secretKey.json";
$params['account'] = $this->config->global->community;
$apiURL = "http://www.zentao.net/user-secretKey.json";
$params['u'] = $this->config->global->community;
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$params['signature'] = $this->getSignature($params);
$params['k'] = $this->getSignature($params);
$this->agent->cookies['lang'] = $this->cookie->lang;
$this->agent->fetch($apiURL . '?' . http_build_query($params));
$result = $this->agent->results;
@@ -142,11 +141,10 @@ class adminModel extends model
public function sendCodeByAPI($type)
{
$module = $type == 'mobile' ? 'sms' : 'mail';
// $apiURL = "http://www.zentao.net/{$module}-apiSendCode.json";
$apiURL = "http://www.zentao.cn/{$module}-apiSendCode.json";
$params['account'] = $this->config->global->community;
$apiURL = "http://www.zentao.net/{$module}-apiSendCode.json";
$params['u'] = $this->config->global->community;
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$params['signature'] = $this->getSignature($params);
$params['k'] = $this->getSignature($params);
$param = http_build_query($params);
return $this->postAPI($apiURL . '?' . $param, $_POST);
@@ -155,11 +153,10 @@ class adminModel extends model
public function certifyByAPI($type)
{
$module = $type == 'mobile' ? 'sms' : 'mail';
// $apiURL = "http://www.zentao.net/{$module}-apiCertify.json";
$apiURL = "http://www.zentao.cn/{$module}-apiCertify.json";
$params['account'] = $this->config->global->community;
$apiURL = "http://www.zentao.net/{$module}-apiCertify.json";
$params['u'] = $this->config->global->community;
$params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$params['signature'] = $this->getSignature($params);
$params['k'] = $this->getSignature($params);
$param = http_build_query($params);
return $this->postAPI($apiURL . '?' . $param, $_POST);
@@ -167,11 +164,9 @@ class adminModel extends model
public function getSignature($params)
{
ksort($params);
$data = '';
foreach($params as $key => $value) $data .= $key . '=' . $value . '&';
unset($params['u']);
$privateKey = $this->config->global->ztPrivateKey;
return md5($privateKey . '&' . $data . $privateKey);
return md5(http_build_query($params) . md5($privateKey));
}
/**