1. 新增:微信小程序端新增微信手机号登录功能(必须为企业认证小程序) 2. 新增:加入动态更新常见问题 3. 新增:新增小程序分享功能 4. 新增:小程序新增第一次登录需要修改密码 5. 新增:新增接口权限控制 6. 新增:用户新增is_staff用来判断是否为工作人员 7. 新增:软删除新增is_delete字段来判断,delete_datetime当前主要来记录时间 8. 更新:部分接口删除功能已更新,需要试用软删除的才会试用软删除 9. 更新:更新系统配置缓存功能 10. 更新:接口认证依赖项更新 11. 更新:获取系统基础配置信息与用户协议与隐私协议更新 12. 优化:优化接口与数据库操作
50 lines
2.2 KiB
Python
50 lines
2.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# @version : 1.0
|
|
# @Creaet Time : 2021/10/24 16:44
|
|
# @File : views.py
|
|
# @IDE : PyCharm
|
|
# @desc : 主要接口文件
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from utils.response import SuccessResponse
|
|
from . import crud, schemas
|
|
from apps.vadmin.auth.utils.current import AllUserAuth
|
|
from apps.vadmin.auth.utils.validation.auth import Auth
|
|
from core.mongo import get_database, DatabaseManage
|
|
from .params import LoginParams, OperationParams, SMSParams
|
|
|
|
app = APIRouter()
|
|
|
|
|
|
###########################################################
|
|
# 日志管理
|
|
###########################################################
|
|
@app.get("/logins/", summary="获取登录日志列表")
|
|
async def get_record_login(p: LoginParams = Depends(), auth: Auth = Depends(AllUserAuth())):
|
|
datas = await crud.LoginRecordDal(auth.db).get_datas(**p.dict())
|
|
count = await crud.LoginRecordDal(auth.db).get_count(**p.to_count())
|
|
return SuccessResponse(datas, count=count)
|
|
|
|
|
|
@app.get("/operations/", summary="获取操作日志列表")
|
|
async def get_record_operation(p: OperationParams = Depends(), db: DatabaseManage = Depends(get_database),
|
|
auth: Auth = Depends(AllUserAuth())):
|
|
count = await db.get_count("operation_record", **p.to_count())
|
|
datas = await db.get_datas("operation_record", v_schema=schemas.OpertionRecordSimpleOut, **p.dict())
|
|
return SuccessResponse(datas, count=count)
|
|
|
|
|
|
@app.get("/sms/send/list/", summary="获取短信发送列表")
|
|
async def get_sms_send_list(p: SMSParams = Depends(), auth: Auth = Depends(AllUserAuth())):
|
|
datas = await crud.SMSSendRecordDal(auth.db).get_datas(**p.dict())
|
|
count = await crud.SMSSendRecordDal(auth.db).get_count(**p.to_count())
|
|
return SuccessResponse(datas, count=count)
|
|
|
|
|
|
###########################################################
|
|
# 日志分析
|
|
###########################################################
|
|
@app.get("/analysis/user/login/distribute/", summary="获取用户登录分布情况列表")
|
|
async def get_user_login_distribute(auth: Auth = Depends(AllUserAuth())):
|
|
return SuccessResponse(await crud.LoginRecordDal(auth.db).get_user_distribute())
|