mirror of https://gitee.com/karson/fastadmin.git
优化插件管理请求接口
parent
4fa13dca39
commit
5673ce72fd
|
|
@ -367,63 +367,6 @@ class Addon extends Backend
|
|||
return $callback($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
$params = [
|
||||
'account' => $this->request->post('account'),
|
||||
'password' => $this->request->post('password'),
|
||||
'url' => $this->request->url(true),
|
||||
'faversion' => config('fastadmin.version')
|
||||
];
|
||||
try {
|
||||
$result = Service::login($params);
|
||||
} catch (Exception $e) {
|
||||
$this->error(__($e->getMessage()));
|
||||
}
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员信息
|
||||
*/
|
||||
public function userinfo()
|
||||
{
|
||||
$params = [
|
||||
'uid' => $this->request->post('uid'),
|
||||
'token' => $this->request->post('token'),
|
||||
'url' => $this->request->url(true),
|
||||
'faversion' => config('fastadmin.version')
|
||||
];
|
||||
try {
|
||||
$result = Service::userinfo($params);
|
||||
} catch (Exception $e) {
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
$params = [
|
||||
'uid' => $this->request->post('uid'),
|
||||
'token' => $this->request->post('token'),
|
||||
'url' => $this->request->url(true),
|
||||
'faversion' => config('fastadmin.version')
|
||||
];
|
||||
try {
|
||||
$result = Service::logout($params);
|
||||
} catch (Exception $e) {
|
||||
$this->error(__($e->getMessage()));
|
||||
}
|
||||
return json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
|||
btn: [__('Login'), __('Register')],
|
||||
yes: function (index, layero) {
|
||||
Fast.api.ajax({
|
||||
url: 'addon/login',
|
||||
url: Config.api_url + '/user/login',
|
||||
type: 'post',
|
||||
data: {
|
||||
account: $("#inputAccount", layero).val(),
|
||||
|
|
@ -338,10 +338,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
|||
});
|
||||
} else {
|
||||
Fast.api.ajax({
|
||||
url: 'addon/userinfo',
|
||||
url: Config.api_url + '/user/index',
|
||||
data: {
|
||||
uid: userinfo.id,
|
||||
token: userinfo.token,
|
||||
version: Config.faversion,
|
||||
}
|
||||
}, function (data) {
|
||||
Layer.open({
|
||||
|
|
@ -352,8 +353,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
|||
btn: [__('Logout'), __('Cancel')],
|
||||
yes: function () {
|
||||
Fast.api.ajax({
|
||||
url: 'addon/logout',
|
||||
data: {uid: userinfo.id, token: userinfo.token}
|
||||
url: Config.api_url + '/user/logout',
|
||||
data: {uid: userinfo.id, token: userinfo.token, version: Config.faversion}
|
||||
}, function (data, ret) {
|
||||
Controller.api.userinfo.set(null);
|
||||
Layer.closeAll();
|
||||
|
|
|
|||
Loading…
Reference in New Issue