Merge branch 'v2' into v2

This commit is contained in:
瞄你个汪 2025-05-14 23:37:27 +08:00
commit f80b102180
10 changed files with 205 additions and 85 deletions

View File

@ -22,15 +22,15 @@
<ItemGroup>
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="4.0.0" />
<PackageReference Include="AlipaySDKNet.Standard" Version="4.9.511" />
<PackageReference Include="AlipaySDKNet.Standard" Version="4.9.554" />
<PackageReference Include="AngleSharp" Version="1.3.0" />
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.5.1" Aliases="BouncyCastleV2" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.0.1" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.60" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.60" />
<PackageReference Include="Furion.Pure" Version="4.9.7.60" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="9.0.3" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.7.61" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.7.61" />
<PackageReference Include="Furion.Pure" Version="4.9.7.61" />
<PackageReference Include="Hardware.Info" Version="101.0.1" />
<PackageReference Include="Hashids.net" Version="1.7.0" />
<PackageReference Include="IPTools.China" Version="1.6.0" />
@ -52,11 +52,11 @@
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.1.5" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.9.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.12.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.192" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.193" />
<PackageReference Include="SSH.NET" Version="2025.0.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.2" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.3" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1233" />
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1236" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>

View File

@ -0,0 +1,31 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
namespace Admin.NET.Core;
/// <summary>
/// 微信AccessToken有效性检查作业任务
/// </summary>
[JobDetail("job_WechatAccessTokenCheckJob", Description = "微信AccessToken有效性检查", GroupName = "default", Concurrent = false)]
[PeriodSeconds(60, TriggerId = "trigger_WechatAccessTokenCheckJob", Description = "微信AccessToken有效性检查", RunOnStart = true)]
public class WechatAccessTokenCheckJob : IJob
{
private readonly IServiceScopeFactory _scopeFactory;
public WechatAccessTokenCheckJob(IServiceScopeFactory scopeFactory)
{
_scopeFactory = scopeFactory;
}
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
{
using var serviceScope = _scopeFactory.CreateScope();
var wechatApiClientFactory = serviceScope.ServiceProvider.GetService<WechatApiClientFactory>();
await wechatApiClientFactory.CheckWechatAccessTokenAsync();
await wechatApiClientFactory.CheckWxOpenAccessTokenAsync();
}
}

View File

@ -119,15 +119,8 @@ public class SysWechatService : IDynamicApiController, ITransient
[DisplayName("获取配置签名参数(wx.config)")]
public async Task<dynamic> GenConfigPara(SignatureInput input)
{
var resCgibinToken = await _wechatApiClient.ExecuteCgibinTokenAsync(new CgibinTokenRequest());
var request = new CgibinTicketGetTicketRequest()
{
AccessToken = resCgibinToken.AccessToken
};
var response = await _wechatApiClient.ExecuteCgibinTicketGetTicketAsync(request);
if (!response.IsSuccessful())
throw Oops.Oh(response.ErrorMessage);
return _wechatApiClient.GenerateParametersForJSSDKConfig(response.Ticket, input.Url);
string ticket = await _wechatApiClientFactory.TryGetWechatJsApiTicketAsync();
return _wechatApiClient.GenerateParametersForJSSDKConfig(ticket, input.Url);
}
/// <summary>

View File

