更新
This commit is contained in:
@@ -13,7 +13,7 @@ use app\services\auth\UsersService;
|
||||
// 应用请求对象类
|
||||
class Request extends \think\Request{
|
||||
|
||||
public function auth(){
|
||||
public function auth(){
|
||||
return app()->make(UsersService::class)->getUserAuth($this->user['uid']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
use think\facade\Cache;
|
||||
use sent\tree\Tree;
|
||||
|
||||
function getDepartmentChild($pid = 0){
|
||||
$department = Cache::get('department');
|
||||
@@ -28,8 +29,8 @@ function getChilds($data, $id = 0, $pk = 'id', $pid = 'parent_id') {
|
||||
$array = [];
|
||||
foreach ($data as $k => $v) {
|
||||
if ($v[$pid] == $id) {
|
||||
$array[] = (int) $v[$pk];
|
||||
array_merge($array, getChilds($data, $v[$pk]));
|
||||
$array[] = $v[$pk];
|
||||
$array = array_merge($array, getChilds($data, $v[$pk]));
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
|
||||
@@ -11,6 +11,9 @@ namespace app\controller\auth;
|
||||
use app\controller\Base;
|
||||
use app\services\auth\AuthService;
|
||||
use app\services\SocialiteService;
|
||||
use app\model\Member;
|
||||
use app\model\auth\Users;
|
||||
use app\model\auth\RolesAccess;
|
||||
|
||||
class Index extends Base{
|
||||
|
||||
@@ -25,6 +28,19 @@ class Index extends Base{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function member(){
|
||||
// $map = [];
|
||||
// $member = Member::where($map)->select();
|
||||
// $save = [];
|
||||
// foreach($member as $item){
|
||||
// $user = Users::where('username', '=', $item->username)->findOrEmpty();
|
||||
// if($user->isEmpty()){
|
||||
// $save[] = ['uid' => $item['uid'], 'username' => $item['username'], 'password' => '123456', 'nickname' => $item['nickname'], 'email' => $item['email'], 'department_id' => $item['department']];
|
||||
// }
|
||||
// }
|
||||
// (new Users())->saveAll($save);
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 第三方账号登录
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,24 @@ class Role extends Base{
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 角色修改
|
||||
* @time 2019年12月11日
|
||||
* @param $id
|
||||
* @param Request $request
|
||||
* @return Array
|
||||
*/
|
||||
public function edit(RoleService $service) {
|
||||
try {
|
||||
$service->updateRole($this->request);
|
||||
$this->data['code'] = 1;
|
||||
} catch (\Exception $e) {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['message'] = $e->getMessage();
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 角色授权
|
||||
* @time 2019年12月11日
|
||||
|
||||
@@ -48,6 +48,25 @@ class User extends Base{
|
||||
$res = app()->make(UsersService::class)->updateUsers($this->request);
|
||||
$this->data['code'] = 1;
|
||||
$this->data['data'] = $res;
|
||||
$this->data['message'] = "更新成功!";
|
||||
} catch (\Exception $e) {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['message'] = $e->getMessage();
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 修改密码
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function passwd(){
|
||||
try {
|
||||
$res = app()->make(UsersService::class)->updateUserPassword($this->request);
|
||||
$this->data['code'] = 1;
|
||||
$this->data['data'] = $res;
|
||||
$this->data['message'] = "修改成功";
|
||||
} catch (\Exception $e) {
|
||||
$this->data['code'] = 0;
|
||||
$this->data['message'] = $e->getMessage();
|
||||
@@ -70,6 +89,7 @@ class User extends Base{
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 用户信息
|
||||
* @param int $uid
|
||||
@@ -89,8 +109,7 @@ class User extends Base{
|
||||
try {
|
||||
$uid = $this->request->param('uid');
|
||||
$role = $this->request->param('role');
|
||||
$manage_class = $this->request->param('manage_class');
|
||||
app()->make(UsersService::class)->updateRoles($uid, $role, $manage_class);
|
||||
app()->make(UsersService::class)->updateRoles($uid, $role);
|
||||
$this->data['message'] = '更新成功!';
|
||||
} catch (\Exception $e) {
|
||||
$this->data['code'] = 0;
|
||||
|
||||
19
app/controller/system/File.php
Normal file
19
app/controller/system/File.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\system;
|
||||
|
||||
use app\controller\Base;
|
||||
use app\services\system\DictionaryService;
|
||||
|
||||
/**
|
||||
* @title 文件
|
||||
*/
|
||||
class File extends Base{
|
||||
|
||||
}
|
||||
@@ -27,4 +27,16 @@ class Log extends Base {
|
||||
$this->data['data'] = $list;
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 我的日志
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function my(){
|
||||
$list = app()->make(UsersLogService::class)->getMyLogList($this->request);
|
||||
|
||||
$this->data['data'] = $list;
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
@@ -126,10 +126,9 @@ class Menu extends Base{
|
||||
* @title 我的菜单
|
||||
* @return Array
|
||||
*/
|
||||
public function my(){
|
||||
$menu = app()->make(AuthService::class)->getAuthMenu();
|
||||
public function my(AuthService $service){
|
||||
$this->data['code'] = 1;
|
||||
$this->data['data'] = ['menu' => $menu, 'permissions' => []];
|
||||
$this->data['data'] = ['menu' => $service->getAuthMenu($this->request), 'permissions' => $service->getAuthPermissions($this->request)];
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,18 +20,18 @@ class BaseModel extends Model{
|
||||
$map = [];
|
||||
if(!in_array($uid, Config::get('auth.admin_root'))){
|
||||
$subMap = [];
|
||||
if($auth['data_range'] == 4){
|
||||
if($auth['data_range'] == 2){
|
||||
$subMap[] = ['department_id', 'IN', getDepartmentChild($auth['department_id'])];
|
||||
}elseif($auth['data_range'] == 3){
|
||||
$subMap[] = ['department_id', 'IN', $auth['department_id']];
|
||||
}elseif($auth['data_range'] == 2){
|
||||
$map[] = ['creator_id', '=', $uid];
|
||||
}elseif($auth['data_range'] == 4){
|
||||
$map[] = ['uid', '=', $uid];
|
||||
}
|
||||
if(!empty($subMap)){
|
||||
$subsql = Db::name('users')->where($subMap)->field('uid')->buildSql();
|
||||
$subsql = str_replace(" AS thinkphp) AS T1 )", "", $subsql);
|
||||
$subsql = str_replace("SELECT T1.* FROM (SELECT thinkphp.*, ROW_NUMBER() OVER ( ORDER BY rand()) AS ROW_NUMBER FROM (", "", $subsql);
|
||||
$map[] = ['creator_id', 'IN', Db::raw($subsql)];
|
||||
$map[] = ['uid', 'IN', Db::raw($subsql)];
|
||||
}
|
||||
}
|
||||
$query->where($where)->where($map);
|
||||
|
||||
14
app/model/Member.php
Normal file
14
app/model/Member.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\model;
|
||||
|
||||
class Member extends \think\Model{
|
||||
|
||||
protected $connection = 'bestcrm';
|
||||
}
|
||||
@@ -16,6 +16,17 @@ class Users extends BaseModel{
|
||||
|
||||
public $pk = 'uid';
|
||||
|
||||
/**
|
||||
* @title 密码加密
|
||||
*
|
||||
* @param [type] $value
|
||||
* @param [type] $data
|
||||
* @return void
|
||||
*/
|
||||
public function setPasswordAttr($value, $data){
|
||||
return $value ? password_hash($value, PASSWORD_DEFAULT) : password_hash('123456', PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
public function getTokenAttr($value, $data){
|
||||
$token = Jwt::store('api')->token($data)->__toString();
|
||||
return $token;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
namespace app\services\auth;
|
||||
|
||||
use app\model\auth\Users;
|
||||
use app\model\Member;
|
||||
use app\model\auth\Permissions;
|
||||
use sent\tree\Tree;
|
||||
use think\facade\Env;
|
||||
@@ -31,15 +32,26 @@ class AuthService{
|
||||
}
|
||||
$user = Users::where($map)->field(['uid','username', 'password', 'email', 'avatar', 'department_id', 'status'])->findOrEmpty();
|
||||
if (!$user->isEmpty()) {
|
||||
if(password_verify($params['password'], $user->password)){
|
||||
throw new \think\Exception('密码不正确!', 100002);
|
||||
}elseif($user->status != 1){
|
||||
throw new \think\Exception('当前用户不可用', 100003);
|
||||
}else{
|
||||
return $user->append(['token']);
|
||||
if(!password_verify($params['password'], $user->password)){
|
||||
$member = Member::where($map)->findOrEmpty();
|
||||
if (!$member->isEmpty() && $member['password'] === md5($params['password'] . $member['salt'])) {
|
||||
$user->save(['password'=>password_hash($params['password'], PASSWORD_DEFAULT)]);
|
||||
}else{
|
||||
throw new \think\Exception('密码不正确!', 100002);
|
||||
}
|
||||
}
|
||||
|
||||
if($user->status != 1){
|
||||
throw new \think\Exception('当前用户不可用', 100003);
|
||||
}
|
||||
return $user->append(['token']);
|
||||
}else{
|
||||
throw new \think\Exception('当前用户不存在', 100001);
|
||||
$member = Member::where($map)->findOrEmpty();
|
||||
if(!$member->isEmpty()){
|
||||
$user = Users::create(['uid' => $member['uid'], 'username' => $member['username'], 'password' => password_hash($params['password'], PASSWORD_DEFAULT), 'nickname' => $member['nickname'], 'email' => $member['email'], 'department_id' => $member['department']]);
|
||||
}else{
|
||||
throw new \think\Exception('当前用户不存在', 100001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +63,7 @@ class AuthService{
|
||||
public function getAuthMenu(){
|
||||
$order = "sort asc, id desc";
|
||||
$map = [];
|
||||
if(request()->user['uid'] == Env::get('admin_root')){
|
||||
if(request()->user['uid'] != Env::get('admin_root')){
|
||||
$map[] = ['name', 'IN', request()->auth()['permission']];
|
||||
}
|
||||
$map[] = ['type', '=', 'menu'];
|
||||
@@ -64,4 +76,23 @@ class AuthService{
|
||||
|
||||
return (new Tree())->listToTree($list, 'id', 'parent_id', 'children');
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取已授权菜单
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getAuthPermissions(){
|
||||
$map = [];
|
||||
if(request()->user['uid'] != Env::get('admin_root')){
|
||||
$map[] = ['name', 'IN', request()->auth()['permission']];
|
||||
}
|
||||
$map[] = ['hidden', '=', 0];
|
||||
$list = Permissions::where($map)->select();
|
||||
$data = [];
|
||||
foreach($list as $item){
|
||||
$data[] = $item['name'];
|
||||
};
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ class MenuService{
|
||||
$rootid = Env::get('admin_root');
|
||||
$order = "sort asc, id desc";
|
||||
$map = [];
|
||||
if(request()->user['uid'] == $rootid){
|
||||
if(request()->user['uid'] != $rootid){
|
||||
$map[] = ['name', 'IN', request()->auth()['permission']];
|
||||
}
|
||||
if($is_menu){
|
||||
|
||||
@@ -86,4 +86,9 @@ class RoleService{
|
||||
];
|
||||
return $role->save($save);
|
||||
}
|
||||
|
||||
public function updateRole($request){
|
||||
$data = $request->param();
|
||||
return Roles::update($data);
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace app\services\auth;
|
||||
use app\model\auth\Users;
|
||||
use app\model\auth\UsersLog;
|
||||
use xin\helper\Server;
|
||||
use xin\helper\Time;
|
||||
|
||||
class UsersLogService{
|
||||
|
||||
@@ -23,6 +24,17 @@ class UsersLogService{
|
||||
public function getUserLogList($request){
|
||||
$param = $request->param();
|
||||
$map = [];
|
||||
if(isset($param['date_type']) && $param['date_type']){
|
||||
$time = Time::today();
|
||||
if($param['date_type'] == 'seven'){
|
||||
$time = Time::dayToNow(7);
|
||||
}elseif($param['date_type'] == 'yesterday'){
|
||||
$time = Time::yesterday(7);
|
||||
}elseif($param['date_type'] == 'week'){
|
||||
$time = Time::week(7);
|
||||
}
|
||||
$map[] = ['create_time', 'BETWEEN TIME', $time];
|
||||
}
|
||||
if(isset($param['method']) && $param['method']){
|
||||
$map[] = ['method', '=', strtoupper($param['method'])];
|
||||
}
|
||||
@@ -34,6 +46,38 @@ class UsersLogService{
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取用户操作日志
|
||||
*
|
||||
* @param [type] $request
|
||||
* @return void
|
||||
*/
|
||||
public function getMyLogList($request){
|
||||
$param = $request->param();
|
||||
$map = [];
|
||||
$map[] = ['uid', '=', $request->user['uid']];
|
||||
if(isset($param['method']) && $param['method']){
|
||||
$map[] = ['method', '=', strtoupper($param['method'])];
|
||||
}
|
||||
if(isset($param['date_type']) && $param['date_type']){
|
||||
$time = Time::today();
|
||||
if($param['date_type'] == 'seven'){
|
||||
$time = Time::dayToNow(7);
|
||||
}elseif($param['date_type'] == 'yesterday'){
|
||||
$time = Time::yesterday(7);
|
||||
}elseif($param['date_type'] == 'week'){
|
||||
$time = Time::week(7);
|
||||
}
|
||||
$map[] = ['create_time', 'BETWEEN TIME', $time];
|
||||
}
|
||||
if(isset($param['date']) && $param['date'] && count($param['date']) == 2){
|
||||
$map[] = ['create_time', 'BETWEEN TIME', $param['date']];
|
||||
}
|
||||
|
||||
$list = UsersLog::with(['user'])->where($map)->order('create_time desc')->paginate($request->pageConfig);
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 用户操作记录
|
||||
*
|
||||
@@ -47,11 +91,12 @@ class UsersLogService{
|
||||
if(!isset($request->user['uid'])){
|
||||
return false;
|
||||
}
|
||||
$param = strlen(json_encode($param)) > 1000 ? 'param to loog' : json_encode($param);
|
||||
$data = [
|
||||
'uid' => isset($request->user['uid']) ? $request->user['uid'] : '',
|
||||
'title' => self::getCurrentTitle($request),
|
||||
'route' => $request->baseUrl(),
|
||||
'params' => json_encode($param),
|
||||
'params' => $param,
|
||||
'method' => $request->method(),
|
||||
'client_ip' => Server::getRemoteIp(),
|
||||
'browser' => $request->header('user-agent'),
|
||||
|
||||
@@ -37,7 +37,7 @@ class UsersService{
|
||||
$q->name('user_has_roles')->where($subMap)->field('uid');
|
||||
}];
|
||||
}
|
||||
$list = Users::with(['roles'])->auth([])->where($map)->order('uid desc')->paginate($request->pageConfig)->each(function($item){
|
||||
$list = Users::with(['roles', 'department'])->auth([])->where($map)->order('uid desc')->paginate($request->pageConfig)->each(function($item){
|
||||
$roleId = [];
|
||||
$roleName = [];
|
||||
$identify = [];
|
||||
@@ -60,14 +60,15 @@ class UsersService{
|
||||
*/
|
||||
public function createUsers($request){
|
||||
$param = $request->param();
|
||||
// $data = [
|
||||
// 'username' => $param['username'],
|
||||
// 'nickname' => $param['nickname'],
|
||||
// 'department_id' => $param['department_id']
|
||||
// ];
|
||||
$data = [
|
||||
'username' => $param['username'],
|
||||
'nickname' => $param['nickname'],
|
||||
'password' => $param['password'],
|
||||
'department_id' => $param['department_id']
|
||||
];
|
||||
|
||||
// $user = Users::create($data);
|
||||
// return $user;
|
||||
$user = Users::create($data);
|
||||
return $user;
|
||||
}
|
||||
/**
|
||||
* @title 批量导入
|
||||
@@ -103,18 +104,42 @@ class UsersService{
|
||||
}
|
||||
public function updateUsers($request){
|
||||
$param = $request->param();
|
||||
$roles = isset($param['role_id']) ? $param['role_id'] : [];
|
||||
$user = Users::where('uid', '=', $param['uid'])->findOrEmpty();
|
||||
if(!$user->isEmpty()){
|
||||
$data = [
|
||||
'avatar' => $param['avatar'],
|
||||
'nickname' => $param['nickname'],
|
||||
'department_id' => is_array($param['department_id']) ? $param['department_id'][0] : $param['department_id'],
|
||||
'manage_class' => $param['manage_class'],
|
||||
];
|
||||
if(isset($param['nickname']) && $param['nickname']){
|
||||
$data['nickname'] = $param['nickname'];
|
||||
}
|
||||
if(isset($param['email']) && $param['email']){
|
||||
$data['email'] = $param['email'];
|
||||
}
|
||||
if(isset($param['avatar']) && $param['avatar']){
|
||||
$data['avatar'] = $param['avatar'];
|
||||
}
|
||||
if(isset($param['department_id']) && $param['department_id']){
|
||||
$data['department_id'] = is_array($param['department_id']) ? end($param['department_id']) : $param['department_id'];
|
||||
}
|
||||
$user->save($data);
|
||||
}
|
||||
if(!empty($roles)){
|
||||
$this->updateRoles($param['uid'], $roles); //更新角色
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function updateUserPassword($request){
|
||||
$user = Users::where('uid', '=', $request->user['uid'])->findOrEmpty();
|
||||
$params = $request->param();
|
||||
if(!$user->isEmpty()){
|
||||
if(password_verify($params['oldpassword'], $user->password)){
|
||||
$user->save(['password' => $params['password']]);
|
||||
}else{
|
||||
throw new \think\Exception("当前密码错误!", 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 获取用户权限信息
|
||||
*
|
||||
|
||||
16
app/services/socialite/WechatService.php
Normal file
16
app/services/socialite/WechatService.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\services\socialite;
|
||||
|
||||
class WechatService{
|
||||
|
||||
public function login(){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
24
app/validate/auth/Users.php
Normal file
24
app/validate/auth/Users.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\validate\auth;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
class Index extends Validate{
|
||||
|
||||
protected $rule = [
|
||||
'password' => 'require'
|
||||
];
|
||||
protected $message = [
|
||||
'password.require' => '登录密码必须',
|
||||
];
|
||||
protected $scene = [
|
||||
'passwd' => ['password'],
|
||||
];
|
||||
}
|
||||
4
config/auth.php
Normal file
4
config/auth.php
Normal file
@@ -0,0 +1,4 @@
|
||||
<?php
|
||||
return [
|
||||
'admin_root' => [1]
|
||||
];
|
||||
@@ -57,6 +57,43 @@ return [
|
||||
// 开启字段缓存
|
||||
'fields_cache' => false,
|
||||
],
|
||||
'bestcrm' => [
|
||||
// 数据库类型
|
||||
'type' => env('database.type', 'mysql'),
|
||||
// 服务器地址
|
||||
'hostname' => env('database.hostname', '127.0.0.1'),
|
||||
// 数据库名
|
||||
'database' => 'bestcrm_www',
|
||||
// 用户名
|
||||
'username' => 'bestcrm_www',
|
||||
// 密码
|
||||
'password' => 'L6XmtaD47rYxMA68',
|
||||
// 端口
|
||||
'hostport' => env('database.hostport', '3306'),
|
||||
// 数据库连接参数
|
||||
'params' => [],
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => env('database.charset', 'utf8'),
|
||||
// 数据库表前缀
|
||||
'prefix' => env('database.prefix', 'sent_'),
|
||||
|
||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||
'deploy' => 0,
|
||||
// 数据库读写是否分离 主从式有效
|
||||
'rw_separate' => false,
|
||||
// 读写分离后 主服务器数量
|
||||
'master_num' => 1,
|
||||
// 指定从服务器序号
|
||||
'slave_no' => '',
|
||||
// 是否严格检查字段是否存在
|
||||
'fields_strict' => true,
|
||||
// 是否需要断线重连
|
||||
'break_reconnect' => false,
|
||||
// 监听SQL
|
||||
'trigger_sql' => env('app_debug', true),
|
||||
// 开启字段缓存
|
||||
'fields_cache' => false,
|
||||
]
|
||||
|
||||
// 更多的数据库配置信息
|
||||
],
|
||||
|
||||
@@ -18,8 +18,8 @@ return [
|
||||
'unique_id_key' => 'uid',
|
||||
'signer_key' => 'tensent',
|
||||
'not_before' => 0,
|
||||
'expires_at' => 3600,
|
||||
'refresh_ttL' => 7200,
|
||||
'expires_at' => 86400,
|
||||
'refresh_ttL' => 72000,
|
||||
'signer' => 'Lcobucci\JWT\Signer\Hmac\Sha256',
|
||||
'type' => 'Header',
|
||||
'relogin_code' => 50001,
|
||||
|
||||
@@ -23,4 +23,6 @@ Route::group('/', function(){
|
||||
Route::rule('auth/user/:action', 'auth.User/:action');
|
||||
Route::rule('auth/department/:action', 'auth.Department/:action');
|
||||
Route::rule('auth/role/:action', 'auth.Role/:action');
|
||||
Route::rule('tools/filter/:action', 'tools.Filter/:action');
|
||||
Route::rule('tools/inspect/:action', 'tools.Inspect/:action');
|
||||
})->middleware([\app\middleware\Check::class], 'api');
|
||||
@@ -10,4 +10,5 @@ use think\facade\Route;
|
||||
|
||||
Route::group('auth', function(){
|
||||
Route::post('login', 'auth.Index/login');
|
||||
Route::get('member', 'auth.Index/member');
|
||||
});
|
||||
Reference in New Issue
Block a user