1. 新增登录日志配置文件控制

2. 登录日志表格筛选框更新
This commit is contained in:
ktianc 2022-11-19 23:08:49 +08:00
parent 5c88776344
commit ecc370f64e
6 changed files with 39 additions and 12 deletions

View File

@ -17,20 +17,20 @@
Kinit 是一套全部开源的快速开发平台,毫无保留给个人及企业免费使用。
- 👭后端采用 Python 语言现代、快速(高性能) [FastAPI](https://fastapi.tiangolo.com/zh/) 异步框架 + [SQLAlchem](https://www.sqlalchemy.org/) 异步操作 [MySQL](https://www.mysql.com/) 数据库。
- 🧑‍🤝‍🧑前端采用 [vue-element-plus-admin](https://gitee.com/kailong110120130/vue-element-plus-admin) 、[Vue3](https://cn.vuejs.org/guide/introduction.html)、[Element Plus](https://element-plus.gitee.io/zh-CN/guide/design.html)、[TypeScript](https://www.tslang.cn/),等主流技术开发。
- 👭后端采用 Python 语言以及现代、快速(高性能) [FastAPI](https://fastapi.tiangolo.com/zh/) 框架。
- 👫权限认证使用[(哈希)密码和 JWT Bearer 令牌的 OAuth2](https://fastapi.tiangolo.com/zh/tutorial/security/oauth2-jwt/),支持多终端认证系统。
- 👬支持加载动态权限菜单,多方式轻松权限控制。
- 👬支持加载动态权限菜单,多方式轻松权限控制,按钮级别权限控制。
- 👬已加入常见的`Redis``MYSQL``MongoDB`数据库异步操作。
- 开箱即用的中后台解决方案,可以用来作为新项目的启动模版,也可用于学习参考。并且时刻关注着最新技术动向,尽可能的第一时间更新。
- 与 [vue-element-plus-admin](https://gitee.com/kailong110120130/vue-element-plus-admin) 前端框架时刻保持同步更新。
## 💏特别鸣谢
[ELADMIN](https://eladmin.vip/demo):项目基于 Spring Boot 2.1.0 、 Jpa、 Spring Security、redis、Vue的前后端分离的后台管理系统。
[django-vue-admin](https://gitee.com/liqianglog/django-vue-admin)基于RBAC模型的权限控制的一整套基础开发平台前后端分离后端采用 django+django-rest-framework前端采用 vue+ElementUI。
## 特别鸣谢
[vue-element-plus-admin](https://gitee.com/kailong110120130/vue-element-plus-admin)一套基于vue3、element-plus、typescript4、vite3的后台集成方案
[django-vue-admin](https://gitee.com/liqianglog/django-vue-admin)基于RBAC模型的权限控制的一整套基础开发平台前后端分离后端采用 django+django-rest-framework前端采用 vue+ElementUI。
[Ant Design Pro](https://preview.pro.ant.design/dashboard/analysis):开箱即用的中台前端/设计解决方案
[Gin-Vue-Admin](https://demo.gin-vue-admin.com)基于vite+vue3+gin搭建的开发基础平台支持TS,JS混用集成jwt鉴权权限管理动态路由显隐可控组件分页封装多点登录拦截资源权限上传下载代码生成器表单生成器等开发必备功能。
@ -47,16 +47,16 @@ Kinit 是一套全部开源的快速开发平台,毫无保留给个人及企
## 在线体验
👩‍👧‍👦演示地址http://kinit.ktianc.top/
演示地址http://kinit.ktianc.top/
- 账号15020221010
- 密码kinit2022
## 源码地址
gitee地址(主推)https://gitee.com/ktianc/kinit 👩‍👦‍👦
gitee地址(主推)https://gitee.com/ktianc/kinit
github地址https://github.com/vvandk/kinit 👩‍👦‍👦
github地址https://github.com/vvandk/kinit
## 内置功能
@ -104,6 +104,8 @@ github地址https://github.com/vvandk/kinit 👩‍👦‍👦
4. 表格工具栏更新,手机端取消文字显示
5. 表格操作按钮多的时候自动叠起
- [x] 已加入常见的`Redis``MYSQL``MongoDB`数据库异步操作。
## TODO
- [ ] 考虑支持多机部署方案,如果接口使用多机,那么用户是否支持统一认证

View File

@ -199,6 +199,11 @@ const handleCommand = (command: string) => {
delDatas(null, true)
}
}
//
const tableSortChange = async (data: any) => {
console.log(data)
}
</script>
<template>
@ -264,6 +269,7 @@ const handleCommand = (command: string) => {
total: tableObject.count
}"
@register="register"
@sort-change="tableSortChange"
>
<template #action="{ row }">
<ElButton

View File

@ -114,6 +114,17 @@ export const searchSchema = reactive<FormSchema[]>([
}
}
},
{
field: 'address',
label: '登陆地点',
component: 'Input',
componentProps: {
clearable: false,
style: {
width: '214px'
}
}
},
{
field: 'status',
label: '登录状态',

View File

@ -98,6 +98,8 @@ EVENTS = [
"""
# 默认密码,"0" 默认为手机号后六位
DEFAULT_PASSWORD = "0"
# 是否开启保存登录日志
LOGIN_LOG_RECORD = True
# 是否开启保存每次请求日志到本地
REQUEST_LOG_RECORD = True
# 是否开启每次操作日志记录到MongoDB数据库

View File

@ -6,6 +6,8 @@
# @IDE : PyCharm
# @desc : 登录记录模型
import json
from application.settings import LOGIN_LOG_RECORD
from utils.ip_manage import IPManage
from sqlalchemy.ext.asyncio import AsyncSession
from db.db_base import BaseModel
@ -35,11 +37,13 @@ class VadminLoginRecord(BaseModel):
request = Column(TEXT, comment="请求信息")
@classmethod
async def create_login_record(cls, db: AsyncSession, telephone: str, status: bool, req: Request, resp: dict):
async def create_login_record(cls, db: AsyncSession, telephone: str, status: bool, req: Request, resp: dict) -> None:
"""
创建登录记录
@return:
"""
if not LOGIN_LOG_RECORD:
return None
header = {}
for k, v in req.headers.items():
header[k] = v

View File

@ -17,9 +17,11 @@ class LoginParams(Paging):
"""
列表分页
"""
def __init__(self, ip: str = None, telephone: str = None, status: bool = None, page: int = 1, limit: int = 10):
def __init__(self, ip: str = None, address: str = None, telephone: str = None, status: bool = None, page: int = 1,
limit: int = 10):
super(LoginParams, self).__init__(page, limit)
self.ip = ("like", ip)
self.telephone = ("like", telephone)
self.address = ("like", address)
self.status = status
self.order = "desc"