ソースを参照

更新包引用

houweichen 2 ヶ月 前
コミット
84b7a24d56

+ 1 - 1
JiaZhiQuan.Common.sln

@@ -8,7 +8,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JiaZhiQuan.Common", "JiaZhi
 		{19C8076E-8689-4131-A6F6-582C09470420} = {19C8076E-8689-4131-A6F6-582C09470420}
 	EndProjectSection
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wicture.DbRESTFul", "..\..\..\DbRESTFul-V3\src\Wicture.DbRESTFul\Wicture.DbRESTFul.csproj", "{19C8076E-8689-4131-A6F6-582C09470420}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wicture.DbRESTFul", "..\..\DbRESTFul-V3\src\Wicture.DbRESTFul\Wicture.DbRESTFul.csproj", "{19C8076E-8689-4131-A6F6-582C09470420}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution

+ 14 - 4
JiaZhiQuan.Common/JiaZhiQuan.Common.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk.Web">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp3.1</TargetFramework>
+    <TargetFramework>net8.0</TargetFramework>
     <OutputType>Library</OutputType>
   </PropertyGroup>
 
@@ -9,26 +9,36 @@
     <PackageReference Include="aliyun-net-sdk-core" Version="1.5.11" />
     <PackageReference Include="aliyun-net-sdk-vod" Version="2.16.10" />
     <PackageReference Include="Aliyun.OSS.SDK.NetCore" Version="2.13.0" />
+    <PackageReference Include="Autofac" Version="8.2.0" />
     <PackageReference Include="Confluent.Kafka" Version="2.0.2" />
+    <PackageReference Include="CSRedisCore" Version="3.2.0" />
+    <PackageReference Include="Dapper" Version="2.1.66" />
     <PackageReference Include="Elasticsearch.Net" Version="7.17.0" />
     <PackageReference Include="MailKit" Version="3.1.1" />
     <PackageReference Include="Mapster" Version="7.3.0" />
     <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
     <PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
+    <PackageReference Include="MySql.Data" Version="9.2.0" />
     <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
+    <PackageReference Include="NLog" Version="5.4.0" />
     <PackageReference Include="NPOI" Version="2.6.2" />
     <PackageReference Include="Npoi.Mapper" Version="6.1.0" />
-    <PackageReference Include="QRCoder" Version="1.4.3" />
+    <PackageReference Include="QRCoder" Version="1.3.9" />
 	<PackageReference Include="SkiaSharp" Version="2.88.3" />
     <PackageReference Include="Senparc.Weixin.MP" Version="16.17.7" />
     <PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.3" />
     <PackageReference Include="System.Collections" Version="4.3.0" />
 	  <PackageReference Include="System.Drawing.Common" Version="6.0.0" />
+	  <PackageReference Include="ZXing.Net" Version="0.16.10" />
   </ItemGroup>
 
   <ItemGroup>
-    <ProjectReference Include="..\..\..\..\DbRESTFul-V3\src\Wicture.DbRESTFul\Wicture.DbRESTFul.csproj" />
-    <ProjectReference Include="..\..\..\HuiFuBasePaySDk\csharp-sdk-v1.0.13\BasePaySdk\BasePaySdk.csproj" />
+    <Reference Include="BasePaySdk">
+      <HintPath>..\..\sdk\BasePaySdk.dll</HintPath>
+    </Reference>
+    <Reference Include="Wicture.DbRESTFul">
+      <HintPath>..\..\sdk\Wicture.DbRESTFul.dll</HintPath>
+    </Reference>
   </ItemGroup>
 
 

+ 27 - 15
JiaZhiQuan.Common/Repository/RepositoryExtension.GrowTask.cs

@@ -13,13 +13,16 @@ using JiaZhiQuan.Common.Models.PO;
 using NPOI.XWPF.UserModel;
 using CSRedis;
 
