mirror of https://gitee.com/karson/fastadmin.git
优化插件管理请求接口
parent
4fa13dca39
commit
5673ce72fd
|
|
@ -367,63 +367,6 @@ class Addon extends Backend
|
||||||
return $callback($result);
|
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')],
|
btn: [__('Login'), __('Register')],
|
||||||
yes: function (index, layero) {
|
yes: function (index, layero) {
|
||||||
Fast.api.ajax({
|
Fast.api.ajax({
|
||||||
url: 'addon/login',
|
url: Config.api_url + '/user/login',
|
||||||
type: 'post',
|
type: 'post',
|
||||||
data: {
|
data: {
|
||||||
account: $("#inputAccount", layero).val(),
|
account: $("#inputAccount", layero).val(),
|
||||||
|
|
@ -338,10 +338,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
Fast.api.ajax({
|
Fast.api.ajax({
|
||||||
url: 'addon/userinfo',
|
url: Config.api_url + '/user/index',
|
||||||
data: {
|
data: {
|
||||||
uid: userinfo.id,
|
uid: userinfo.id,
|
||||||
token: userinfo.token,
|
token: userinfo.token,
|
||||||
|
version: Config.faversion,
|
||||||
}
|
}
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
Layer.open({
|
Layer.open({
|
||||||
|
|
@ -352,8 +353,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
|
||||||
btn: [__('Logout'), __('Cancel')],
|
btn: [__('Logout'), __('Cancel')],
|
||||||
yes: function () {
|
yes: function () {
|
||||||
Fast.api.ajax({
|
Fast.api.ajax({
|
||||||
url: 'addon/logout',
|
url: Config.api_url + '/user/logout',
|
||||||
data: {uid: userinfo.id, token: userinfo.token}
|
data: {uid: userinfo.id, token: userinfo.token, version: Config.faversion}
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
Controller.api.userinfo.set(null);
|
Controller.api.userinfo.set(null);
|
||||||
Layer.closeAll();
|
Layer.closeAll();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue