From 97ee22dde66503aa78be9188763803a7800f7d0f Mon Sep 17 00:00:00 2001 From: Karson Date: Sat, 10 Mar 2018 21:08:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=91=BD=E4=BB=A4=E8=A1=8C?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E7=9A=84uid=E5=92=8Ctoken?= =?UTF-8?q?=E5=8F=82=E6=95=B0=20=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E8=BF=87=E9=95=BF=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E6=97=A0=E6=B3=95=E6=93=8D=E4=BD=9C=E7=9A=84BUG=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E5=8F=B0=E6=8F=92=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E6=9F=A5=E7=9C=8B=E6=8F=92=E4=BB=B6=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84BUG=20=E4=BF=AE=E5=A4=8D=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E6=97=B6=E9=AA=8C=E8=AF=81=E7=A0=81=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84BUG=20=E7=A7=BB=E9=99=A4User.php?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=99=A8=E4=B8=AD=E7=9A=84third=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Addon.php | 12 ++++-- application/admin/view/addon/index.html | 8 ++-- application/common/library/Auth.php | 9 ++-- application/index/controller/User.php | 51 ----------------------- application/index/view/user/register.html | 2 +- public/assets/js/backend/index.js | 2 +- 6 files changed, 21 insertions(+), 63 deletions(-) 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 @@
- + diff --git a/public/assets/js/backend/index.js b/public/assets/js/backend/index.js index de8a9394..064c2342 100755 --- a/public/assets/js/backend/index.js +++ b/public/assets/js/backend/index.js @@ -90,7 +90,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi if (ret.data && ignoreversion !== ret.data.newversion) { Layer.open({ title: '发现新版本', - area: ["500px", "auto"], + maxHeight: 400, content: '
你的版本是:' + ret.data.version + ',新版本:' + ret.data.newversion + '
更新说明
' + ret.data.upgradetext, btn: ['去下载更新', '忽略此次更新', '不再提示'], btn2: function (index, layero) {