Commit 96ce4dc9 authored by zhoujun's avatar zhoujun

登录,白名单

parent e37923d2
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Throwable;
use Exception;
use Carbon\Carbon;
use Illuminate\Validation\Rule;
use App\Services\User\IUserService;
class LoginController extends BaseController
{
private $time;
private $userService;
public function __construct(IUserService $userService)
{
$this->time = Carbon::now()->format('Y-m-d H:i:s');
$this->userService = $userService;
}
/**
* 登录
* @return array
* @date 2021/07/29
* @author live
*/
public function getLogin(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'name' => 'required|string',
'pwd' => 'required|string'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->userService->getLogin($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 退出
* @return array
* @date 2021/07/29
* @author live
*/
public function getLogout(Request $request)
{
$userToken = $request->header('token','');
try {
$data = $this->userService->getLogout($userToken);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 刷新token
* @return array
* @date 2021/07/29
* @author live
*/
public function getRefreshToken(Request $request)
{
$userToken = $request->header('token','');
if ($userToken == '') return $this->getErrorMsg('1010', config('msg.common.1010'));
try {
$data = $this->userService->getRefreshToken($userToken);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Throwable;
use Exception;
use Carbon\Carbon;
use Illuminate\Validation\Rule;
use App\Services\User\IUserService;
class UserController extends BaseController
{
private $time;
private $userService;
public function __construct(IUserService $userService)
{
$this->time = Carbon::now()->format('Y-m-d H:i:s');
$this->userService = $userService;
}
/**
* 新增用户
* @return array
* @date 2021/07/29
* @author live
*/
public function getUserAdd(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'name' => 'required|string',
'realName' => 'required|string',
'pwd' => 'required|string'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->userService->getUserAdd($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 用户列表
* @return array
* @date 2021/07/29
* @author live
*/
public function getUserList(Request $request)
{
$postData = $request->all();
try {
$data = $this->userService->getUserList($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 删除用户
* @return array
* @date 2021/07/29
* @author live
*/
public function getUserDel(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'id' => 'required|numeric'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->userService->getUserDel($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 修改用户登录密码
* @return array
* @date 2021/07/29
* @author live
*/
public function getResetUserPwd(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'id' => 'required|numeric',
'pwd' => 'required|string|min:6'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->userService->getResetUserPwd($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 设置用户状态
* @return array
* @date 2021/07/29
* @author live
*/
public function getSetStatus(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'id' => 'required|numeric',
'status' => 'required|numeric'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->userService->getSetStatus($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Throwable;
use Exception;
use Carbon\Carbon;
use Illuminate\Validation\Rule;
use App\Services\White\IWhiteService;
class WhiteController extends BaseController
{
private $time;
private $whiteService;
public function __construct(IWhiteService $whiteService)
{
$this->time = Carbon::now()->format('Y-m-d H:i:s');
$this->whiteService = $whiteService;
}
/**
* 新增白名单
* @return array
* @date 2021/07/29
* @author live
*/
public function getWhiteAdd(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'name' => 'required|string',
'uid' => 'required|string'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->whiteService->getWhiteAdd($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 白名单列表
* @return array
* @date 2021/07/29
* @author live
*/
public function getWhiteList(Request $request)
{
$postData = $request->all();
try {
$data = $this->whiteService->getWhiteList($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 删除白名单
* @return array
* @date 2021/07/29
* @author live
*/
public function getWhiteDel(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'id' => 'required|numeric'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->whiteService->getWhiteDel($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
/**
* 设置白名单状态
* @return array
* @date 2021/07/29
* @author live
*/
public function getSetStatus(Request $request)
{
$postData = $request->all();
$validate = Validator::make($postData, [
'id' => 'required|numeric',
'status' => 'required|numeric'
]);
if ($validate->fails()) return $this->getErrorMsg('1001', config('msg.common.1001'));
try {
$data = $this->whiteService->getSetStatus($postData);
return $this->getSuccessMsg($data);
} catch (Exception $e) {
return $this->getErrorMsg($e->getCode(), $e->getMessage());
}
}
}
\ No newline at end of file
<?php
namespace App\Http\Controllers;
class BaseController extends Controller
{
/**
* @param array $data
* @param bool $needObject 数据为空时是否需要以对象的方式返回
* @param string $code
* @param string $msg
* @return \Illuminate\Http\JsonResponse
*/
protected function getSuccessMsg($data = array(), $msg = '操作成功', $needObject = true, $code = '200')
{
return response()->json([
'code' => $code,
'msg' => $msg,
'data' => $data ? $data : ($needObject ? (object)array() : []),
]);
}
protected function getErrorMsg($code = '', $msg = '')
{
return response()->json([
'code' => $code,
'msg' => $msg,
]);
}
}
...@@ -61,6 +61,7 @@ class Kernel extends HttpKernel ...@@ -61,6 +61,7 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class, 'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'user.login' => \App\Http\Middleware\UserLogin::class,
]; ];
/** /**
......
<?php
namespace App\Http\Middleware;
use Closure;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
use App\Models\AdminModel;
use Carbon\Carbon;
class UserLogin
{
/**
*
* @param $request
* @param Closure $next
* @return array|mixed
*/
public function handle(Request $request, Closure $next)
{
$userToken = $request->header('token','');
$now = strtotime(Carbon::now()->format('Y-m-d H:i:s'));
if($userToken == ''){
return response()->json([
'code' => 403,
'msg' => '请带上有效的token',
]);
}
$user = AdminModel::where('token',$userToken)->first();
if(!$user){
return response()->json([
'code' => 401,
'msg' => '无效的token',
]);
}
if($user->expire_time < $now){
return response()->json([
'code' => 402,
'msg' => 'token过期请重新刷新token',
]);
}
$user->expire_time = $now + 10800;
$user->refresh_time = $now + 86400;
$user->save();
$request['userId'] = $user->id;
$request['user'] = $user->name;
$request['realName'] = $user->real_name;
unset($user);
return $next($request);
}
}
<?php
namespace App\Models;
use App\Models\BaseModel;
class AccountModel extends BaseModel
{
protected $primaryKey = 'user_id';
protected $connection = 'mysql';
public $timestamps = false;
protected $table = 'account';
}
<?php
namespace App\Models;
use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;
class AdminModel extends BaseModel
{
use SoftDeletes;
protected $connection = 'mysql';
protected $table = 'club_admin';
}
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class BaseModel extends Model
{
/**
* 封装一个参数搜索条件 字符串 半模糊
* @return array
* @date 2021/07/27
* @author live
*/
public function scopeSearch($query,$key,$field)
{
return $query->when($key != '', function ($query) use ($key,$field) {
return $query->where($field, 'like',$key.'%');
});
}
/**
* 封装一个参数搜索条件 数字
* @return array
* @date 2021/07/27
* @author live
*/
public function scopeSearchInt($query,$num,$field)
{
return $query->when($num > 0, function ($query) use ($num,$field) {
return $query->where($field, $num);
});
}
/**
* 封装一个参数搜索条件
* @return array
* @date 2021/07/27
* @author live
*/
public function scopeSearchString($query,$string,$field,$compare)
{
return $query->when($string != '', function ($query) use ($string,$field,$compare) {
if($compare == '') return $query->where($field,$string);
if($compare != '') return $query->where($field,$compare,$string);
});
}
/**
* 封装一个参数搜索条件
* @return array
* @date 2021/07/27
* @author live
*/
public function scopeSearchArray($query,$array,$field)
{
return $query->when(!empty($array), function ($query) use ($array,$field) {
return $query->whereIn($field,$array);
});
}
}
\ No newline at end of file
<?php
namespace App\Models;
use App\Models\BaseModel;
class WithdrawWhiteListModel extends BaseModel
{
protected $primaryKey = 'serial';
protected $connection = 'mysql';
public $timestamps = false;
protected $table = 'cc_withdraw_white_list';
}
...@@ -13,7 +13,8 @@ class AppServiceProvider extends ServiceProvider ...@@ -13,7 +13,8 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function register() public function register()
{ {
// $this->app->bind('App\Services\User\IUserService', 'App\Services\User\UserService');
$this->app->bind('App\Services\White\IWhiteService', 'App\Services\White\WhiteService');
} }
/** /**
......
<?php
namespace App\Services\User;
interface IUserService
{
public function getUserAdd($postData); //新增用户
public function getUserList($postData);//用户列表
public function getUserDel($postData);//删除用户
public function getResetUserPwd($postData);//修改用户登录密码
public function getSetStatus($postData);//设置用户状态
public function getLogin($postData);//用户登录
public function getRefreshToken($userToken);//刷新用户token
public function getLogout($userToken);//退出登录
}
<?php
namespace App\Services\User;
use App\Services\User\IUserService;
use Carbon\Carbon;
use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use App\Models\AdminModel;
use Illuminate\Support\Facades\Cache;
class UserService implements IUserService{
private $time;
public function __construct()
{
$this->time = Carbon::now()->format('Y-m-d H:i:s');
}
/**
* 新增用户
* @return int
* @date 2021/07/29
* @author live
*/
public function getUserAdd($postData)
{
$verity = AdminModel::where('name',$postData['name'])->select('id')->first();
if(!$verity){
$row = new AdminModel();
$row->name = $postData['name'] ?? '';
$row->real_name = $postData['realName'] ?? '';
$row->password = MD5($postData['pwd']);
$row->phone = $postData['phone'] ?? '';
$row->email = $postData['email'] ?? '';
$row->remark = $postData['remark'] ?? '';
$row->is_admin = 1;
if( $row->save()) return $row->id;
throw new Exception(config('msg.common.1006'),1006);
}
throw new Exception(config('msg.common.1005'),1005);
}
/**
* 用户列表
* @return araay
* @date 2021/07/29
* @author live
*/
public function getUserList($postData)
{
$key = $postData['key'] ?? '';
$pagePerNum = $postData['pageSize'] ?? 20;
$currentPage = $postData['page'] ?? 1;
$users = AdminModel::when($key != '', function ($query) use ($key) {
return $query->where('name', 'like',$key.'%')->orWhere('real_name', 'like',$key.'%');
})->select('id','name','real_name','phone','email','created_at')->orderBy('id','DESC')->paginate($pagePerNum, ['*'], 'currentPage',$currentPage);
$array['totalNum'] = $users->total();
$array['totalPage'] = $users->lastPage();
foreach($users as $user){
$tem['id'] = $user->id;
$tem['name'] = $user->name;
$tem['realName'] = $user->real_name;
$tem['phone'] = $user->phone;
$tem['email'] = $user->email;
$tem['created_at'] = Carbon::parse($user->created_at)->format('Y-m-d H:i:s');
$array['data'][] = $tem;
}
unset($users,$user,$user);
return $array;
}
/**
* 删除用户
* @return araay
* @date 2021/07/29
* @author live
*/
public function getUserDel($postData)
{
$user = AdminModel::where('id',$postData['id'])->first();
if(!$user) throw new Exception(config('msg.common.1002'),1002);
if($user->delete()) return true;
throw new Exception(config('msg.common.1003'),1003);
}
/**
* 修改用户登录密码
* @return araay
* @date 2021/07/29
* @author live
*/
public function getResetUserPwd($postData)
{
$user = AdminModel::where('id',$postData['id'])->first();
if($user->status == 0) throw new Exception(config('msg.common.1008'),1008);
if(!$user) throw new Exception(config('msg.common.1002'),1002);
$user->password = MD5($postData['pwd']);
if($user->token != '') $user->expire_time = strtotime($this->time);
if($user->save()) return true;
throw new Exception(config('msg.common.1003'),1003);
}
/**
* 设置用户状态
* @return araay
* @date 2021/07/29
* @author live
*/
public function getSetStatus($postData)
{
$user = AdminModel::where('id',$postData['id'])->first();
if(!$user) throw new Exception(config('msg.common.1002'),1002);
if($postData['status'] == 1){
if($user->status == 1) throw new Exception(config('msg.common.1009'),1009);
$user->status = 1;
}
if($postData['status'] == 2){
if($user->status == 0) throw new Exception(config('msg.common.1009'),1009);
$user->status = 0;
}
if($user->save()) return true;
throw new Exception(config('msg.common.1003'),1003);
}
/**
* 用户登录
* @return araay
* @date 2021/07/29
* @author live
*/
public function getLogin($postData){
$array['token'] = '';
$user = AdminModel::where('name',$postData['name'])->where('password',MD5($postData['pwd']))->first();
if(!$user) throw new Exception(config('msg.common.1007'),1007);
$userToken = Str::random(128);
$user->token = $userToken;
$user->expire_time = strtotime($this->time) + 10800;
$user->refresh_time = strtotime($this->time) + 86400;
$user->save();
$array['token'] = $userToken;
$array['id'] = $user->id;
$array['name'] = $user->name;
$array['realName'] = $user->real_name;
unset($user,$userToken);
return $array;
}
/**
* 刷新用户token
* @return araay
* @date 2021/07/29
* @author live
*/
public function getRefreshToken($userToken)
{
$array['token'] = '';
$user = AdminModel::where('token',$userToken)->first();
if(!$user) if(!$user) throw new Exception(config('msg.common.401'),401);
if(strtotime($this->time) > $user->refresh_time) throw new Exception(config('msg.common.1011'),1011);
$userToken = Str::random(128);
$user->token = $userToken;
$user->expire_time = strtotime($this->time) + 10800;
$user->refresh_time = strtotime($this->time) + 86400;
$user->save();
$array['token'] = $userToken;
unset($user,$userToken);
return $array;
}
/**
* 退出登录
* @return araay
* @date 2021/02/25
* @author live
*/
public function getLogout($token)
{
$user = AdminModel::where('token',$token)->select('id','token')->first();
$user->token = '';
$user->expire_time = 0;
$user->refresh_time = 0;
$user->save();
return true;
}
}
\ No newline at end of file
<?php
namespace App\Services\White;
interface IWhiteService
{
public function getWhiteAdd($postData); //新增白名单
public function getWhiteList($postData);//白名单列表
public function getWhiteDel($postData);//删除白名单
public function getSetStatus($postData);//设置白名单状态
}
\ No newline at end of file
<?php
namespace App\Services\White;
use App\Services\White\IWhiteService;
use Carbon\Carbon;
use Exception;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use App\Models\WithdrawWhiteListModel;
use App\Models\AccountModel;
use Illuminate\Support\Facades\Cache;
class WhiteService implements IWhiteService
{
private $time;
public function __construct()
{
$this->time = Carbon::now()->format('Y-m-d H:i:s');
}
/**
* 新增白名单
* @return int
* @date 2021/07/29
* @author live
*/
public function getWhiteAdd($postData)
{
$verity = WithdrawWhiteListModel::where('uid', $postData['uid'])->select('serial')->first();
if (!$verity) {
$account = AccountModel::where('platform_id', $postData['uid'])->first();
if(!$account) throw new Exception(config('msg.common.1012'), 1012);
$row = new WithdrawWhiteListModel();
$row->name = $postData['name'] ?? '';
$row->uid = $postData['uid'] ?? '';
$row->open_id = $account->user_id ?? '';
$row->reg_time = $account->create_time ?? $this->time;
$row->op_user = $postData['user'] ?? '';
$row->add_time = $this->time;
if ($row->save()) return $row->serial;
throw new Exception(config('msg.common.1006'), 1006);
}
throw new Exception(config('msg.common.1005'), 1005);
}
/**
* 白名单列表
* @return araay
* @date 2021/07/29
* @author live
*/
public function getWhiteList($postData)
{
$status = $postData['status'] ?? 0;
$name = $postData['name'] ?? '';
$pagePerNum = $postData['pageSize'] ?? 20;
$currentPage = $postData['page'] ?? 1;
$lists = WithdrawWhiteListModel::when($name != '', function ($query) use ($name) {
return $query->where('name', 'like', $name . '%');
})->when($status > 0, function ($query) use ($status) {
return $query->where('status',$status);
})->select('serial', 'name', 'uid', 'status', 'op_user', 'add_time')->orderBy('serial', 'DESC')->paginate($pagePerNum, ['*'], 'currentPage', $currentPage);
$array['totalNum'] = $lists->total();
$array['totalPage'] = $lists->lastPage();
foreach ($lists as $list) {
$tem['id'] = $list->serial;
$tem['name'] = $list->name;
$tem['account'] = $list->uid;
$tem['status'] = $list->status;
$tem['optionUser'] = $list->op_user;
$tem['addTime'] = $list->add_time;
$array['data'][] = $tem;
}
unset($users, $user, $user);
return $array;
}
/**
* 删除白名单
* @return araay
* @date 2021/07/29
* @author live
*/
public function getWhiteDel($postData)
{
$list = WithdrawWhiteListModel::where('serial', $postData['id'])->first();
if (!$list) throw new Exception(config('msg.common.1002'), 1002);
if ($list->delete()) return true;
throw new Exception(config('msg.common.1003'), 1003);
}
/**
* 设置白名单状态
* @return araay
* @date 2021/07/29
* @author live
*/
public function getSetStatus($postData)
{
$list = WithdrawWhiteListModel::where('serial', $postData['id'])->first();
if (!$list) throw new Exception(config('msg.common.1002'), 1002);
if($list->status == $postData['status']) throw new Exception(config('msg.common.1009'), 1009);
$list->status = $postData['status'];
$list->addTime = $this->time;
if ($list->save()) return true;
throw new Exception(config('msg.common.1003'), 1003);
}
}
\ No newline at end of file
<?php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
}
...@@ -11,7 +11,8 @@ ...@@ -11,7 +11,8 @@
"php": "^7.2.5|^8.0", "php": "^7.2.5|^8.0",
"fideloper/proxy": "^4.4", "fideloper/proxy": "^4.4",
"laravel/framework": "^6.20.26", "laravel/framework": "^6.20.26",
"laravel/tinker": "^2.5" "laravel/tinker": "^2.5",
"tymon/jwt-auth": "^1.0"
}, },
"require-dev": { "require-dev": {
"facade/ignition": "^1.16.15", "facade/ignition": "^1.16.15",
......
This diff is collapsed.
...@@ -67,7 +67,7 @@ return [ ...@@ -67,7 +67,7 @@ return [
| |
*/ */
'timezone' => 'UTC', 'timezone' => 'Asia/Shanghai',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
......
...@@ -42,9 +42,8 @@ return [ ...@@ -42,9 +42,8 @@ return [
], ],
'api' => [ 'api' => [
'driver' => 'token', 'driver' => 'jwt',
'provider' => 'users', 'provider' => 'users',
'hash' => false,
], ],
], ],
......
This diff is collapsed.
<?php
return [
'PAGE_NUM' => 20,
];
\ No newline at end of file
<?php
// 定义错误码
return [
/*
* 共通错误提示模块10xx
*/
'common' => [
'401' => '无效的token',
'402' => 'token过期请重新刷新token',
'403' => '请带上有效的token',
'1001' => '参数或者参数格式有误',
'1002' => '数据异常',
'1003' => '设置失败',
'1004' => '非法请求',
'1005' => '数据已存在',
'1006' => '数据写入失败',
'1007' => '用户不存在或者登录密码错误',
'1008' => '账号已被封停',
'1009' => '请勿重复操作',
'1010' => '请带上过期的token',
'1011' => 'token过期请重新登录',
'1012' => '用户ID不存在',
],
];
\ No newline at end of file
<?php
return [
];
\ No newline at end of file
...@@ -13,6 +13,30 @@ use Illuminate\Http\Request; ...@@ -13,6 +13,30 @@ use Illuminate\Http\Request;
| |
*/ */
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user(); Route::group(['namespace' => 'Api'],function() {
Route::post('/login','LoginController@getLogin');//登录
Route::post('/refresh/token','LoginController@getRefreshToken');//刷新token
});
Route::group(['namespace' => 'Api','middleware' => ['user.login']], function () {
Route::post('/logout','LoginController@getLogout');//退出
Route::group(['prefix' => 'user'],function() {
Route::post('/add','UserController@getUserAdd');//新增用户
Route::post('/list','UserController@getUserList');//用户列表
Route::post('/del','UserController@getUserDel');//删除用户
Route::post('/reset/pwd','UserController@getResetUserPwd');//充值用户密码
Route::post('/set/status','UserController@getSetStatus');//设置用户状态
});
Route::group(['prefix' => 'white'],function() {
Route::post('/add','WhiteController@getWhiteAdd');//新增白名单
Route::post('/list','WhiteController@getWhiteList');//白名单列表
Route::post('/del','WhiteController@getWhiteDel');//删除白名单
Route::post('/set/status','WhiteController@getSetStatus');//设置白名单状态
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment