李浩杰 4 tahun lalu
induk
melakukan
3e22ed5d14

+ 122 - 0
app/Http/Controllers/Admin/AdminUserResetController.php

xqd
@@ -0,0 +1,122 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\AdminRoleModel;
+use App\Models\AdminUserModel;
+use App\Models\AdminUserReset;
+use App\Models\Department;
+use App\Models\Road;
+use Illuminate\Http\Request;
+
+class AdminUserResetController extends BaseController
+{
+    protected $model;
+
+    protected $department;
+
+    protected $model_name = '密码重置';
+
+    protected $pre_uri = '/admin/AdminUserReset/';
+
+    protected $view_path = 'admin.admin-user-resets.';
+
+    protected $redirect_index = '/admin/AdminUserReset/index';
+
+    public function __construct()
+    {
+        $this->model = new AdminUserReset();
+    }
+
+    public function index()
+    {
+        list($model, $model_name, $pre_uri) = array($this->model, $this->model_name, $this->pre_uri);
+        return view($this->view_path . 'index', compact('model', 'model_name','pre_uri'));
+    }
+
+    public function get(Request $request)
+    {
+        $items = $this->model->where('id', '>', 0)->orderBy('updated_at', 'desc');
+
+        $tmp_items = collect(['name']);
+        foreach($tmp_items as $tmp_item) {
+            if($request->has($tmp_item) && !empty($request->input($tmp_item))) {
+                $items = $items->where($tmp_item, 'like', '%' . $request->input($tmp_item) . '%');
+            }
+        }
+
+        $select_items = collect([]);
+        foreach($select_items as $select_item) {
+            if($request->has($select_item) && !empty($request->input($select_item))) {
+                $items = $items->where($select_item, '=', $request->input($select_item));
+            }
+        }
+
+        $items = $items->paginate();
+
+        foreach($items as $item) {
+            $item->status = $item->status == 1 ? '<span class="layui-badge">待重置</span>' : '<span class="layui-badge layui-bg-green">已重置</span>';
+        }
+
+        return response()->json(['code' => 0, 'message' => '', 'count' => $items->total(), 'data' => $items->items()]);
+    }
+
+    public function create()
+    {
+        list($model, $model_name, $pre_uri) = array($this->model, $this->model_name, $this->pre_uri);
+        return view($this->view_path . 'create', compact('model', 'model_name','pre_uri'));
+    }
+
+    public function store(Request $request)
+    {
+        if(empty($request->input('data')) || !is_array($request->input('data'))) return back()->withErrors(['sg_error_info' => '数据错误']);
+        $validator = $this->model->getValidator($request, 'store');
+        if($validator->fails()) {
+            return back()->withErrors($validator)->withInput();
+        }
+        $data = $request->input('data');
+        $res = $this->model->create($data);
+        if(empty($res)) return back()->withErrors(['sg_error_info' => '保存失败']);
+        return redirect($this->pre_uri . 'create')->with(['sg_success_info' => '创建成功']);
+    }
+
+    public function edit(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) return back()->withErrors(['sg_error_info' => '找不到要编辑的数据']);
+        list($model, $model_name, $pre_uri) = array($this->model, $this->model_name, $this->pre_uri);
+        return view($this->view_path . 'edit', compact('model', 'model_name', 'pre_uri', 'item'));
+    }
+
+    public function update(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) return back()->withErrors(['sg_error_info' => '找不到要编辑的数据']);
+        if(empty($request->input('data')) || !is_array($request->input('data'))) return back()->withErrors(['sg_error_info' => '数据错误']);
+        $validator = $this->model->getValidator($request, 'update');
+        if($validator->fails()) {
+            return back()->withErrors($validator)->withInput();
+        }
+        $data = $request->input('data');
+        $res = $this->model->where('id', $request->input('id'))->update($data);
+        if(!$res) return back()->withErrors(['sg_error_info' => '数据库保存失败!']);
+        return back()->with(['sg_success_info' => '编辑成功']);
+    }
+
+    public function delete(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) return response()->json(['status' => 'fail', 'info' => '找不到要删除的数据']);
+        $res = $item->delete();
+        if (!$res) return response()->json(['status' => 'fail', 'info' => '删除失败']);
+        return response()->json(['status' => 'success', 'info' => '操作成功']);
+    }
+
+    public function reset(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) return response()->json(['status' => 'fail', 'info' => '找不到数据']);
+        $admin_user = AdminUserModel::find($item->admin_user_id);
+        if(empty($admin_user)) return response()->json(['status' => 'fail', 'info' => '找不到数据']);
+        $res = $admin_user->update(['password' => bcrypt('123456')]);
+        $item->update(['status' => 2]);
+        if (!$res) return response()->json(['status' => 'fail', 'info' => '操作失败']);
+        return response()->json(['status' => 'success', 'info' => '操作成功']);
+    }
+}

+ 34 - 0
app/Http/Controllers/Api/mini/AuthController.php

xqd
@@ -0,0 +1,34 @@
+<?php
+
+namespace App\Http\Controllers\Api\mini;
+
+use App\Models\AdminUserModel;
+use App\Models\AdminUserReset;
+use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Auth;
+
+class AuthController extends BaseController
+{
+    public function login(Request $request)
+    {
+        $credentials = $request->only('mobile', 'password');
+        if(Auth::guard('admin')->attempt($credentials)) {
+            $admin_user = Auth::guard('admin')->user();
+            $admin_user->updateToken();
+            return $this->success(['data' => $admin_user]);
+        }
+        return $this->error(['msg' => '账号或密码错误']);
+    }
+
+    public function reset(Request $request)
+    {
+        $admin_user = AdminUserModel::where('mobile', $request->input('mobile'))->first();
+        if(!$admin_user) return $this->error(['msg' => '账号不存在']);
+        AdminUserReset::create([
+            'admin_user_id' => $admin_user->id,
+            'mobile' => $request->input('mobile'),
+            'name' => $request->input('name')
+        ]);
+        return $this->success();
+    }
+}

+ 24 - 0
app/Http/Controllers/Api/mini/BaseController.php

xqd
@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Http\Controllers\Api\mini;
+
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+
+class BaseController extends Controller
+{
+    public function error($data = [])
+    {
+        return $this->response(collect(['code' => -1])->merge(collect($data)));
+    }
+
+    public function success($data = [])
+    {
+        return $this->response(collect(['code' => 0, 'msg' => '操作成功'])->merge(collect($data)));
+    }
+
+    public function response($data = [])
+    {
+        return response()->json($data);
+    }
+}

+ 14 - 0
app/Http/Controllers/Api/mini/TestController.php

xqd
@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Http\Controllers\Api\mini;
+
+use Illuminate\Http\Request;
+use App\Http\Controllers\Controller;
+
+class TestController extends Controller
+{
+    public function index(Request $request)
+    {
+        dd(collect(['msg' => '操作成功'])->merge(['msg' => '操作失败']));
+    }
+}

+ 4 - 0
app/Http/Kernel.php

xqd
@@ -42,6 +42,10 @@ class Kernel extends HttpKernel
             'throttle:60,1',
             'bindings',
         ],
+
+        'mini' => [
+            \App\Http\Middleware\AuthMini::class
+        ]
     ];
 
     /**

+ 31 - 0
app/Http/Middleware/AuthMini.php

xqd
@@ -0,0 +1,31 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use App\Models\AdminUserModel;
+use Closure;
+use Illuminate\Support\Facades\Auth;
+
+class AuthMini
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param  \Illuminate\Http\Request  $request
+     * @param  \Closure  $next
+     * @return mixed
+     */
+    public function handle($request, Closure $next)
+    {
+        if(in_array($request->path(), ['api/mini/login', 'api/mini/reset', 'api/mini/test'])) return $next($request);
+        $token = $request->header('X-Token');
+        if($token) {
+            $admin_user = AdminUserModel::where('token', $token)->first();
+            if(!empty($admin_user)) {
+                Auth::guard('admin')->login($admin_user);
+                return $next($request);
+            }
+        }
+        return response()->json(['code' => -1, 'msg' => '请先登录']);
+    }
+}

+ 8 - 0
app/Models/AdminUserModel.php

xqd xqd
@@ -16,6 +16,7 @@ use Illuminate\Foundation\Auth\User as Authenticatable;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Validator;
+use Illuminate\Support\Str;
 
 class AdminUserModel extends Authenticatable
 {
@@ -63,4 +64,11 @@ class AdminUserModel extends Authenticatable
     {
         return $this->belongsTo('App\Models\AdminRoleModel', 'admin_role_id');
     }
+
+    public function updateToken()
+    {
+        $token = Str::random(60);
+        $token = hash('sha256', $token);
+        $this->update(['token' => $token]);
+    }
 }

+ 10 - 0
app/Models/AdminUserReset.php

xqd
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class AdminUserReset extends Model
+{
+    protected $guarded = [];
+}

+ 30 - 0
database/migrations/2020_11_29_030022_add_token_to_admin_users.php

xqd
@@ -0,0 +1,30 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddTokenToAdminUsers extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('admin_users', function (Blueprint $table) {
+            $table->string('token', 200)->nullable()->comment('token')->after('admin_role_id');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+}

+ 35 - 0
database/migrations/2020_11_29_091001_create_admin_user_resets_table.php

xqd
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateAdminUserResetsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('admin_user_resets', function (Blueprint $table) {
+            $table->increments('id');
+            $table->unsignedInteger('admin_user_id')->nullable();
+            $table->string('mobile', 200)->nullable();
+            $table->string('name', 200)->nullable();
+            $table->tinyInteger('status')->default(1)->comment('1待审核,2重置,3驳回');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('admin_user_resets');
+    }
+}

+ 1 - 1
database/seeds/AdminMenuSeeder.php

xqd
@@ -14,7 +14,7 @@ class AdminMenuSeeder extends Seeder
     public function run()
     {
         $fileSystem = new Filesystem();
-        $database = $fileSystem->get(base_path('database/seeds') . '/' . 'admin_menu.sql');
+        $database = $fileSystem->get(base_path('database/seeds') . '/' . 'railway_two.sql');
         DB::connection()->getPdo()->exec($database);
     }
 }

+ 136 - 0
database/seeds/railway_two.sql

