mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-06 03:58:00 +08:00
modified 完善error跳转支持,完善应用授权配置
This commit is contained in:
parent
230be2ffb7
commit
f32ec2b869
@ -137,6 +137,10 @@ class AppManager extends Base {
|
|||||||
$this->success('操作成功!', url('AppManager/index'));
|
$this->success('操作成功!', url('AppManager/index'));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
$auth = cache(CacheType::AUTH_LIST_KEY);
|
||||||
|
// if( !$auth ){
|
||||||
|
// $this->error('请先配置认证方式!', url('OAuth/index'));
|
||||||
|
// }
|
||||||
$form = [
|
$form = [
|
||||||
'formTitle' => $this->menuInfo['name'],
|
'formTitle' => $this->menuInfo['name'],
|
||||||
'tempType' => 'add',
|
'tempType' => 'add',
|
||||||
@ -179,6 +183,16 @@ class AppManager extends Base {
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'module' => 'select',
|
||||||
|
'description' => '',
|
||||||
|
'info' => '认证方式:',
|
||||||
|
'attr' => [
|
||||||
|
'name' => 'oauth',
|
||||||
|
'value' => '',
|
||||||
|
'options' => $auth
|
||||||
|
]
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'module' => 'textarea',
|
'module' => 'textarea',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
@ -244,6 +258,10 @@ class AppManager extends Base {
|
|||||||
$appMemberModel->update($data);
|
$appMemberModel->update($data);
|
||||||
$this->success('操作成功!', url('AppManager/index'));
|
$this->success('操作成功!', url('AppManager/index'));
|
||||||
}else{
|
}else{
|
||||||
|
$auth = cache(CacheType::AUTH_LIST_KEY);
|
||||||
|
// if( !$auth ){
|
||||||
|
// $this->error('请先配置认证方式!', url('OAuth/index'));
|
||||||
|
// }
|
||||||
$detail = App::get($this->request->get($this->primaryKey))->toArray();
|
$detail = App::get($this->request->get($this->primaryKey))->toArray();
|
||||||
$form = [
|
$form = [
|
||||||
'formTitle' => $this->menuInfo['name'],
|
'formTitle' => $this->menuInfo['name'],
|
||||||
@ -297,6 +315,16 @@ class AppManager extends Base {
|
|||||||
]
|
]
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'module' => 'select',
|
||||||
|
'description' => '',
|
||||||
|
'info' => '认证方式:',
|
||||||
|
'attr' => [
|
||||||
|
'name' => 'oauth',
|
||||||
|
'value' => '',
|
||||||
|
'options' => $auth
|
||||||
|
]
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'module' => 'textarea',
|
'module' => 'textarea',
|
||||||
'description' => '',
|
'description' => '',
|
||||||
|
@ -129,7 +129,7 @@ class Base extends Controller {
|
|||||||
$sidOld = cache($this->uid);
|
$sidOld = cache($this->uid);
|
||||||
if( isset($sidOld) && !empty($sidOld) ){
|
if( isset($sidOld) && !empty($sidOld) ){
|
||||||
if( $sidOld != $sidNow ){
|
if( $sidOld != $sidNow ){
|
||||||
$this->error("您的账号在别的地方登录了,请重新登录!", url('User/login'));
|
$this->error("您的账号在别的地方登录了,请重新登录!", url('User/login'), ReturnCode::ERROR_BY_REFRESH_PAGE);
|
||||||
}else{
|
}else{
|
||||||
cache($this->uid, $sidNow, config('online_time'));
|
cache($this->uid, $sidNow, config('online_time'));
|
||||||
$this->userInfo = User::get([ $this->primaryKey => $this->uid ])->toArray();
|
$this->userInfo = User::get([ $this->primaryKey => $this->uid ])->toArray();
|
||||||
@ -142,7 +142,7 @@ class Base extends Controller {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->error("登录超时,请重新登录!", url('User/login'));
|
$this->error("登录超时,请重新登录!", url('User/login'), ReturnCode::ERROR_BY_REFRESH_PAGE);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->redirect('User/login');
|
$this->redirect('User/login');
|
||||||
|
@ -12,5 +12,6 @@ class CacheType {
|
|||||||
|
|
||||||
const FILTER_LIST_KEY = 'ApiAdmin:FilterList';
|
const FILTER_LIST_KEY = 'ApiAdmin:FilterList';
|
||||||
const APP_LIST_KEY = 'ApiAdmin:AppList';
|
const APP_LIST_KEY = 'ApiAdmin:AppList';
|
||||||
|
const AUTH_LIST_KEY = 'ApiAdmin:AuthList';
|
||||||
|
|
||||||
}
|
}
|
@ -15,4 +15,7 @@ class ReturnCode {
|
|||||||
const ERROR = 0;
|
const ERROR = 0;
|
||||||
const GET_TEMPLATE_ERROR = 404;
|
const GET_TEMPLATE_ERROR = 404;
|
||||||
|
|
||||||
|
const ERROR_BY_REFRESH_PAGE = 302;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -96,7 +96,11 @@
|
|||||||
$.alertMsg(data.msg);
|
$.alertMsg(data.msg);
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if (data.url) {
|
if (data.url) {
|
||||||
location.href = data.url;
|
if( data.data == 302 ){
|
||||||
|
location.href = data.url;
|
||||||
|
}else{
|
||||||
|
$.refresh(data.url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 1000*data.wait);
|
}, 1000*data.wait);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user