@ -15,11 +15,13 @@ public partial class WechatApiClientFactory : ISingleton
{
private readonly IHttpClientFactory _httpClientFactory;
public readonly WechatOptions _wechatOptions;
private readonly SysCacheService _sysCacheService;
public WechatApiClientFactory(IHttpClientFactory httpClientFactory, IOptions<WechatOptions> wechatOptions)
public WechatApiClientFactory(IHttpClientFactory httpClientFactory, IOptions<WechatOptions> wechatOptions, SysCacheService sysCacheService)
{
_httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
_wechatOptions = wechatOptions.Value ?? throw new ArgumentNullException(nameof(wechatOptions));
_sysCacheService = sysCacheService;
}
/// <summary>
@ -45,8 +47,8 @@ public partial class WechatApiClientFactory : ISingleton
{
JsonSerializerSettings jsonSerializerSettings = NewtonsoftJsonSerializer.GetDefaultSerializerSettings();
jsonSerializerSettings.Formatting = Formatting.Indented;
config.JsonSerializer = new NewtonsoftJsonSerializer(jsonSerializerSettings); // 指定 Newtonsoft.Json JSON序列化
// config.JsonSerializer = new SystemTextJsonSerializer(jsonSerializerSettings); // 指定 System.Text.Json JSON序列化
config.JsonSerializer = new NewtonsoftJsonSerializer(jsonSerializerSettings); // 指定 System.Text.Json JSON序列化
// config.JsonSerializer = new SystemTextJsonSerializer(jsonSerializerOptions); // 指定 Newtonsoft.Json JSON序列化
});
return client;
@ -75,10 +77,132 @@ public partial class WechatApiClientFactory : ISingleton
{
JsonSerializerSettings jsonSerializerSettings = NewtonsoftJsonSerializer.GetDefaultSerializerSettings();
jsonSerializerSettings.Formatting = Formatting.Indented;
config.JsonSerializer = new NewtonsoftJsonSerializer(jsonSerializerSettings); // 指定 Newtonsoft.Json JSON序列化
// config.JsonSerializer = new SystemTextJsonSerializer(jsonSerializerSettings); // 指定 System.Text.Json JSON序列化
config.JsonSerializer = new NewtonsoftJsonSerializer(jsonSerializerSettings); // 指定 System.Text.Json JSON序列化
// config.JsonSerializer = new SystemTextJsonSerializer(jsonSerializerOptions); // 指定 Newtonsoft.Json JSON序列化
});
return client;
}
/// <summary>
/// 获取微信公众号AccessToken
/// </summary>
/// <returns></returns>
public async Task<string> TryGetWechatAccessTokenAsync()
{
if (!_sysCacheService.ExistKey($"WxAccessToken_{_wechatOptions.WechatAppId}") || string.IsNullOrEmpty(_sysCacheService.Get<string>($"WxAccessToken_{_wechatOptions.WechatAppId}")))
{
var client = CreateWechatClient();
var reqCgibinToken = new CgibinTokenRequest();
var resCgibinToken = await client.ExecuteCgibinTokenAsync(reqCgibinToken);
if (resCgibinToken.ErrorCode != (int)WechatReturnCodeEnum.)
throw Oops.Oh(resCgibinToken.ErrorMessage + " " + resCgibinToken.ErrorCode);
_sysCacheService.Set($"WxAccessToken_{_wechatOptions.WechatAppId}", resCgibinToken.AccessToken, TimeSpan.FromSeconds(resCgibinToken.ExpiresIn - 60));
}
return _sysCacheService.Get<string>($"WxAccessToken_{_wechatOptions.WechatAppId}");
}
/// <summary>
/// 获取微信小程序AccessToken
/// </summary>
/// <returns></returns>
public async Task<string> TryGetWxOpenAccessTokenAsync()
{
if (!_sysCacheService.ExistKey($"WxAccessToken_{_wechatOptions.WxOpenAppId}") || string.IsNullOrEmpty(_sysCacheService.Get<string>($"WxAccessToken_{_wechatOptions.WxOpenAppId}")))
{
var client = CreateWxOpenClient();
var reqCgibinToken = new CgibinTokenRequest();
var resCgibinToken = await client.ExecuteCgibinTokenAsync(reqCgibinToken);
if (resCgibinToken.ErrorCode != (int)WechatReturnCodeEnum.)
throw Oops.Oh(resCgibinToken.ErrorMessage + " " + resCgibinToken.ErrorCode);
_sysCacheService.Set($"WxAccessToken_{_wechatOptions.WxOpenAppId}", resCgibinToken.AccessToken, TimeSpan.FromSeconds(resCgibinToken.ExpiresIn - 60));
}
return _sysCacheService.Get<string>($"WxAccessToken_{_wechatOptions.WxOpenAppId}");
}
/// <summary>
/// 检查微信公众号AccessToken
/// </summary>
/// <returns></returns>
public async Task CheckWechatAccessTokenAsync()
{
if (string.IsNullOrEmpty(_wechatOptions.WechatAppId) || string.IsNullOrEmpty(_wechatOptions.WechatAppSecret)) return;
var req = new CgibinOpenApiQuotaGetRequest
{
AccessToken = await TryGetWxOpenAccessTokenAsync(),
CgiPath = "/cgi-bin/token"
};
var client = CreateWechatClient();
var res = await client.ExecuteCgibinOpenApiQuotaGetAsync(req);
var originColor = Console.ForegroundColor;
if (res.ErrorCode != (int)WechatReturnCodeEnum.)
{
_sysCacheService.Remove($"WxAccessToken_{_wechatOptions.WechatAppId}");
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("【" + DateTime.Now + "】" + _wechatOptions.WxOpenAppId + " 微信公众号令牌 无效");
}
else
{
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("【" + DateTime.Now + "】" + _wechatOptions.WxOpenAppId + " 微信公众号令牌 有效");
}
Console.ForegroundColor = originColor;
}
/// <summary>
/// 检查微信小程序AccessToken
/// </summary>
/// <returns></returns>
public async Task CheckWxOpenAccessTokenAsync()
{
if (string.IsNullOrEmpty(_wechatOptions.WxOpenAppId) || string.IsNullOrEmpty(_wechatOptions.WxOpenAppSecret)) return;
var req = new CgibinOpenApiQuotaGetRequest
{
AccessToken = await TryGetWxOpenAccessTokenAsync(),
CgiPath = "/cgi-bin/token"
};
var client = CreateWxOpenClient();
var res = await client.ExecuteCgibinOpenApiQuotaGetAsync(req);
var originColor = Console.ForegroundColor;
if (res.ErrorCode != (int)WechatReturnCodeEnum.)
{
_sysCacheService.Remove($"WxAccessToken_{_wechatOptions.WxOpenAppId}");
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("【" + DateTime.Now + "】" + _wechatOptions.WxOpenAppId + " 微信小程序令牌 无效");
}
else
{
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("【" + DateTime.Now + "】" + _wechatOptions.WxOpenAppId + " 微信小程序令牌 有效");
}
Console.ForegroundColor = originColor;
}
/// <summary>
/// 获取微信JS接口临时票据jsapi_ticket
/// </summary>
/// <returns></returns>
public async Task<string> TryGetWechatJsApiTicketAsync()
{
if (!_sysCacheService.ExistKey($"WxJsApiTicket_{_wechatOptions.WechatAppId}") || string.IsNullOrEmpty(_sysCacheService.Get<string>($"WxJsApiTicket_{_wechatOptions.WechatAppId}")))
{
var accessToken = await TryGetWechatAccessTokenAsync();
var client = CreateWechatClient();
var request = new CgibinTicketGetTicketRequest()
{
AccessToken = accessToken
};
var response = await client.ExecuteCgibinTicketGetTicketAsync(request);
if (!response.IsSuccessful())
throw Oops.Oh(response.ErrorMessage + " " + response.ErrorCode);
_sysCacheService.Set($"WxJsApiTicket_{_wechatOptions.WechatAppId}", response.Ticket, TimeSpan.FromSeconds(response.ExpiresIn - 60));
}
return _sysCacheService.Get<string>($"WxJsApiTicket_{_wechatOptions.WechatAppId}");
}
}

