diff --git a/application/admin/command/Addon.php b/application/admin/command/Addon.php index 8c09824c..e2cde5fe 100644 --- a/application/admin/command/Addon.php +++ b/application/admin/command/Addon.php @@ -24,6 +24,8 @@ class Addon extends Command ->addOption('action', 'c', Option::VALUE_REQUIRED, 'action(create/enable/disable/install/uninstall/refresh/upgrade/package)', 'create') ->addOption('force', 'f', Option::VALUE_OPTIONAL, 'force override', null) ->addOption('release', 'r', Option::VALUE_OPTIONAL, 'addon release version', null) + ->addOption('uid', 'u', Option::VALUE_OPTIONAL, 'fastadmin uid', null) + ->addOption('token', 't', Option::VALUE_OPTIONAL, 'fastadmin token', null) ->setDescription('Addon manager'); } @@ -35,6 +37,10 @@ class Addon extends Command $force = $input->getOption('force'); //版本 $release = $input->getOption('release') ?: ''; + //uid + $uid = $input->getOption('uid') ?: ''; + //token + $token = $input->getOption('token') ?: ''; include dirname(__DIR__) . DS . 'common.php'; @@ -80,7 +86,7 @@ class Addon extends Command } catch (PDOException $e) { - + } $data = [ @@ -171,7 +177,7 @@ class Addon extends Command { throw new Exception("Operation is aborted!"); } - Service::install($name, 1, ['version' => $release]); + Service::install($name, 1, ['version' => $release, 'uid' => $uid, 'token' => $token]); } catch (Exception $e) { @@ -222,7 +228,7 @@ class Addon extends Command $output->info("Refresh Successed!"); break; case 'upgrade': - Service::upgrade($name, ['version' => $release]); + Service::upgrade($name, ['version' => $release, 'uid' => $uid, 'token' => $token]); $output->info("Upgrade Successed!"); break; case 'package': diff --git a/application/admin/view/addon/index.html b/application/admin/view/addon/index.html index e22e7e9b..9015ff1f 100644 --- a/application/admin/view/addon/index.html +++ b/application/admin/view/addon/index.html @@ -212,8 +212,8 @@
@@ -244,8 +244,8 @@ diff --git a/application/common/library/Auth.php b/application/common/library/Auth.php index b4bb7a5d..8ab8199e 100644 --- a/application/common/library/Auth.php +++ b/application/common/library/Auth.php @@ -128,7 +128,7 @@ class Auth * @param string $password 密码 * @param string $email 邮箱 * @param string $mobile 手机号 - * @param string $extend 扩展参数 + * @param array $extend 扩展参数 * @return boolean */ public function register($username, $password, $email = '', $mobile = '', $extend = []) @@ -224,7 +224,7 @@ class Auth * * @param string $account 账号,用户名、邮箱、手机号 * @param string $password 密码 - * @return array + * @return boolean */ public function login($account, $password) { @@ -256,7 +256,7 @@ class Auth /** * 注销 * - * @return bool + * @return boolean */ public function logout() { @@ -476,6 +476,7 @@ class Auth /** * 删除一个指定会员 * @param int $user_id 会员ID + * @return boolean */ public function delete($user_id) { @@ -528,6 +529,7 @@ class Auth * 检测当前控制器和方法是否匹配传递的数组 * * @param array $arr 需要验证权限的数组 + * @return boolean */ public function match($arr = []) { @@ -600,6 +602,7 @@ class Auth * 设置错误信息 * * @param $error 错误信息 + * @return Auth */ public function setError($error) { diff --git a/application/index/controller/User.php b/application/index/controller/User.php index b5c4902f..73e66abc 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -203,57 +203,6 @@ class User extends Frontend $this->success(__('Logout successful') . $synchtml, url('user/index')); } - /** - * 第三方登录跳转和回调处理 - */ - public function third() - { - $url = url('user/index'); - $action = $this->request->param('action'); - $platform = $this->request->param('platform'); - $config = get_addon_config('third'); - if (!$config || !isset($config[$platform])) - { - $this->error(__('Invalid parameters')); - } - foreach ($config as $k => &$v) - { - $v['callback'] = url('user/third', ['action' => 'callback', 'platform' => $k], false, true); - } - unset($v); - $app = new \addons\third\library\Application($config); - if ($action == 'redirect') - { - // 跳转到登录授权页面 - $this->redirect($app->{$platform}->getAuthorizeUrl()); - } - else if ($action == 'callback') - { - // 授权成功后的回调 - $result = $app->{$platform}->getUserInfo(); - if ($result) - { - $loginret = \addons\third\library\Service::connect($platform, $result); - if ($loginret) - { - $synchtml = ''; - ////////////////同步到Ucenter//////////////// - if (defined('UC_STATUS') && UC_STATUS) - { - $uc = new \addons\ucenter\library\client\Client(); - $synchtml = $uc->uc_user_synlogin($this->auth->id); - } - $this->success(__('Logged in successful') . $synchtml, $url); - } - } - $this->error(__('Operation failed'), $url); - } - else - { - $this->error(__('Invalid parameters')); - } - } - /** * 个人信息 */ diff --git a/application/index/view/user/register.html b/application/index/view/user/register.html index 9ffe3902..34e6180f 100644 --- a/application/index/view/user/register.html +++ b/application/index/view/user/register.html @@ -36,7 +36,7 @@