😎1、调整sql语句打印范围 2、增加mdEditor组件 4、修改密码后强制重新登录 5、升级依赖

This commit is contained in:
zuohuaijun 2024-12-17 11:52:40 +08:00
parent b144402e35
commit 687b7e9c38
5 changed files with 104 additions and 36 deletions

View File

@ -46,7 +46,7 @@
<PackageReference Include="SSH.NET" Version="2024.2.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.5.1" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1142" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1143" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>

View File

@ -158,27 +158,28 @@ public static class SqlSugarSetup
Console.ForegroundColor = originColor;
App.PrintToMiniProfiler("SqlSugar", "Info", log);
};
db.Aop.OnLogExecuted = (sql, pars) =>
{
//// 若参数值超过100个字符则进行截取
//foreach (var par in pars)
//{
// if (par.DbType != System.Data.DbType.String || par.Value == null) continue;
// if (par.Value.ToString().Length > 100)
// par.Value = string.Concat(par.Value.ToString()[..100], "......");
//}
// 执行时间超过5秒时
if (db.Ado.SqlExecutionTime.TotalSeconds <= 5) return;
var fileName = db.Ado.SqlStackTrace.FirstFileName; // 文件名
var fileLine = db.Ado.SqlStackTrace.FirstLine; // 行号
var firstMethodName = db.Ado.SqlStackTrace.FirstMethodName; // 方法名
var log = $"【{DateTime.Now}——超时SQL】\r\n【所在文件名】{fileName}\r\n【代码行数】{fileLine}\r\n【方法名】{firstMethodName}\r\n" + $"【SQL语句】{UtilMethods.GetNativeSql(sql, pars)}";
Log.Warning(log);
App.PrintToMiniProfiler("SqlSugar", "Slow", log);
};
}
db.Aop.OnLogExecuted = (sql, pars) =>
{
//// 若参数值超过100个字符则进行截取
//foreach (var par in pars)
//{
// if (par.DbType != System.Data.DbType.String || par.Value == null) continue;
// if (par.Value.ToString().Length > 100)
// par.Value = string.Concat(par.Value.ToString()[..100], "......");
//}
// 执行时间超过5秒时
if (db.Ado.SqlExecutionTime.TotalSeconds <= 5) return;
var fileName = db.Ado.SqlStackTrace.FirstFileName; // 文件名
var fileLine = db.Ado.SqlStackTrace.FirstLine; // 行号
var firstMethodName = db.Ado.SqlStackTrace.FirstMethodName; // 方法名
var log = $"【{DateTime.Now}——超时SQL】\r\n【所在文件名】{fileName}\r\n【代码行数】{fileLine}\r\n【方法名】{firstMethodName}\r\n" + $"【SQL语句】{UtilMethods.GetNativeSql(sql, pars)}";
Log.Warning(log);
App.PrintToMiniProfiler("SqlSugar", "Slow", log);
};
// 数据审计
db.Aop.DataExecuting = (oldValue, entityInfo) =>
{

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
"lastBuildTime": "2024.12.16",
"lastBuildTime": "2024.12.17",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@ -45,7 +45,7 @@
"jsplumb": "^2.15.6",
"jwchat": "^2.0.3",
"lodash-es": "^4.17.21",
"md-editor-v3": "^5.1.0",
"md-editor-v3": "^5.1.1",
"mitt": "^3.0.1",
"monaco-editor": "^0.52.2",
"mqtt": "^5.10.3",
@ -74,7 +74,7 @@
"vue-router": "^4.5.0",
"vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.3.34",
"vxe-pc-ui": "^4.3.35",
"vxe-table": "^4.8.10",
"vxe-table-plugin-element": "^4.0.4",
"vxe-table-plugin-export-xlsx": "^4.0.7",
@ -88,8 +88,8 @@
"@types/node": "^20.17.10",
"@types/nprogress": "^0.2.3",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.18.0",
"@typescript-eslint/parser": "^8.18.0",
"@typescript-eslint/eslint-plugin": "^8.18.1",
"@typescript-eslint/parser": "^8.18.1",
"@vitejs/plugin-vue": "^5.2.1",
"@vitejs/plugin-vue-jsx": "^4.1.1",
"@vue/compiler-sfc": "^3.5.13",

View File

@ -0,0 +1,73 @@
<template>
<div class="editor-container">
<MdEditor v-model="state.editorVal" @onUploadImg="onUploadImg" />
</div>
</template>
<script setup lang="ts" name="wngEditor">
import { reactive, watch } from 'vue';
import { MdEditor } from 'md-editor-v3';
import { ElMessage } from 'element-plus';
import { getAPI } from '/@/utils/axios-utils';
import { SysFileApi } from '/@/api-services/api';
//
const props = defineProps({
// editor.getHtml()
getHtml: String,
});
const state = reactive({
editorVal: '',
});
//
const baseUrl = reactive(window.__env__.VITE_API_URL) + '/';
//
watch(
() => props.getHtml,
(val: any) => {
state.editorVal = val;
},
{
immediate: true,
}
);
const onUploadImg = async (files: any[], callback: (arg0: any[]) => void) => {
const res = await Promise.all(
files.map((file: any) => {
return new Promise((rev) => {
getAPI(SysFileApi)
.apiSysFileUploadFilesPostForm([file])
.then((res) => {
if (res.data.type == 'success' && res.data.result != null) {
console.log(baseUrl + res.data.result[0].url);
rev(baseUrl + res.data.result[0].url);
} else {
ElMessage.error('上传失败!');
}
})
.catch(() => {
ElMessage.error('上传失败!');
});
});
})
);
callback(res.map((item) => item));
};
</script>
<style lang="scss" scoped>
.editor-container {
::v-deep(.md-editor-icon) {
width: 22px !important;
height: 22px !important;
}
::v-deep(.md-editor-toolbar-wrapper .md-editor-toolbar-item) {
padding: 0;
margin: 0 1px;
}
}
</style>

View File

@ -42,7 +42,7 @@
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { ElMessageBox } from 'element-plus';
import { ElMessage } from 'element-plus';
import { sm2 } from 'sm-crypto-v2';
import { clearAccessTokens, getAPI } from '/@/utils/axios-utils';
@ -79,15 +79,9 @@ const submit = () => {
cpwd.passwordNew = sm2.doEncrypt(state.ruleForm.passwordNew, publicKey, 1);
await getAPI(SysUserApi).apiSysUserChangePwdPost(cpwd);
// 退
ElMessageBox.confirm('密码已修改,是否重新登录系统?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}).then(async () => {
state.isShowDialog = false;
clearAccessTokens();
});
ElMessage.success('密码已修改,请重新登录系统!');
state.isShowDialog = false;
clearAccessTokens();
});
};