View File

@ -14,6 +14,7 @@ public class Search
/// <summary>
/// 字段名称集合
/// </summary>
/// <example>&quot;[]&quot;</example>
public List<string> Fields { get; set; }
/// <summary>
@ -35,6 +36,7 @@ public class Filter
/// <summary>
/// 筛选过滤条件子项
/// </summary>
/// <example>&quot;[]&quot;</example>
public IEnumerable<Filter>? Filters { get; set; }
/// <summary>
@ -71,5 +73,6 @@ public abstract class BaseFilter
/// <summary>
/// 筛选过滤条件
/// </summary>
/// <example>[]</example>
public Filter? Filter { get; set; }
}

View File

@ -26,7 +26,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.13.0" />
<PackageReference Include="Rezero.Api" Version="1.8.12" />
<PackageReference Include="Rezero.Api" Version="1.8.14" />
</ItemGroup>
<ItemGroup>

View File

@ -10,7 +10,7 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1,maximum-scale=1,user-scalable=0">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes" media="(min-width: 769px)">
<link rel="icon" href="./favicon.ico" />
<title>GoView</title>
<title>Admin.NET</title>
<link rel="stylesheet" href="./index.css" />
</head>
<body>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -18,11 +18,7 @@
<layout-header></layout-header>
<div class="go-login">
<div class="go-login-carousel">
<n-carousel
autoplay
dot-type="line"
:interval="Number(carouselInterval)"
>
<n-carousel autoplay dot-type="line" :interval="Number(carouselInterval)">
<img
v-for="(item, i) in carouselImgList"
:key="i"
@ -37,24 +33,14 @@
<n-collapse-transition :appear="true" :show="show">
<n-card class="login-account-card" :title="$t('login.desc')">
<div class="login-account-top">
<img
class="login-account-top-logo"
src="~@/assets/images/login/input.png"
alt="展示图片"
/>
<img class="login-account-top-logo" src="~@/assets/images/login/input.png" alt="展示图片" />
</div>
<n-form
ref="formRef"
label-placement="left"
size="large"
:model="formInline"
:rules="rules"
>
<n-form ref="formRef" label-placement="left" size="large" :model="formInline" :rules="rules">
<n-form-item path="username">
<n-input
v-model:value="formInline.username"
type="text"
maxlength="16"
maxlength="30"
:placeholder="$t('global.form_account')"
@keydown.enter="handleSubmit"
>
@ -69,7 +55,7 @@
<n-input
v-model:value="formInline.password"
type="password"
maxlength="16"
maxlength="30"
show-password-on="click"
:placeholder="$t('global.form_password')"
@keydown.enter="handleSubmit"
@ -84,21 +70,14 @@
<n-form-item>
<div class="flex justify-between">
<div class="flex-initial">
<n-checkbox v-model:checked="autoLogin">{{
$t('login.form_auto')
}}</n-checkbox>
<n-checkbox v-model:checked="autoLogin">{{ $t('login.form_auto') }}</n-checkbox>
</div>
</div>
</n-form-item>
<n-form-item>
<n-button
type="primary"
@click="handleSubmit"
size="large"
:loading="loading"
block
>{{ $t('login.form_button') }}</n-button
>
<n-button type="primary" @click="handleSubmit" size="large" :loading="loading" block>{{
$t('login.form_button')
}}</n-button>
</n-form-item>
</n-form>
</n-card>
@ -141,21 +120,21 @@ const systemStore = useSystemStore()
const t = window['$t']
const formInline = reactive({
username: 'admin',
password: '123456',
username: 'superadmin',
password: 'Admin.NET++010101'
})
const rules = {
username: {
required: true,
message: t('global.form_account'),
trigger: 'blur',
trigger: 'blur'
},
password: {
required: true,
message: t('global.form_password'),
trigger: 'blur',
},
trigger: 'blur'
}
}
//
@ -165,17 +144,7 @@ const shuffleTimiing = ref()
const carouselImgList = ['one', 'two', 'three']
//
const bgList = ref([
'bar_y',
'bar_x',
'line_gradient',
'line',
'funnel',
'heatmap',
'map',
'pie',
'radar',
])
const bgList = ref(['bar_y', 'bar_x', 'line_gradient', 'line', 'funnel', 'heatmap', 'map', 'pie', 'radar'])
// url
const getImageUrl = (name: string, folder: string) => {
@ -201,11 +170,11 @@ const handleSubmit = async (e: Event) => {
username,
password
})
if(res && res.data) {
if (res && res.data) {
const { tokenValue, tokenName } = res.data.token
const { nickname, username, id } = res.data.userinfo
// pinia
// pinia
systemStore.setItem(SystemStoreEnum.USER_INFO, {
[SystemStoreUserInfoEnum.USER_TOKEN]: tokenValue,
[SystemStoreUserInfoEnum.TOKEN_NAME]: tokenName,
@ -214,7 +183,7 @@ const handleSubmit = async (e: Event) => {
[SystemStoreUserInfoEnum.NICK_NAME]: nickname,
t
})
window['$message'].success(t('login.login_success'))
routerTurnByName(PageEnum.BASE_HOME_NAME, true)
}

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro",
"type": "module",
"version": "2.4.33",
"lastBuildTime": "2025.05.08",
"lastBuildTime": "2025.05.12",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun",
"license": "MIT",
@ -26,8 +26,8 @@
"@vue-office/excel": "^1.7.14",
"@vue-office/pdf": "^2.0.9",
"@vueuse/core": "^13.1.0",
"@vxe-ui/plugin-export-xlsx": "^4.2.0",
"@vxe-ui/plugin-render-element": "^4.0.10",
"@vxe-ui/plugin-export-xlsx": "^4.2.1",
"@vxe-ui/plugin-render-element": "^4.0.11",
"@wangeditor/editor": "^5.1.23",
"@wangeditor/editor-for-vue": "^5.1.12",
"animate.css": "^4.1.1",
@ -39,7 +39,7 @@
"echarts": "^5.6.0",
"echarts-gl": "^2.0.9",
"echarts-wordcloud": "^2.1.0",
"element-plus": "^2.9.9",
"element-plus": "^2.9.10",
"exceljs": "^4.4.0",
"ezuikit-js": "^8.1.9-beta.3",
"gcoord": "^1.0.7",
@ -50,10 +50,10 @@
"jsplumb": "^2.15.6",
"jwchat": "^2.0.3",
"lodash-es": "^4.17.21",
"md-editor-v3": "^5.5.0",
"md-editor-v3": "^5.5.1",
"mitt": "^3.0.1",
"monaco-editor": "^0.52.2",
"mqtt": "^5.12.0",
"mqtt": "^5.13.0",
"nprogress": "^0.2.0",
"ol": "^10.5.0",
"pinia": "^3.0.2",
@ -80,8 +80,8 @@
"vue-signature-pad": "^3.0.2",
"vue3-flag-icons": "^0.0.3",
"vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.5.36",
"vxe-table": "^4.13.18",
"vxe-pc-ui": "^4.6.4",
"vxe-table": "^4.13.25",
"xe-utils": "^3.7.4",
"xlsx-js-style": "^1.2.0"
},
@ -89,12 +89,12 @@
"@iconify/vue": "^5.0.0",
"@plugin-web-update-notification/vite": "^2.0.0",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.17.43",
"@types/node": "^20.17.46",
"@types/nprogress": "^0.2.3",
"@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@vitejs/plugin-vue": "^5.2.3",
"@vitejs/plugin-vue": "^5.2.4",
"@vitejs/plugin-vue-jsx": "^4.1.2",
"@vue/compiler-sfc": "^3.5.13",
"code-inspector-plugin": "^0.20.10",
@ -102,10 +102,10 @@
"eslint-plugin-vue": "^10.1.0",
"globals": "^16.1.0",
"less": "^4.3.0",
"openapi-ts-request": "^1.3.4",
"openapi-ts-request": "^1.4.0",
"prettier": "^3.5.3",
"rollup-plugin-visualizer": "^5.14.0",
"sass": "^1.87.0",
"sass": "^1.88.0",
"terser": "^5.39.0",
"typescript": "^5.8.3",
"vite": "^6.3.5",