-namespace JiaZhiQuan.Common {
-    public static partial class RepositoryExtension {
+namespace JiaZhiQuan.Common
+{
+    public static partial class RepositoryExtension
+    {
         /// <summary>
         /// 首次完善资料至100%
         /// </summary>
         /// <returns></returns>
-        private static async Task CompleteSelfDataTask(DbRESTFulRepository repository, long userId, DateTime completeTime) {
+        private static async Task CompleteSelfDataTask(DbRESTFulRepository repository, long userId, DateTime completeTime)
+        {
             //插入并更新
             OnceTaskLog onceTaskLog = new OnceTaskLog() { userId = userId, completeSelfDataTime = completeTime, now = DateTime.Now };
             await repository.QuerySingleOrDefaultAsync<dynamic>(@$" insert into n_user_grow_once_task_log 
@@ -30,7 +33,8 @@ namespace JiaZhiQuan.Common {
         /// 首次完成实名认证
         /// </summary>
         /// <returns></returns>
-        private static async Task RealNameAuth(DbRESTFulRepository repository, long userId, DateTime completeTime) {
+        private static async Task RealNameAuth(DbRESTFulRepository repository, long userId, DateTime completeTime)
+        {
             OnceTaskLog onceTaskLog = new OnceTaskLog() { userId = userId, realNameAuthTime = completeTime, now = DateTime.Now };
             await repository.QuerySingleOrDefaultAsync<dynamic>(@$" insert into n_user_grow_once_task_log 
                     (userId,realNameAuthTime,createAt,updateAt) values(@userId,@realNameAuthTime,@now,@now)
@@ -40,7 +44,8 @@ namespace JiaZhiQuan.Common {
         /// 首次通过创作者认证或优质创作者认证
         /// </summary>
         /// <returns></returns>
-        private static async Task AuthorAuth(DbRESTFulRepository repository, long userId, DateTime completeTime) {
+        private static async Task AuthorAuth(DbRESTFulRepository repository, long userId, DateTime completeTime)
+        {
             OnceTaskLog onceTaskLog = new OnceTaskLog() { userId = userId, authorAuthTime = completeTime, now = DateTime.Now };
             await repository.QuerySingleOrDefaultAsync<dynamic>(@$" insert into n_user_grow_once_task_log 
                     (userId,authorAuthTime,createAt,updateAt) values(@userId,@authorAuthTime,@now,@now)
@@ -50,7 +55,8 @@ namespace JiaZhiQuan.Common {
         /// 申请提现一次
         /// </summary>
         /// <returns></returns>
-        private static async Task Withdrawal(DbRESTFulRepository repository, long userId, DateTime completeTime) {
+        private static async Task Withdrawal(DbRESTFulRepository repository, long userId, DateTime completeTime)
+        {
             string objStr = "withdrawalTime";
             //插入并更新,看看这种写法有没有问题。
             OnceTaskLog onceTaskLog = new OnceTaskLog() { userId = userId, withdrawalTime = completeTime, now = DateTime.Now };
@@ -59,13 +65,15 @@ namespace JiaZhiQuan.Common {
                    ON DUPLICATE KEY UPDATE {objStr}= @{objStr} ,updateAt=@now ", onceTaskLog);
         }
 
-        public static async Task<TaskCompleteResult> DoOnceTask(this DbRESTFulRepository repository, long userId, Dictionary<string,object> data,
-            TaskEvent taskEvent, Producer producer, RedisCacheProvider redis) {
-            using var redisLock = redis.Lock($"{userId}_{(int)taskEvent}",1);
+        public static async Task<TaskCompleteResult> DoOnceTask(this DbRESTFulRepository repository, long userId, Dictionary<string, object> data,
+            TaskEvent taskEvent, Producer producer, RedisCacheProvider redis)
+        {
+            using var redisLock = redis.Lock($"{userId}_{(int)taskEvent}", 1);
             if (redisLock == null) return new TaskCompleteResult { isComplete = false };
-            if (await repository.OnceTaskCheckComplete(userId, taskEvent)) {
+            if (await repository.OnceTaskCheckComplete(userId, taskEvent))
+            {
                 //LoggerManager.Logger.Info($"一次性任务{taskEvent}已完成过,请不要重复完成。");
-                return new TaskCompleteResult { isComplete=false};
+                return new TaskCompleteResult { isComplete = false };
             }
             DateTime completeTime = ((DateTime?)data?["completeTime"]) ?? DateTime.Now;
             //加经验
@@ -74,7 +82,8 @@ namespace JiaZhiQuan.Common {
             var res = await UserAddExperience(repository, userId, taskInfo, producer);
             if (!res) return new TaskCompleteResult { isComplete = false };
             //任务完成
-            switch (taskEvent) {
+            switch (taskEvent)
+            {
                 case TaskEvent.CompleteSelfData:
                     await CompleteSelfDataTask(repository, userId, completeTime);
                     break;
@@ -93,11 +102,13 @@ namespace JiaZhiQuan.Common {
         }
 
         public static async Task<bool> OnceTaskCheckComplete(
-            this DbRESTFulRepository repository, long userId, TaskEvent taskEvent) {
+            this DbRESTFulRepository repository, long userId, TaskEvent taskEvent)
+        {
             OnceTaskLog onceTaskLog = await repository.QuerySingleOrDefaultAsync<OnceTaskLog>
                     (@$"select userId,completeSelfDataTime,realNameAuthTime,authorAuthTime,withdrawalTime 
                     from n_user_grow_once_task_log where userId={userId}");
-            return taskEvent switch {
+            return taskEvent switch
+            {
                 TaskEvent.CompleteSelfData => CheckTimeComplete(onceTaskLog?.completeSelfDataTime),
                 TaskEvent.RealNameAuth => CheckTimeComplete(onceTaskLog?.realNameAuthTime),
                 TaskEvent.AuthorAuth => CheckTimeComplete(onceTaskLog?.authorAuthTime),
@@ -108,7 +119,8 @@ namespace JiaZhiQuan.Common {
 
         //公司成立时间
         public static readonly DateTime minTime = DateTime.Parse("2020-01-01");
-        public static bool CheckTimeComplete(DateTime? completeTime) {
+        public static bool CheckTimeComplete(DateTime? completeTime)
+        {
             return completeTime != null && completeTime > minTime;
         }
     }

+ 0 - 1
JiaZhiQuan.Common/Repository/RepositoryExtension.Mock.cs

@@ -1,7 +1,6 @@
 using Elasticsearch.Net;
 using JiaZhiQuan.Common.Config;
 using JiaZhiQuan.Common.ElasticSearch;
-using Microsoft.AspNetCore.JsonPatch.Internal;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Senparc.Weixin.MP.Containers;

+ 2 - 3
JiaZhiQuan.Common/Utils/ImageSuperposeUtils.cs

@@ -1,5 +1,4 @@
-using Enyim.Caching;
-using Microsoft.AspNetCore.Razor.TagHelpers;
+using Microsoft.AspNetCore.Razor.TagHelpers;
 using Newtonsoft.Json;
 using NLog.Fluent;
 using System;
@@ -40,7 +39,7 @@ namespace JiaZhiQuan.Common.Utils
                     {
                         var text = item.Text;
                         // 设置绘制文本的字体、大小和颜色
-                        Font font = new Font(text.FamilyName, text.FontSize);
+                        System.Drawing.Font font = new System.Drawing.Font(text.FamilyName, text.FontSize);
                         Brush brush = new SolidBrush(text.Color);
                         Point position = new Point(item.X, item.Y);
                         // 绘制文本