diff --git a/module/admin/model.php b/module/admin/model.php index 9ea7bee428..5e9ab0a091 100755 --- a/module/admin/model.php +++ b/module/admin/model.php @@ -15,17 +15,18 @@ declare(strict_types=1); class adminModel extends model { /** + * 获取密钥。 * Get secret key. * * @access public * @return object */ - public function getSecretKey() + public function getSecretKey(): object { $apiConfig = $this->getApiConfig(); $apiURL = $this->config->admin->apiRoot . "/user-secretKey.json"; - $params['u'] = $this->config->global->community; + $params['u'] = $this->config->global->community; $params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'; $params[$apiConfig->sessionVar] = $apiConfig->sessionID; $params['k'] = $this->getSignature($params); @@ -36,13 +37,14 @@ class adminModel extends model } /** + * 获取签名。 * Get signature. * * @param array $params * @access public * @return string */ - public function getSignature($params) + public function getSignature(array $params): string { unset($params['u']); $privateKey = $this->config->global->ztPrivateKey; diff --git a/module/admin/test/admin.class.php b/module/admin/test/admin.class.php index fc2b9b6e51..7703330dab 100644 --- a/module/admin/test/admin.class.php +++ b/module/admin/test/admin.class.php @@ -4,50 +4,10 @@ class adminTest public function __construct() { global $tester; - global $config; - global $app; $this->objectModel = $tester->loadModel('admin'); $this->user = $tester->loadModel('user'); - $this->communityConfig = $app->loadConfig('community'); - $this->adminConfig = $config->admin; } - public function getSecretKeyTest() - { - $objects = $this->objectModel->getSecretKey(); - - if(dao::isError()) return dao::getError(); - - return $objects; - } - - /** - * Get signature. - * - * @param array $params - * @access public - * @return string - */ - public function getSignatureTest() - { - $params['u'] = $this->communityConfig; - $params['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequet'; - - $apiConfig = $this->objectModel->getApiConfig(); - $params[$apiConfig->sessionVar] = $apiConfig->sessionID; - - $objects = $this->objectModel->getSignature($params); - - if(dao::isError()) return dao::getError(); - - if($objects){ - return true; - }else{ - return false; - } - } - - public function getApiConfigTest() { $objects = $this->objectModel->getApiConfig(); diff --git a/module/admin/test/model/getapiconfig.php.bak b/module/admin/test/model/getapiconfig.php.bak deleted file mode 100755 index 3293350d96..0000000000 --- a/module/admin/test/model/getapiconfig.php.bak +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env php -getApiConfig(); -cid=1 -pid=1 - - - -*/ - -$admin = new adminTest(); - -r($admin->getApiConfigTest()) && p() && e(); \ No newline at end of file diff --git a/module/admin/test/model/getsecretkey.php.bak b/module/admin/test/model/getsecretkey.php.bak deleted file mode 100755 index 60e1f74a66..0000000000 --- a/module/admin/test/model/getsecretkey.php.bak +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env php -getSecretKey(); -cid=1 -pid=1 - - - -*/ - -$admin = new adminTest(); - -r($admin->getSecretKeyTest()) && p() && e(); \ No newline at end of file diff --git a/module/admin/test/model/getsignature.php b/module/admin/test/model/getsignature.php deleted file mode 100755 index e3407089e6..0000000000 --- a/module/admin/test/model/getsignature.php +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env php -getSignature(); -cid=1 -pid=1 - -正常测试 >> 1 - -*/ -$admin = new adminTest(); - -r($admin->getSignatureTest()) && p() && e('1'); //正常测试 \ No newline at end of file