基础功能、图片上传
This commit is contained in:
@@ -72,4 +72,18 @@ class AdminController extends BaseController
|
||||
'获取成功'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
* @Method GET
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public function menu(): JsonResponse
|
||||
{
|
||||
return jok(
|
||||
$this->service->menu(),
|
||||
'获取成功'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,12 +25,12 @@ class LoginController extends BaseController
|
||||
public function login()
|
||||
{
|
||||
$this->insertField = [
|
||||
'phone', 'password', 'remember'
|
||||
'account', 'password'
|
||||
];
|
||||
$param = $this->checkRequiredFields(request()->post());
|
||||
|
||||
return jok(
|
||||
$this->service->login($param['phone'], $param['password']),
|
||||
$this->service->login($param['account'], $param['password']),
|
||||
'登录成功'
|
||||
);
|
||||
}
|
||||
@@ -54,4 +54,20 @@ class LoginController extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
return jok(
|
||||
[],
|
||||
'退出成功'
|
||||
);
|
||||
}
|
||||
|
||||
public function codes()
|
||||
{
|
||||
return jok(
|
||||
[],
|
||||
'获取成功'
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
35
app/Http/Controllers/Api/MenuController.php
Executable file
35
app/Http/Controllers/Api/MenuController.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\MenuService;
|
||||
|
||||
class MenuController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = [ 'pid', 'title', 'icon', 'path', 'affix_tab', 'keep_alive', 'hide_in_menu', 'sort' ];
|
||||
$this->updateField = [ 'id', 'pid', 'title', 'icon', 'path', 'affix_tab', 'redirect', 'keep_alive', 'hide_in_menu', 'badge_variants', 'sort' ];
|
||||
$this->notRequest = [ 'name', 'badge', 'iframe_src', 'redirect', 'query', 'badge_type', 'badge_variants', 'component' ];
|
||||
$this->service = MenuService::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单树形下拉列表
|
||||
* @Method GET
|
||||
* @return \Illuminate\Http\JsonResponse
|
||||
* @throws \Psr\Container\ContainerExceptionInterface
|
||||
* @throws \Psr\Container\NotFoundExceptionInterface
|
||||
*/
|
||||
public function getTreeOption()
|
||||
{
|
||||
$isSelect = request()->get('is_select', false);
|
||||
return jok(
|
||||
$this->service->getTreeOption($isSelect)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
54
app/Http/Controllers/Api/RoleController.php
Executable file
54
app/Http/Controllers/Api/RoleController.php
Executable file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\RoleService;
|
||||
use Exception;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class RoleController extends BaseController
|
||||
{
|
||||
//
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->insertField = ['name', 'value', 'desc'];
|
||||
$this->updateField = ['id', 'name', 'value', 'desc'];
|
||||
$this->service = RoleService::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色菜单ID
|
||||
* @Method GET
|
||||
* @return JsonResponse
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getMenuIdsByRoleIds(): JsonResponse
|
||||
{
|
||||
$roleId = request()->get('role_id', null);
|
||||
return jok(
|
||||
$this->service->getMenuIdsByRoleIds($roleId)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色菜单
|
||||
* @Method POST
|
||||
* @return JsonResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public function saveRoleMenu(): JsonResponse
|
||||
{
|
||||
$this->insertField = ['role_id', 'menu_id'];
|
||||
$this->checkRequiredFields(request()->post());
|
||||
$roleId = request()->post('role_id');
|
||||
$menuIds = request()->post('menu_id', []);
|
||||
return jok(
|
||||
$this->service->saveRoleMenu($roleId, $menuIds)
|
||||
);
|
||||
}
|
||||
}
|
||||
47
app/Http/Controllers/Api/UploadController.php
Normal file
47
app/Http/Controllers/Api/UploadController.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\common\UploadService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class UploadController extends BaseController
|
||||
{
|
||||
//
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = UploadService::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
* @Method POST
|
||||
* @return JsonResponse
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function image()
|
||||
{
|
||||
$file = request()->file('file');
|
||||
return jok(
|
||||
$this->service->uploadImage($file),
|
||||
'上传成功'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频上传
|
||||
* @Method POST
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function video()
|
||||
{
|
||||
$file = request()->file('file');
|
||||
return jok(
|
||||
$this->service->uploadVideo($file),
|
||||
'上传成功'
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,29 @@ class AdminService extends BaseService
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->selectField = [ 'id', 'phone', 'nick_name', 'avatar', 'email', 'balance', 'is_sys_notifications', 'is_collection_notifications', 'is_marketing_notifications', 'qr_code', 'role_id', 'ip', 'ip_table', 'status', 'last_reset_password_at', 'created_at', 'updated_at', 'deleted_at', ];
|
||||
$this->selectField = [
|
||||
'id',
|
||||
'open_id',
|
||||
'avatar',
|
||||
'nick_name',
|
||||
'password',
|
||||
'phone',
|
||||
'email',
|
||||
'code',
|
||||
'role_id',
|
||||
'province_id',
|
||||
'city_id',
|
||||
'reg_ip',
|
||||
'last_login_time',
|
||||
'ip',
|
||||
'ip_table',
|
||||
'operation_password',
|
||||
'desc',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
$this->model = AdminModel::class;
|
||||
$this->queryField = [
|
||||
'phone' => 'like',
|
||||
@@ -45,7 +67,6 @@ class AdminService extends BaseService
|
||||
foreach ($result['items'] as &$v) {
|
||||
$v['ip_table'] = json_decode($v['ip_table'], true);
|
||||
$v['status_text'] = UserStatusEnum::from($v['status'])->description();
|
||||
$v['last_reset_password_at'] = format_time($v['last_reset_password_at']);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -189,7 +210,7 @@ class AdminService extends BaseService
|
||||
{
|
||||
if ($this->roleId !== 1) {
|
||||
// 从redis获取菜单列表
|
||||
$redis = RedisService::getInstance()->init(config('xk.redis.menu_key'))->get($this->roleId);
|
||||
$redis = RedisService::getInstance()->init(config('nl.redis.menu_key'))->get($this->roleId);
|
||||
// $redis = null;
|
||||
if (!empty($redis)) {
|
||||
return json_decode($redis, true);
|
||||
@@ -232,7 +253,7 @@ class AdminService extends BaseService
|
||||
return $a['meta']['order'] - $b['meta']['order'];
|
||||
});
|
||||
// 缓存菜单列表到redis
|
||||
RedisService::getInstance()->init(config('xk.redis.menu_key'))->set($this->roleId, json_encode($result), 3600);
|
||||
RedisService::getInstance()->init(config('nl.redis.menu_key'))->set($this->roleId, json_encode($result), 3600);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ class LoginService extends BaseNotAuthService
|
||||
'nick_name' => $userModel->nick_name,
|
||||
'avatar' => $userModel->avatar,
|
||||
'email' => $userModel->email,
|
||||
'role_id' => $userModel->role_id,
|
||||
'role_name' => $userModel->role->name,
|
||||
'role_value' => $userModel->role->value,
|
||||
'ip' => $userModel->ip,
|
||||
|
||||
145
app/Service/MenuService.php
Executable file
145
app/Service/MenuService.php
Executable file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\MenuModel;
|
||||
use Exception;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* 角色服务类
|
||||
*/
|
||||
class MenuService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->model = MenuModel::class;
|
||||
$this->selectField = [
|
||||
'id', 'pid', 'title', 'icon', 'name', 'affix_tab', 'path', 'component', 'redirect', 'keep_alive', 'hide_in_menu', 'badge', 'badge_type', 'badge_variants', 'iframe_src', 'sort', 'query', 'created_at'
|
||||
];
|
||||
$this->queryField = [ 'title' => 'like', 'pid' => '=' ];
|
||||
$this->optionField = ['id', 'title'];
|
||||
$this->orderBy = [
|
||||
'name' => 'sort',
|
||||
'sort' => 'asc'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list()
|
||||
{
|
||||
// /order/product-order
|
||||
$this->where[] = ['pid', '=', 0];
|
||||
$list = $this->getPageList();
|
||||
$ids = array_column($list['items'], 'id');
|
||||
$items = $this->model::whereIn('pid', $ids)->get($this->selectField);
|
||||
$childrenIds = [];
|
||||
foreach ($items as $v) {
|
||||
$list['items'][] = $v;
|
||||
$childrenIds[] = $v['id'];
|
||||
}
|
||||
$items = $this->model::whereIn('pid', $childrenIds)->get($this->selectField);
|
||||
foreach ($items as $v) {
|
||||
$list['items'][] = $v;
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取树形结构的菜单下拉
|
||||
* @param bool $isSelect
|
||||
* @return array
|
||||
*/
|
||||
public function getTreeOption(bool $isSelect = false): array
|
||||
{
|
||||
$this->optionField = ['id', 'title', 'icon', 'pid'];
|
||||
$list = $this->model::get($this->optionField);
|
||||
$result = $this->utils->tree($list);
|
||||
if ($isSelect == 'true') {
|
||||
array_unshift($result, [ 'id' => 0, 'title' => '根目录', 'pid' => 0, 'icon' => '' ]);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下拉列表
|
||||
* @return mixed
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
* @throws Exception
|
||||
*/
|
||||
public function option(): mixed
|
||||
{
|
||||
$option = $this->getOption();
|
||||
if (request()->get('is_select', false)) {
|
||||
$result = [
|
||||
[ 'id' => 0, 'title' => '根目录' ]
|
||||
];
|
||||
foreach ($option as $item) {
|
||||
$result[] = [ 'id' => $item['id'], 'title' => $item['title'] ];
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
return $option;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id): mixed
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
$params['badge_type'] = !empty($params['badge_type']) ? $params['badge_type']: 0;
|
||||
$params['badge_variants'] = !empty($params['badge_variants']) ? $params['badge_variants']: 0;
|
||||
$params['created_at'] = time();
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
$params['badge_type'] = !empty($params['badge_type']) ? $params['badge_type']: 0;
|
||||
$params['badge_variants'] = !empty($params['badge_variants']) ? $params['badge_variants']: 0;
|
||||
$params['updated_at'] = time();
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param $id
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($id): mixed
|
||||
{
|
||||
if (in_array($id, [1, 2])) {
|
||||
$this->utils->errorThrow('管理员角色禁止删除');
|
||||
}
|
||||
return $this->del($id);
|
||||
}
|
||||
}
|
||||
161
app/Service/RoleService.php
Executable file
161
app/Service/RoleService.php
Executable file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\BaseApp\BaseService;
|
||||
use App\Models\RoleMenuRelationModel;
|
||||
use App\Models\RoleModel;
|
||||
use App\Service\common\RedisService;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
/**
|
||||
* 角色服务类
|
||||
*/
|
||||
class RoleService extends BaseService
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->model = RoleModel::class;
|
||||
$this->selectField = ['id', 'name', 'value', 'pid', 'desc', 'created_at'];
|
||||
$this->queryField = ['name' => 'like', 'value' => 'like', 'pid' => '='];
|
||||
$this->orderBy = ['name' => 'id', 'sort' => 'asc'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function list(): array
|
||||
{
|
||||
return $this->getPageList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下拉列表
|
||||
* @return mixed
|
||||
*/
|
||||
public function option(): mixed
|
||||
{
|
||||
return $this->getOption();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色ID获取菜单ID
|
||||
* @param $roleId
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getMenuIdsByRoleIds($roleId): mixed
|
||||
{
|
||||
if (empty($roleId)) $this->utils->errorThrow('请选择角色');
|
||||
return RoleMenuRelationModel::where('role_id', $roleId)->pluck('menu_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存角色菜单关系
|
||||
* @param $roleId
|
||||
* @param $menuIds
|
||||
* @return true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function saveRoleMenu($roleId, $menuIds): true
|
||||
{
|
||||
|
||||
$menus = array_unique($menuIds);
|
||||
|
||||
// 查询角色当前绑定的菜单
|
||||
$bindResources = RoleMenuRelationModel::where('role_id', $roleId)->pluck('menu_id');
|
||||
|
||||
// 开启事务
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
// 提取查询到的菜单ID
|
||||
$existingResourceIds = $bindResources->toArray();
|
||||
// 传值中不存在的菜单ID,从数据库中删除
|
||||
$menusToDelete = array_diff($existingResourceIds, $menus);
|
||||
if (!empty($menusToDelete)) {
|
||||
$delBindResources = RoleMenuRelationModel::where('role_id', $roleId)->whereIn('menu_id', array_values($menusToDelete))->delete();
|
||||
|
||||
if (!$delBindResources) {
|
||||
$this->utils->errorThrow('更新失败!');
|
||||
}
|
||||
}
|
||||
|
||||
// 传值中存在但数据库中不存在的菜单ID,新增到数据库
|
||||
$menusToAdd = array_diff($menus, $existingResourceIds);
|
||||
$insertData = [];
|
||||
foreach ($menusToAdd as $menusId) {
|
||||
$insertData[] = [
|
||||
'role_id' => $roleId,
|
||||
'menu_id' => $menusId,
|
||||
'created_at' => time()
|
||||
];
|
||||
}
|
||||
$userRoleBinding = RoleMenuRelationModel::insert($insertData);
|
||||
if (!$userRoleBinding) {
|
||||
$this->utils->errorThrow('更新失败!');
|
||||
}
|
||||
|
||||
DB::commit();
|
||||
RedisService::getInstance()->init(config('nl.redis.menu_key'))->del($roleId);
|
||||
} catch (\Exception $e) {
|
||||
DB::rollBack();
|
||||
$this->utils->errorThrow($e->getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据详情
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function detail($id): mixed
|
||||
{
|
||||
return $this->getDetail($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param $params
|
||||
* @return mixed
|
||||
*/
|
||||
public function create($params): mixed
|
||||
{
|
||||
return $this->insert($params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
* @param $id
|
||||
* @param $params
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function update($id, $params): mixed
|
||||
{
|
||||
return $this->save($id, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除数据
|
||||
* @param $id
|
||||
* @return mixed|true
|
||||
* @throws Exception
|
||||
*/
|
||||
public function delete($id): mixed
|
||||
{
|
||||
if (in_array($id, [1, 2])) {
|
||||
$this->utils->errorThrow('管理员角色禁止删除');
|
||||
}
|
||||
return $this->del($id);
|
||||
}
|
||||
}
|
||||
@@ -48,14 +48,14 @@ class JWTService
|
||||
public function generateToken(array $data): string
|
||||
{
|
||||
$issuedAt = time();
|
||||
$expirationTime = $issuedAt + config('cc.redis.jwt_ttl', 600000);
|
||||
$expirationTime = $issuedAt + config('nl.redis.jwt_ttl', 600000);
|
||||
|
||||
$payload = [
|
||||
'iat' => $issuedAt,
|
||||
'exp' => $expirationTime,
|
||||
'data' => $data
|
||||
];
|
||||
RedisService::getInstance()->init(config('cc.redis.jwt'))->set($data['id'], json_encode($data));
|
||||
RedisService::getInstance()->init(config('nl.redis.jwt'))->set($data['id'], json_encode($data));
|
||||
return JWT::encode($payload, $this->secretKey, 'HS256');
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ class JWTService
|
||||
{
|
||||
try {
|
||||
$jwt = $this->parseToken();
|
||||
$user = RedisService::getInstance()->init(config('cc.redis.jwt'))->get($jwt->data->id);
|
||||
$user = RedisService::getInstance()->init(config('nl.redis.jwt'))->get($jwt->data->id);
|
||||
if (empty($user)) return UtilsService::getInstance()->notAuth('登录状态过期');
|
||||
return json_decode($user, true);
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -22,10 +22,10 @@ class QiniuStorageService extends BaseService
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->accessKey = config('cc.oss.qiniu.access_key');
|
||||
$this->secretKey = config('cc.oss.qiniu.secret_key');
|
||||
$this->bucket = config('cc.oss.qiniu.bucket');
|
||||
$this->domain = config('cc.oss.qiniu.domain');
|
||||
$this->accessKey = config('nl.oss.qiniu.access_key');
|
||||
$this->secretKey = config('nl.oss.qiniu.secret_key');
|
||||
$this->bucket = config('nl.oss.qiniu.bucket');
|
||||
$this->domain = config('nl.oss.qiniu.domain');
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ if (!function_exists('money_format')) {
|
||||
if (!function_exists('ase_password')) {
|
||||
function ase_password($password): string
|
||||
{
|
||||
return sha1($password. config('cc.configs.ase.slate'));
|
||||
return sha1($password. config('nl.configs.ase.slate'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +380,7 @@ if (!function_exists('ase_password')) {
|
||||
if (!function_exists('cc_get_project_url')) {
|
||||
function cc_get_project_url(): string
|
||||
{
|
||||
$url = config('cc.configs.project_url');
|
||||
$url = config('nl.configs.project_url');
|
||||
if (empty($url)) {
|
||||
$url = request()->root(true);
|
||||
}
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
/*
|
||||
Navicat Premium Dump SQL
|
||||
|
||||
Source Server : 本地
|
||||
Source Server Type : MySQL
|
||||
Source Server Version : 80405 (8.4.5)
|
||||
Source Host : localhost:3306
|
||||
Source Schema : cc_admin
|
||||
|
||||
Target Server Type : MySQL
|
||||
Target Server Version : 80405 (8.4.5)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 12/05/2025 00:18:57
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for cc_admin
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `cc_admin`;
|
||||
CREATE TABLE `cc_admin` (
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||
`open_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'OpenID,后期整合萧康服务中心会用到',
|
||||
`avatar` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '头像',
|
||||
`nick_name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '昵称',
|
||||
`password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
|
||||
`phone` char(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户手机',
|
||||
`email` char(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户邮箱',
|
||||
`code` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '业务员推广码',
|
||||
`role_id` int NOT NULL DEFAULT 0 COMMENT '角色',
|
||||
`province_id` int NOT NULL DEFAULT 0 COMMENT '省',
|
||||
`city_id` int NOT NULL DEFAULT 0 COMMENT '市',
|
||||
`reg_ip` bigint NOT NULL DEFAULT 0 COMMENT '注册IP',
|
||||
`last_login_time` int NOT NULL DEFAULT 0 COMMENT '最后登录时间',
|
||||
`last_login_ip` bigint NOT NULL DEFAULT 0 COMMENT '最后登录IP',
|
||||
`operation_password` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '0' COMMENT '操作密码',
|
||||
`desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '备注',
|
||||
`status` tinyint NOT NULL DEFAULT 1 COMMENT '用户状态 0正常 1禁用',
|
||||
`created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
`deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '管理员表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of cc_admin
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xk_admin_notice
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `xk_admin_notice`;
|
||||
CREATE TABLE `xk_admin_notice` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`title` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '消息标题',
|
||||
`detail` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '简介',
|
||||
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '消息内容',
|
||||
`type` int NOT NULL DEFAULT 0 COMMENT '消息类型',
|
||||
`user_id` int NOT NULL DEFAULT 0 COMMENT '关联用户ID',
|
||||
`status` int NOT NULL DEFAULT 0 COMMENT '状态 0:未读 1:已读',
|
||||
`created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
`deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 84 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '管理员消息列表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xk_admin_notice
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xk_api_op_log
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `xk_api_op_log`;
|
||||
CREATE TABLE `xk_api_op_log` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`user_id` int NOT NULL COMMENT '操作用户ID',
|
||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '操作路由',
|
||||
`method` tinyint(1) NOT NULL DEFAULT 0 COMMENT '请求方式 0:未知 1:GET 2:POST',
|
||||
`controller` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '操作的控制器',
|
||||
`ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '操作者IP地址',
|
||||
`param` json NOT NULL COMMENT '请求携带参数',
|
||||
`result` json NOT NULL COMMENT '返回json',
|
||||
`type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '操作状态 0:成功 1:失败',
|
||||
`result_code` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '返回状态码',
|
||||
`platform_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '平台类型 0:总后台 1:门店后台 2:小程序',
|
||||
`belong_id` int NOT NULL DEFAULT 0 COMMENT '所属平台ID',
|
||||
`user_type` int NOT NULL DEFAULT 0 COMMENT '用户类型',
|
||||
`equipment` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '操作系统',
|
||||
`browser` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '浏览器',
|
||||
`created_at` int NOT NULL DEFAULT 0 COMMENT '操作时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 16860 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '新的后台API访问日志记录' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xk_api_op_log
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xk_file
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `xk_file`;
|
||||
CREATE TABLE `xk_file` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`user_id` int NOT NULL DEFAULT 0 COMMENT '用户ID',
|
||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '文件地址',
|
||||
`type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '文件类型 0:图片 1:视频 2:音频 3:excel 4:压缩包 ',
|
||||
`source` tinyint(1) NOT NULL COMMENT '来源 0:后台 1:用户端 2:医生端小程序 3:医生PC端 4:旧的后台',
|
||||
`created_at` int NOT NULL COMMENT '上传时间',
|
||||
`updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
`deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 84 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '文件表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xk_file
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xk_menu
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `xk_menu`;
|
||||
CREATE TABLE `xk_menu` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '菜单标题',
|
||||
`icon` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '菜单图标',
|
||||
`name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '页面Name,全局唯一',
|
||||
`path` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '访问路由',
|
||||
`component` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '组件路径需要去掉 views/ 和 .vue',
|
||||
`redirect` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '父级菜单重定向的子集菜单',
|
||||
`keep_alive` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否开启页面缓存 0:开启 1:关闭',
|
||||
`hide_in_menu` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否将页面展示在菜单栏 0:展示 1:隐藏',
|
||||
`affix_tab` tinyint(1) NOT NULL DEFAULT 1 COMMENT '是否为置顶页 0:是 1:否',
|
||||
`badge` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '菜单的徽标',
|
||||
`badge_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '用于配置页面的徽标类型,0:dot 小红点 1:normal 文本',
|
||||
`badge_variants` tinyint(1) NOT NULL DEFAULT 0 COMMENT '用于配置页面的徽标颜色 \r\n0:default 1:destructive 2:primary 3:success 4: warning',
|
||||
`iframe_src` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '内嵌的页面路径',
|
||||
`pid` int NOT NULL DEFAULT 0 COMMENT '父级菜单id',
|
||||
`sort` int NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`query` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '默认查询参数',
|
||||
`created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
`deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '菜单表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xk_menu
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xk_role
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `xk_role`;
|
||||
CREATE TABLE `xk_role` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`user_type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '用户类型 1:诊所 2:平台 3:供应商',
|
||||
`name` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '角色名称',
|
||||
`value` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '角色值',
|
||||
`pid` int NOT NULL DEFAULT 0 COMMENT '上级角色',
|
||||
`desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '角色说明',
|
||||
`created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
`updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
`deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '角色表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xk_role
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for xk_role_menu_relations
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `xk_role_menu_relations`;
|
||||
CREATE TABLE `xk_role_menu_relations` (
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||
`role_id` int NOT NULL DEFAULT 0 COMMENT '角色ID',
|
||||
`menu_id` int NOT NULL DEFAULT 0 COMMENT '菜单ID',
|
||||
`created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 65 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '角色权限绑定表' ROW_FORMAT = Dynamic;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of xk_role_menu_relations
|
||||
-- ----------------------------
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
@@ -11,7 +11,7 @@
|
||||
Target Server Version : 80404 (8.4.4)
|
||||
File Encoding : 65001
|
||||
|
||||
Date: 12/05/2025 13:12:32
|
||||
Date: 12/05/2025 16:02:21
|
||||
*/
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
@@ -110,7 +110,7 @@ CREATE TABLE `nl_file` (
|
||||
`user_id` int NOT NULL DEFAULT 0 COMMENT '用户ID',
|
||||
`url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '文件地址',
|
||||
`type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '文件类型 0:图片 1:视频 2:音频 3:excel 4:压缩包 ',
|
||||
`source` tinyint(1) NOT NULL COMMENT '来源 0:后台 1:用户端 2:医生端小程序 3:医生PC端 4:旧的后台',
|
||||
`source` tinyint(1) NOT NULL DEFAULT 0 COMMENT '来源 0:后台 1:用户端',
|
||||
`created_at` int NOT NULL COMMENT '上传时间',
|
||||
`updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
`deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||
@@ -147,11 +147,19 @@ CREATE TABLE `nl_menu` (
|
||||
`updated_at` int NOT NULL DEFAULT 0 COMMENT '更新时间',
|
||||
`deleted_at` int NOT NULL DEFAULT 0 COMMENT '删除时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '菜单表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '菜单表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of nl_menu
|
||||
-- ----------------------------
|
||||
INSERT INTO `nl_menu` VALUES (1, '概览', 'twemoji:house-with-garden', 'Dashboard', '/', 'BasicLayout', '', 0, 0, 1, '', 0, 0, '', 0, -1, '', 1734485082, 1734486088, 0);
|
||||
INSERT INTO `nl_menu` VALUES (2, '分析页', 'lucide:area-chart', 'Analytics', '/analytics', '/dashboard/analytics/index', '', 1, 0, 0, '', 0, 0, '', 1, 0, '', 1734485206, 1734485814, 0);
|
||||
INSERT INTO `nl_menu` VALUES (3, '工作台', 'carbon:workspace', 'Workspace', '/workspace', '/dashboard/workspace/index', '', 1, 0, 1, '', 0, 0, '', 1, 0, '', 1734486030, 0, 0);
|
||||
INSERT INTO `nl_menu` VALUES (4, '关于', 'lucide:copyright', 'About', '/about', '/_core/about/index.vue', '', 1, 0, 1, '', 0, 0, '', 0, 999999999, '', 0, 0, 0);
|
||||
INSERT INTO `nl_menu` VALUES (5, '基础管理', 'logos:openjs-foundation-icon', 'System', '/system', 'BasicLayout', '', 0, 0, 1, '', 0, 0, '', 0, 1000, '', 1734486082, 1735117933, 0);
|
||||
INSERT INTO `nl_menu` VALUES (6, '管理员管理', 'grommet-icons:user-admin', 'SystemUser', '/system/user', '/system/admin/index', '', 1, 0, 1, '', 0, 0, '', 5, 0, '', 1734486178, 0, 0);
|
||||
INSERT INTO `nl_menu` VALUES (7, '角色管理', 'carbon:user-role', 'SystemRole', '/system/role', '/system/role/index', '', 1, 0, 1, '', 0, 0, '', 5, 1, '', 1734486291, 1734489429, 0);
|
||||
INSERT INTO `nl_menu` VALUES (8, '菜单管理', 'line-md:menu', 'SystemMenu', '/system/menu', '/system/menu/index', '', 1, 0, 1, '', 0, 0, '', 5, 2, '', 1734486345, 0, 0);
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for nl_role
|
||||
@@ -184,10 +192,18 @@ CREATE TABLE `nl_role_menu_relations` (
|
||||
`menu_id` int NOT NULL DEFAULT 0 COMMENT '菜单ID',
|
||||
`created_at` int NOT NULL DEFAULT 0 COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 65 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '角色权限绑定表' ROW_FORMAT = DYNAMIC;
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '角色权限绑定表' ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of nl_role_menu_relations
|
||||
-- ----------------------------
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (1, 1, 1, 1747033198);
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (2, 1, 2, 1747033198);
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (3, 1, 3, 1747033198);
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (4, 1, 4, 1747033198);
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (5, 1, 5, 1747033198);
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (6, 1, 6, 1747033198);
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (7, 1, 7, 1747033198);
|
||||
INSERT INTO `nl_role_menu_relations` VALUES (8, 1, 8, 1747033198);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -23,7 +23,10 @@ UtilsService::class::getInstance()->autoRouteRegister([
|
||||
|
||||
Route::group([], function () {
|
||||
UtilsService::class::getInstance()->autoRouteRegister([
|
||||
'user' => \App\Http\Controllers\Api\AdminController::class, // 用户控制器
|
||||
'admin' => \App\Http\Controllers\Api\AdminController::class, // 用户控制器
|
||||
'role' => \App\Http\Controllers\Api\RoleController::class, // 角色管理
|
||||
'menu' => \App\Http\Controllers\Api\MenuController::class, // 菜单管理
|
||||
'upload' => \App\Http\Controllers\Api\UploadController::class, // 上传文件
|
||||
// 需要登录的路由生成地址
|
||||
]);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user