优化插件管理请求接口

pull/354/MERGE
Karson 2022-01-01 01:59:32 +08:00
parent 4fa13dca39
commit 5673ce72fd
2 changed files with 5 additions and 61 deletions

View File

@ -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);
}
/**
* 检测
*/

View File

@ -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();