xqd
@@ -0,0 +1,136 @@
+-- phpMyAdmin SQL Dump
+-- version 4.7.4
+-- https://www.phpmyadmin.net/
+--
+-- Host: 127.0.0.1:3306
+-- Generation Time: 2020-12-03 07:07:10
+-- 服务器版本: 5.7.19
+-- PHP Version: 7.3.10
+
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+SET AUTOCOMMIT = 0;
+START TRANSACTION;
+SET time_zone = "+00:00";
+
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8mb4 */;
+
+--
+-- Database: `railway_two`
+--
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `admin_menus`
+--
+
+DROP TABLE IF EXISTS `admin_menus`;
+CREATE TABLE IF NOT EXISTS `admin_menus` (
+  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+  `pid` int(11) NOT NULL,
+  `path` char(60) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'URL',
+  `name` char(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '节点的名字',
+  `display` tinyint(4) NOT NULL DEFAULT '1' COMMENT '1为显示为菜单,0则不显示',
+  `sort` int(11) NOT NULL DEFAULT '1' COMMENT '排序',
+  `level` tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几级菜单',
+  `ico` char(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '菜单图标',
+  `mark` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '备注',
+  `created_at` timestamp NULL DEFAULT NULL,
+  `updated_at` timestamp NULL DEFAULT NULL,
+  `deleted_at` timestamp NULL DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `idx_deleted_at` (`deleted_at`)
+) ENGINE=MyISAM AUTO_INCREMENT=612 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- 转存表中的数据 `admin_menus`
+--
+
+INSERT INTO `admin_menus` (`id`, `pid`, `path`, `name`, `display`, `sort`, `level`, `ico`, `mark`, `created_at`, `updated_at`, `deleted_at`) VALUES
+(1, 0, '#', '系统管理', 0, 2, 1, 'fa-globe', '', '2016-12-31 16:00:00', '2020-11-28 04:07:16', NULL),
+(2, 0, '#', '账号管理', 1, 99, 1, 'fa-users', '', '2016-12-31 16:00:00', '2020-11-28 05:08:30', NULL),
+(3, 0, '#', '商品管理', 0, 98, 1, 'fa-calendar', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(5, 0, '#', '公共权限', 0, 0, 1, 'fa-cart-plus', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(6, 0, '#', '缓存管理', 0, 94, 1, 'fa-magic', '', '2016-12-31 16:00:00', '2020-11-28 04:06:58', NULL),
+(7, 0, '#', '数据报表', 0, 96, 1, 'fa-globe', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(9, 0, '#', '参数设置', 0, 95, 1, 'fa-bar-chart-o', '', '2017-01-04 10:32:17', '2020-11-28 04:06:49', NULL),
+(103, 1, 'Base/Menus/index', '菜单管理', 1, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(104, 1, 'Base/Role/index', '角色管理', 1, 0, 2, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(105, 1, 'Base/User/index', '账号管理', 1, 0, 2, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(501, 5, 'Base/Index/index', '首页(必选)', 0, 0, 2, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(502, 5, 'Base/Index/welcome', '欢迎页', 0, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(503, 5, 'Base/Login/logout', '退出页', 0, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(519, 103, 'Base/Menus/create', '添加菜单', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(520, 103, 'Base/Menus/update', '修改菜单', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(521, 103, 'Base/Menus/destroy', '删除菜单', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(522, 104, 'Base/Role/create', '添加角色', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(523, 104, 'Base/Role/update', '修改角色', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(524, 104, 'Base/Role/auth', '角色授权', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(525, 104, 'Base/Role/destroy', '删除角色', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(526, 105, 'Base/User/update', '编辑用户', 0, 0, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(543, 5, 'Base/Attachment/upload', '编辑器上传', 0, 0, 2, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(544, 105, 'Base/User/auth', '为用户授权', 0, 1, 3, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(578, 1, 'Base/Crud/create', 'Crud', 1, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(579, 6, 'Cache/File/clearcache', '清空缓存', 1, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(580, 6, 'Cache/File/clearview', '清空模板缓存', 1, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(581, 6, 'Cache/File/clearsessions', '强制在线用户下线', 1, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(582, 6, 'Cache/File/index', '文件管理', 1, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(583, 6, 'Cache/File/view', '文件查看', 0, 0, 1, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(596, 1, 'Base/Settings/index', '系统配置', 1, 0, 2, '', '', '2016-03-29 11:42:29', '2016-03-29 11:42:29', NULL),
+(597, 2, 'AdminUser/index', '账号列表', 1, 110, 2, '', '账号列表', '2017-04-04 22:39:13', '2020-11-28 05:08:45', NULL),
+(610, 2, 'AdminRole/index', '角色列表', 1, 100, 2, 'fa-bar-chart-o', '角色列表', '2020-11-28 04:10:41', '2020-11-28 04:10:42', NULL),
+(542, 5, 'Foundation/Attachment/webupload', '文件上传', 0, 0, 2, '', '', '2016-12-31 16:00:00', '2016-12-31 16:00:00', NULL),
+(604, 596, 'Base/Settings/create', '添加', 0, 1, 1, '', ' ', '2017-05-30 20:56:09', '2017-05-30 20:56:09', NULL),
+(605, 596, 'Base/Settings/update', '修改', 0, 1, 1, '', ' ', '2017-05-30 20:56:09', '2017-05-30 20:56:09', NULL),
+(606, 596, 'Base/Settings/destroy', '删除', 0, 1, 1, '', ' ', '2017-05-30 20:56:09', '2017-05-30 20:56:09', NULL),
+(607, 596, 'Base/Settings/view', '查看', 0, 1, 1, '', ' ', '2017-05-30 20:56:09', '2017-05-30 20:56:09', NULL),
+(608, 596, 'Base/Settings/check', '选择数据', 0, 1, 1, '', ' ', '2017-05-30 20:56:09', '2017-05-30 20:56:09', NULL),
+(609, 1, 'Base/Photos/index', '图片管理', 1, 1, 2, '', '图片管理', '2017-08-01 22:43:20', '2017-08-01 22:43:21', NULL),
+(611, 2, '/AdminUserReset/index', '密码重置', 1, 90, 2, 'fa-bar-chart-o', '密码重置', '2020-12-02 00:05:37', '2020-12-02 00:08:13', NULL);
+
+-- --------------------------------------------------------
+
+--
+-- 表的结构 `admin_users`
+--
+
+DROP TABLE IF EXISTS `admin_users`;
+CREATE TABLE IF NOT EXISTS `admin_users` (
+  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户ID',
+  `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户名',
+  `real_name` char(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '实名',
+  `password` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '密码',
+  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
+  `email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'EMAIL',
+  `mobile` char(11) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '手机号',
+  `avatar` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '用户头像',
+  `type` tinyint(4) DEFAULT NULL COMMENT '类型,0:用户,1:员工',
+  `last_login_time` datetime DEFAULT NULL COMMENT '最后一次登录时间',
+  `status` tinyint(4) DEFAULT '1' COMMENT '状态,1启用0禁用',
+  `is_root` tinyint(4) DEFAULT NULL COMMENT '是否是超级管理员',
+  `admin_role_id` text COLLATE utf8mb4_unicode_ci COMMENT '角色',
+  `token` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'token',
+  `created_at` timestamp NULL DEFAULT NULL,
+  `updated_at` timestamp NULL DEFAULT NULL,
+  `deleted_at` timestamp NULL DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  KEY `idx_deleted_at` (`deleted_at`)
+) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
+
+--
+-- 转存表中的数据 `admin_users`
+--
+
+INSERT INTO `admin_users` (`id`, `name`, `real_name`, `password`, `remember_token`, `email`, `mobile`, `avatar`, `type`, `last_login_time`, `status`, `is_root`, `admin_role_id`, `token`, `created_at`, `updated_at`, `deleted_at`) VALUES
+(1, 'admin', '超级管理员', '$2y$10$4AVsWWtPWAwKqfMyRGuXsehByz6cS3ZnIBG6i.RMNcZsRs53xdZiC', 'ARbUZxiUe7R4w1um5nH05VDMhHS69yX2ltDlprkOWl800Yan8c2MU0GF7Q93', 'root', '13123456789', 'http://webimg-handle.liweijia.com/upload/avatar/avatar_0.jpg', 0, '2017-03-21 11:04:36', 1, 1, NULL, '9b78ef5d4cdab3590c9aeabe9dd38892e757fb248b6c41919f45d1aae5b9ad7a', '2016-12-31 16:00:00', '2020-12-02 00:19:06', NULL),
+(2, 'user1', 'user1', '$2y$10$dGL7pJ/BLeYLFZ0gAS5Q8.FoUOj6K6gRwmWrJkNRx5nVULmO8RT2K', NULL, 'user1@163.com', '123456', 'http://webimg-handle.liweijia.com/upload/avatar/avatar_0.jpg', 0, NULL, 1, 1, NULL, NULL, NULL, NULL, NULL),
+(3, 'user2', NULL, '$2y$10$uWFc3B4S5Kf8Lf6ckf2i8eJO84qCBO7qM8fE.OwmgShsWv7RgP1l6', NULL, NULL, NULL, NULL, NULL, NULL, 1, 1, '1', NULL, '2020-11-28 04:45:28', '2020-11-28 04:45:28', NULL);
+COMMIT;
+
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

+ 8 - 0
mini/app.js

xqd
@@ -35,5 +35,13 @@ App({
   },
   globalData: {
     userInfo: null
+  },
+  loginCallback: function(data) {
+    var userInfo = data
+    this.globalData.userInfo = userInfo
+    wx.setStorageSync('sg-userinfo', userInfo)
+    wx.redirectTo({
+      url: '/pages/index/index',
+    })
   }
 })

+ 10 - 4
mini/app.wxss

xqd xqd
@@ -19,6 +19,9 @@
 .sg-primary-color {
   color: #195ED7;
 }
+.sg-gray-color {
+  color: rgba(16, 16, 16, 0.5);
+}
 .sg-bold {
   font-weight: bold;
 }
@@ -28,9 +31,12 @@
 .sg-margin-top {
   margin-top: 50rpx;
 }
-.sg-wechat-btn {
-  background-color: transparent;
+.sg-shadow {
+  box-shadow: 0px 4px 6px 1px #c9c9c9;
+}
+.sg-icon-img {
+  width: 50rpx;
 }
-.sg-wechat-btn:after {
-  border: none;
+.sg-font-small {
+  font-size: 0.9rem;
 }

+ 82 - 1
mini/pages/login/index.js

xqd xqd
@@ -1,11 +1,21 @@
 // pages/login/index.js
+
+import util from '../../utils/util'
+import http from '../../utils/http'
+const app = getApp()
+
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-
+    mobile: '',
+    password: '',
+    // mobile|wechat|forget
+    type: 'mobile',
+    title: '手机号登录',
+    name: ''
   },
 
   /**
@@ -15,6 +25,77 @@ Page({
 
   },
 
+  switchType: function(e) {
+    var type = e.currentTarget.dataset.type
+    var title = '手机号登录'
+    if(type == 'wechat') {
+      title = '微信授权登录'
+    } else if(type == 'forget') {
+      title = '忘记密码'
+    }
+    this.setData({
+      title,
+      type
+    })
+  },
+
+  updateValue: function(e) {
+    var name = e.currentTarget.dataset.name
+    this.setData({
+      [name]: e.detail
+    })
+  },
+
+  login: function() {
+    if(!util.checkMobile(this.data.mobile)) {
+      util.showError('手机号格式错误')
+      return false;
+    }
+    if(!this.data.password) {
+      util.showError('密码必填')
+      return false;
+    }
+    http({
+      url: 'login',
+      data: {
+        mobile: this.data.mobile,
+        password: this.data.password
+      },
+      loadTitle: '登录中',
+      success: function(res) {
+        if(res.code == 0) {
+          app.loginCallback(res.data)
+        }
+      }
+    })
+  },
+
+  reset: function() {
+    if(!util.checkMobile(this.data.mobile)) {
+      util.showError('手机号格式错误')
+      return false;
+    }
+    if(!this.data.name) {
+      util.showError('真实姓名必填')
+      return false;
+    }
+    http({
+      url: 'reset',
+      data: {
+        mobile: this.data.mobile,
+        name: this.data.name
+      },
+      loadTitle: '提交中',
+      success: function(res) {
+        if(res.code == 0) {
+          wx.showToast({
+            title: '提交成功',
+          })
+        }
+      }
+    })
+  },
+
   /**
    * 生命周期函数--监听页面初次渲染完成
    */

+ 47 - 17
mini/pages/login/index.wxml

xqd
@@ -1,24 +1,54 @@
 <!--pages/login/index.wxml-->
 <view class="sg-container">
   <view class="sg-login-box sg-pad-lg">
-    <view class="sg-center sg-primary-color sg-bold sg-title">手机号登录</view>
+    <view class="sg-center sg-bold sg-title sg-primary-color">{{ title }}</view>
     <view class="sg-form">
-      <view class="sg-form-item sg-bottom-border">
-        <van-field left-icon="user-o" value="{{ mobile }}" placeholder="请输入手机号" bind:change="onChange"
-          label-class="sg-label" />
-      </view>
-      <view class="sg-form-item sg-bottom-border">
-        <van-field left-icon="lock" value="{{ password }}" placeholder="请输入密码" bind:change="onChange" password="true"
-          label-class="sg-label" />
-      </view>
-      <van-button type="info" block="true" round="true" color="#195ED7" custom-class="sg-margin-top sg-login-shadow">登录</van-button>
-      <view class="sg-pad-top">忘记密码?</view>
-      <van-divider contentPosition="center">其他登录方式</van-divider>
-      <view class="sg-third-box">
-        <button class="sg-wechat-btn">
-          <image src="http://app.rt/mini/wechat.png" class="sg-wechat-img" mode="widthFix"></image>
-        </button>
-      </view>
+      <block wx:if="{{ type == 'mobile' || type == 'forget' }}">
+        <view class="sg-form-item sg-bottom-border">
+          <van-field left-icon="user-o" value="{{ mobile }}" placeholder="请输入手机号" bind:change="updateValue"
+            data-name="mobile" label-class="sg-label" />
+        </view>
+        <view class="sg-form-item sg-bottom-border">
+          <block wx:if="{{ type == 'mobile' }}">
+            <van-field left-icon="lock" value="{{ password }}" placeholder="请输入密码" bind:change="onChange" password="true"
+            bind:change="updateValue" data-name="password" label-class="sg-label" />
+          </block>
+          <block wx:else>
+            <van-field left-icon="lock" value="{{ name }}" placeholder="请输入真实姓名" bind:change="onChange"  bind:change="updateValue" data-name="name" label-class="sg-label" />
+          </block>
+        </view>
+      </block>
+      <block wx:if="{{ type == 'mobile' }}">
+        <van-button type="info" block="true" round="true" color="#195ED7" custom-class="sg-margin-top sg-shadow"
+          bindtap="login">登录</van-button>
+      </block>
+      <block wx:elif="{{ type == 'forget' }}">
+        <van-button type="warning" block="true" round="true" custom-class="sg-margin-top sg-shadow"
+          bindtap="reset">提交管理员重置</van-button>
+          <van-button type="info" block="true" round="true" color="#195ED7" custom-class="sg-margin-top sg-shadow" bindtap="switchType" data-type="mobile">返回手机登录</van-button>
+      </block>
+      <block wx:elif="{{ type == 'wechat' }}">
+        <van-button type="primary" block="true" round="true" custom-class="sg-margin-top sg-shadow"
+          bindtap="forget" icon="http://app.rt/mini/wechat2.png">微信账号快捷登录</van-button>
+          <van-button type="info" block="true" round="true" color="#195ED7" custom-class="sg-margin-top sg-shadow" bindtap="switchType" data-type="mobile">返回手机登录</van-button>
+      </block>
+      <block wx:if="{{ type == 'mobile' }}">
+        <view class="sg-pad-top" bindtap="switchType" data-type="forget">忘记密码?</view>
+      </block>
+      <block wx:if="{{ type == 'mobile' }}">
+        <van-divider contentPosition="center">其他登录方式</van-divider>
+        <view class="sg-third-box">
+          <image src="http://app.rt/mini/wechat.png" class="sg-wechat-img" mode="widthFix" bindtap="switchType"
+            data-type="wechat"></image>
+        </view>
+      </block>
+      <block wx:if="{{ type == 'forget' }}">
+        <view class="sg-hint-box sg-margin-top sg-gray-color sg-font-small">
+          <view>温馨提示:</view>
+          <view>管理员重置成功后,密码默认设置为:123456
+重新在登录页输入手机号和密码后即可登录</view>
+        </view>
+      </block>
     </view>
   </view>
   <image src="http://app.rt/mini/login-bg.png" mode="widthFix" class="sg-bg"></image>

+ 11 - 6
mini/pages/login/index.wxss

xqd
@@ -1,19 +1,24 @@
 /* pages/login/index.wxss */
 .sg-login-box {
   position: fixed;
-  bottom: 0;
+  top: 400rpx;
   left: 0;
   width: 100%;
 }
 .sg-form .van-cell__left-icon-wrap {
   color: #195ED7;
 }
-.sg-login-shadow {
-  box-shadow: 0px 4px 6px 1px #c9c9c9;
-}
 .sg-wechat-img {
   width: 100rpx;
 }
-.sg-container .sg-login-box {
-  padding-bottom: 0;
+.sg-login-box .sg-title {
+  width: 250rpx;
+  margin: auto;
+  border-bottom: 3px solid #195ED7;
+  padding-bottom: 5px;
+}
+.sg-third-box {
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }

+ 1 - 1
mini/project.config.json

xqd
@@ -4,7 +4,7 @@
     "ignore": []
   },
   "setting": {
-    "urlCheck": true,
+    "urlCheck": false,
     "es6": true,
     "enhance": false,
     "postcss": true,

+ 52 - 0
mini/utils/http.js

xqd
@@ -0,0 +1,52 @@
+const baseUrl = 'http://app.rt/api/mini/';
+
+const http = (data) => {
+  var data = Object.assign({}, {
+    url: '',
+    method: 'POST',
+    data: {},
+    success: null,
+    error: null,
+    loadTitle: '加载中',
+    showLoading: true
+  }, data)
+  if (data.showLoading) {
+    wx.showLoading({
+      title: data.loadTitle,
+    })
+  }
+
+  var userinfo = wx.getStorageSync('sg-userinfo')
+  var token = userinfo ? userinfo.token : ''
+  wx.request({
+    url: baseUrl + data.url,
+    method: data.method,
+    data: data.data,
+    header: {
+      'X-Token': token
+    },
+    success: function (res) {
+      if (data.showLoading) wx.hideLoading()
+      if(res.statusCode != 200) {
+        wx.showToast({
+          title: res.data.message,
+          icon: 'none'
+        })
+        return false
+      }
+      if (res.data.code != 0) {
+        wx.showToast({
+          title: res.data.msg,
+          icon: 'none'
+        })
+      }
+      typeof data.success === "function" && data.success(res.data)
+    },
+    fail: function (res) {
+      
+      typeof data.error === "function" && data.error(res.data)
+    }
+  })
+}
+
+module.exports = http

+ 14 - 1
mini/utils/util.js

xqd
@@ -14,6 +14,19 @@ const formatNumber = n => {
   return n[1] ? n : '0' + n
 }
 
+const checkMobile = mobile => {
+  return /^1[34578]\d{9}$/.test(mobile)
+}
+
+const showError = msg => {
+  wx.showToast({
+    icon: 'none',
+    title: msg,
+  })
+}
+
 module.exports = {
-  formatTime: formatTime
+  formatTime: formatTime,
+  checkMobile: checkMobile,
+  showError: showError
 }

TEMPAT SAMPAH
public/mini/wechat2.png


+ 53 - 0
resources/views/admin/admin-user-resets/create.blade.php

xqd
@@ -0,0 +1,53 @@
+@extends('admin.layout-content')
+
+@section('header')
+    <style>
+
+    </style>
+@endsection
+
+@section('content')
+    <div class="layui-container sg-create-container">
+        <div class="layui-col-sm8 layui-col-sm-offset2">
+            <form class="layui-form" method="POST" action="{{ $pre_uri . 'store' }}">
+
+                {{ csrf_field() }}
+                @include('share.layui-form-item', ['type' => 'input', 'name' => 'name', 'label' => '名称', 'required' => true, 'value' => (old('data') ? old('data')['name'] : '')])
+                @include('share.layui-form-item', ['type' => 'input', 'name' => 'key', 'label' => '键值', 'required' => true, 'value' => (old('data') ? old('data')['key'] : '')])
+                @include('share.layui-form-item', ['type' => 'input', 'name' => 'sort', 'label' => '排序', 'required' => true, 'value' => (old('data') ? old('data')['sort'] : '')])
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
+                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                </div>
+            </form>
+        </div>
+    </div>
+@endsection
+
+@section('footer')
+    <script>
+        $(function () {
+            layui.use(['form', 'laydate'], function(){
+                var form = layui.form;
+                var laydate = layui.laydate;
+
+                // form.verify({
+                //     integer: function (value) {
+                //         var pattern = /^[1-9]\d*$/;
+                //         if(!(pattern.test(value) || value === '0')) {
+                //             return '组员人数必须为大于等于0的整数';
+                //         }
+                //     }
+                // });
+
+                laydate.render({
+                    elem: '.sg-select-date'
+                });
+            });
+        })
+    </script>
+@endsection

+ 54 - 0
resources/views/admin/admin-user-resets/edit.blade.php

xqd
@@ -0,0 +1,54 @@
+@extends('admin.layout-content')
+
+@section('header')
+    <style>
+
+    </style>
+@endsection
+
+@section('content')
+    <div class="layui-container sg-create-container">
+        <div class="layui-col-sm8 layui-col-sm-offset2">
+            <form class="layui-form" method="POST" action="{{ $pre_uri . 'update' }}">
+
+                {{ csrf_field() }}
+                <input type="hidden" name="id" value="{{ $item->id }}">
+                @include('share.layui-form-item', ['type' => 'input', 'name' => 'name', 'label' => '名称', 'required' => true, 'value' => ($item->name ? $item->name : '')])
+                @include('share.layui-form-item', ['type' => 'input', 'name' => 'key', 'label' => '键值', 'required' => true, 'value' => ($item->key ? $item->key : '')])
+                @include('share.layui-form-item', ['type' => 'input', 'name' => 'sort', 'label' => '排序', 'required' => true, 'value' => ($item->sort ? $item->sort : '')])
+                <div class="layui-form-item">
+                    <div class="layui-input-block">
+                        <button class="layui-btn" lay-submit lay-filter="formDemo">提交</button>
+                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
+                    </div>
+                </div>
+                <div class="layui-form-item">
+                </div>
+            </form>
+        </div>
+    </div>
+@endsection
+
+@section('footer')
+    <script>
+        $(function () {
+            layui.use(['form', 'laydate'], function(){
+                var form = layui.form;
+                var laydate = layui.laydate;
+
+                // form.verify({
+                //     integer: function (value) {
+                //         var pattern = /^[1-9]\d*$/;
+                //         if(!(pattern.test(value) || value === '0')) {
+                //             return '组员人数必须为大于等于0的整数';
+                //         }
+                //     }
+                // });
+
+                laydate.render({
+                    elem: '.sg-select-date'
+                });
+            });
+        })
+    </script>
+@endsection

+ 220 - 0
resources/views/admin/admin-user-resets/index.blade.php

xqd
@@ -0,0 +1,220 @@
+@extends('admin.layout-content')
+
+@section('header')
+    <style>
+
+    </style>
+@endsection
+
+@section('content')
+    <div class="layui-card">
+        <div class="layui-card-header sg-card-header">
+            {{ $model_name }}管理
+            {{--<div class="sg-card-create">--}}
+                {{--<button id="sg-create-btn" class="layui-btn layui-btn-sm">创建</button>--}}
+            {{--</div>--}}
+        </div>
+        <div class="layui-card-body">
+            {{--<form class="layui-form" id="sg-search-form">--}}
+                {{--<div class="layui-form-item layui-row">--}}
+                    {{--<div class="layui-inline">--}}
+                        {{--<div class="layui-input-inline">--}}
+                            {{--<input type="text" name="name" placeholder="请输入名称" autocomplete="off" class="layui-input" value="{{ request('name') }}">--}}
+                        {{--</div>--}}
+                    {{--</div>--}}
+                    {{--<div class="layui-inline">--}}
+                        {{--<div class="layui-btn" id="sg-search-btn">搜索</div>--}}
+                    {{--</div>--}}
+                {{--</div>--}}
+            {{--</form>--}}
+            <table id="sg-main-table" class="layui-hide" lay-filter="tableEvent"></table>
+            <script type="text/html" id="sg-table-bar">
+                <div class="layui-btn-group">
+                    <div class="layui-btn-group">
+                        <a class="layui-btn layui-btn-xs" lay-event="reset">重置</a>
+                    </div>
+                </div>
+            </script>
+        </div>
+    </div>
+@endsection
+
+@section('footer')
+    <script>
+        $(function () {
+            layui.use(['table', 'layer'], function(){
+                var table = layui.table,
+                    layer = layui.layer,
+                    form = layui.form,
+                    laydate = layui.laydate,
+                    top_window = window;
+
+                table.render({
+                    elem: '#sg-main-table',
+                    url: '{{ $pre_uri }}' + 'get',
+                    cellMinWidth: 80,
+                    cols: [[
+                        { field: 'id', title: 'ID', align: 'center' },
+                        { field: 'mobile', title: '手机', align: 'center' },
+                        { field: 'name', title: '姓名', align: 'center' },
+                        { field: 'updated_at', title: '日期', align: 'center' },
+                        { field: 'status', title: '状态', align: 'center' },
+                        { title: '操作', align:'center', toolbar: '#sg-table-bar' }
+                    ]],
+                    page: {
+                        layout: ['count', 'prev', 'page', 'next', 'skip', 'refresh'],
+                        limit: 15
+                    },
+                    even: true,
+                    where: transformToJson($('#sg-search-form').serializeArray()),
+                    done: function(res, curr, count) {
+
+                    }
+                });
+                table.on('tool(tableEvent)', function(obj){
+                    var data = obj.data;
+                    if(obj.event === 'reset'){
+                        layer.confirm('确定要重置吗?', function(index) {
+                            $.ajax({
+                                method: 'POST',
+                                url: '{{ $pre_uri }}' + 'reset',
+                                headers: {
+                                    'X-CSRF-TOKEN': '{{ csrf_token() }}'
+                                },
+                                data: {
+                                    id: data.id
+                                },
+                                success: function (data) {
+                                    if(data.status === 'success') {
+                                        // obj.del();
+                                        top_window.location.reload();
+                                    } else {
+                                        layer.msg(data.info, {
+                                            icon: 2
+                                        });
+                                    }
+                                    layer.close(index);
+                                },
+                                error: function () {
+                                    layer.close(index);
+                                    layer.msg('操作失败', {
+                                        icon: 2
+                                    });
+                                }
+                            });
+                        });
+                    } else if(obj.event === 'edit') {
+                        layer.open({
+                            title: '编辑成员',
+                            type: 2,
+                            area: ['90%', '90%'],
+                            content: '{{ $pre_uri }}' + 'edit?id=' + data.id,
+                            end: function () {
+                                top_window.location.reload();
+                            }
+                        });
+                    }
+                });
+
+                if($('#search-begin-date').length > 0) {
+                    laydate.render({
+                        elem: '#search-begin-date',
+                        done: function () {
+                            updateTableBySearch();
+                        }
+                    });
+                }
+
+                if($('#search-end-date').length > 0) {
+                    laydate.render({
+                        elem: '#search-end-date',
+                        done: function () {
+                            updateTableBySearch();
+                        }
+                    });
+                }
+
+                function transformToJson(formData){
+                    var obj={};
+                    for (var i in formData) {
+                        obj[formData[i].name]=formData[i]['value'];
+                    }
+                    return obj;
+                }
+
+                function updateTableBySearch() {
+                    table.reload('sg-main-table', {
+                        where: transformToJson($('#sg-search-form').serializeArray()),
+                        page: {
+                            curr: 1
+                        }
+                    });
+                }
+
+                $('#sg-search-btn').click(function() {
+                    updateTableBySearch();
+                });
+                // $('#sg-search-form').change(function () {
+                //     updateTableBySearch();
+                // });
+                //
+                // form.on('select()', function(){
+                //     updateTableBySearch();
+                // });
+
+                $('#sg-create-btn').on('click', function () {
+                    layer.open({
+                        title: '创建' + '{{ $model_name }}',
+                        type: 2,
+                        area: ['90%', '90%'],
+                        content: '{{ $pre_uri }}' + 'create',
+                        end: function () {
+                            top_window.location.reload();
+                        }
+                    });
+                });
+
+                $('#sg-table-top-container').on('click', '.btn-delete-many', function () {
+                    layer.confirm('确定要删除所有选中行吗?', function () {
+                        var data = table.checkStatus('sg-main-table').data;
+                        if(data.length <= 0) {
+                            layer.msg('选择不能为空', {
+                                icon: 2
+                            });
+                            return false;
+                        }
+                        var ids = [];
+                        for(var i = 0; i < data.length; ++i) {
+                            ids.push(data[i]['id']);
+                        }
+                        $.ajax({
+                            method: 'POST',
+                            url: '{{ $pre_uri }}' + 'deleteMany',
+                            headers: {
+                                'X-CSRF-TOKEN': '{{ csrf_token() }}'
+                            },
+                            data: {
+                                ids: JSON.stringify(ids)
+                            },
+                            success: function (data) {
+                                if(data.status === 'success') {
+                                    top_window.location.reload();
+                                } else {
+                                    layer.msg(data.info, {
+                                        icon: 2
+                                    });
+                                }
+
+                            },
+                            error: function () {
+                                layer.msg('删除失败', {
+                                    icon: 2
+                                });
+                            }
+                        });
+                    })
+                });
+            });
+        })
+    </script>
+@endsection

+ 6 - 51
routes/api.php

xqd xqd
@@ -1,7 +1,5 @@
 <?php
 
-use Illuminate\Http\Request;
-
 /*
 |--------------------------------------------------------------------------
 | API Routes
@@ -13,54 +11,11 @@ use Illuminate\Http\Request;
 |
 */
 
-//Route::middleware('auth:api')->get('/user', function (Request $request) {
-//    return $request->user();
-//});
-
 
+$api = app('Dingo\Api\Routing\Router');
 
-//
-//$api = app('Dingo\Api\Routing\Router');
-//
-//$api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($api) {
-//    // test
-//    $api->get('test', [
-//        'as' => 'test',
-//        'uses' => 'AuthController@test',
-//    ]);
-//    // Auth
-//    // signin
-//    $api->post('auth/login', [
-//        'as' => 'auth.login',
-//        'uses' => 'AuthController@login',
-//    ]);
-//    $api->post('auth/logout', [
-//        'as' => 'auth.logout',
-//        'uses' => 'AuthController@logout',
-//    ]);
-//    $api->post('auth/code', [
-//        'as' => 'auth.code',
-//        'uses' => 'AuthController@getCode',
-//    ]);
-//    // signup
-//    $api->post('auth/register', [
-//        'as' => 'auth.register',
-//        'uses' => 'AuthController@register',
-//    ]);
-//    $api->post('auth/password', [
-//        'as' => 'auth.reset',
-//        'uses' => 'AuthController@setPassword',
-//    ]);
-//    $api->post('auth/check_password', [
-//        'as' => 'auth.check_password',
-//        'uses' => 'AuthController@check_password',
-//    ]);
-//    $api->post('auth/reset', [
-//        'as' => 'auth.reset',
-//        'uses' => 'AuthController@reset',
-//    ]);
-//    $api->get('auth/is_login', [
-//        'as' => 'auth.is_login',
-//        'uses' => 'AuthController@isLogin',
-//    ]);
-//});
+$api->version('v1', ['namespace' => 'App\Http\Controllers\Api\mini', 'prefix' => 'api/mini', 'middleware' => 'mini'], function ($api) {
+    $api->any('test', 'TestController@index');
+    $api->any('login', 'AuthController@login');
+    $api->any('reset', 'AuthController@reset');
+});