浏览代码

优化插件管理请求接口

Karson 4 年之前
父节点
当前提交
5673ce72fd
共有 2 个文件被更改,包括 5 次插入61 次删除
  1. 0 57
      application/admin/controller/Addon.php
  2. 5 4
      public/assets/js/backend/addon.js

+ 0 - 57
application/admin/controller/Addon.php

@@ -368,63 +368,6 @@ class Addon extends Backend
     }
 
     /**
-     * 登录
-     */
-    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);
-    }
-
-    /**
      * 检测
      */
     public function isbuy()

+ 5 - 4
public/assets/js/backend/addon.js

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