Browse Source

随手拍

qinchaoyue 5 months ago
parent
commit
4444093a50

+ 11 - 5
Hotline.sln

@@ -57,6 +57,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.Application.Tests",
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.Logger", "src\Hotline.Logger\Hotline.Logger.csproj", "{37784861-ABC0-41F4-87B4-2E08A89A2C42}"
 EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.WeChat", "src\Hotline.WeChat\Hotline.WeChat.csproj", "{75215667-65AF-4B7B-85E7-3140239B30CC}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -139,14 +141,18 @@ Global
 		{9F99C272-5BC2-452C-9D97-BC756AF04669}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{9F99C272-5BC2-452C-9D97-BC756AF04669}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{9F99C272-5BC2-452C-9D97-BC756AF04669}.Release|Any CPU.Build.0 = Release|Any CPU
-		{801A8807-F95E-428B-B8C3-3F9244B9E080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{801A8807-F95E-428B-B8C3-3F9244B9E080}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{801A8807-F95E-428B-B8C3-3F9244B9E080}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{801A8807-F95E-428B-B8C3-3F9244B9E080}.Release|Any CPU.Build.0 = Release|Any CPU
+		{21E8510A-9D78-44B6-AC9C-2A9D4023853D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{21E8510A-9D78-44B6-AC9C-2A9D4023853D}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{21E8510A-9D78-44B6-AC9C-2A9D4023853D}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{21E8510A-9D78-44B6-AC9C-2A9D4023853D}.Release|Any CPU.Build.0 = Release|Any CPU
 		{37784861-ABC0-41F4-87B4-2E08A89A2C42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{37784861-ABC0-41F4-87B4-2E08A89A2C42}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{37784861-ABC0-41F4-87B4-2E08A89A2C42}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{37784861-ABC0-41F4-87B4-2E08A89A2C42}.Release|Any CPU.Build.0 = Release|Any CPU
+		{75215667-65AF-4B7B-85E7-3140239B30CC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{75215667-65AF-4B7B-85E7-3140239B30CC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{75215667-65AF-4B7B-85E7-3140239B30CC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{75215667-65AF-4B7B-85E7-3140239B30CC}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -175,8 +181,8 @@ Global
 		{C3F289D5-C50B-46DB-852C-9543EF9B0355} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 		{CF2A8B80-FF4E-4291-B383-D735BB629F32} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 		{9F99C272-5BC2-452C-9D97-BC756AF04669} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
-		{801A8807-F95E-428B-B8C3-3F9244B9E080} = {08D63205-1445-430F-A4AB-EF1744E3AC11}
 		{37784861-ABC0-41F4-87B4-2E08A89A2C42} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
+		{75215667-65AF-4B7B-85E7-3140239B30CC} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {4B8EA790-BD13-4422-8D63-D6DBB77B823F}

+ 3 - 4
src/Hotline.Api/Controllers/Snapshot/SnapshotBaseController.cs

@@ -8,14 +8,13 @@ using Microsoft.AspNetCore.Mvc;
 namespace Hotline.Api.Controllers.Snapshot
 {
     /// <summary>
-    /// 快照接口
+    /// 随手拍接口
     /// </summary>
-    // [NonController]
-    public abstract class SnapshotBaseController : BaseController
+    public class SnapshotController : BaseController
     {
         private readonly ISnapshotApplication _snapshotApplication;
 
-        public SnapshotBaseController(ISnapshotApplication snapshotApplication)
+        public SnapshotController(ISnapshotApplication snapshotApplication)
         {
             _snapshotApplication = snapshotApplication;
         }

+ 0 - 18
src/Hotline.Api/Controllers/Snapshot/ZiGongSnapshotController.cs

@@ -1,18 +0,0 @@
-using Hotline.Application.Snapshot;
-using Hotline.DI;
-using Hotline.Share.Dtos.Article;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Hotline.Api.Controllers.Snapshot;
-
-/// <summary>
-/// 快照接口
-/// </summary>
-[Route("/api/v1/snapshot")]
-[Injection(AppScopes = EAppScope.ZiGong)]
-public class ZiGongSnapshotController : SnapshotBaseController
-{
-    public ZiGongSnapshotController(ISnapshotApplication snapshotApplication) : base(snapshotApplication)
-    {
-    }
-}

+ 1 - 0
src/Hotline.Api/Hotline.Api.csproj

@@ -27,6 +27,7 @@
   <ItemGroup>
     <ProjectReference Include="..\Hotline.Application\Hotline.Application.csproj" />
     <ProjectReference Include="..\Hotline.Logger\Hotline.Logger.csproj" />
+    <ProjectReference Include="..\Hotline.WeChat\Hotline.WeChat.csproj" />
   </ItemGroup>
 
   <ItemGroup>

+ 1 - 1
src/Hotline.Api/StartupExtensions.cs

@@ -37,9 +37,9 @@ using Hotline.XingTang;
 using Hotline.Logger;
 using HotPot.Mvc.Filters;
 using Microsoft.AspNetCore.ResponseCompression;
-using Hotline.WeChat;
 using Senparc.Weixin.RegisterServices;
 using Senparc.Weixin.AspNet;
+using Hotline.WeChat;
 
 
 namespace Hotline.Api;

+ 1 - 1
src/Hotline.Application.Tests/Controller/DefaultHttpContextAccessor.cs

@@ -31,7 +31,7 @@ public class DefaultHttpContextAccessor : ISessionContext, IScopeDependency
     public HttpContext? HttpContext { get => GetContext(); set => _content = value; }
 
 
-    public string? OpenId { get { return TestSessionConstants.OpenId; } set { } }
+    public string? OpenId { get; init; }
 
     /// <summary>
     /// Id of current tenant or null for host

+ 1 - 1
src/Hotline.Application.Tests/Startup.cs

@@ -112,7 +112,7 @@ public class Startup
             services.AddSqlSugar(configuration);
 
             // application services
-            services.AddScoped<ISnapshotApplication, SnapshotApplication>();
+            services.AddScoped<ISnapshotApplication, SnapshotApplicationBase>();
 
             //mq
             services.AddTestMq(configuration);

+ 1 - 1
src/Hotline.Application.Tests/appsettings.Development.json

@@ -110,7 +110,7 @@
         }
     },
     "DatabaseConfiguration": {
-        "ApplyDbMigrations": false,
+        "ApplyDbMigrations": true,
         "ApplySeed": false
     },
     "MqConfiguration": {

+ 23 - 0
src/Hotline.Application/Snapshot/DefaultSnapshotApplication.cs

@@ -0,0 +1,23 @@
+using Hotline.DI;
+using Hotline.Orders;
+using Hotline.Snapshot;
+using Hotline.Users;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Authentications;
+using XF.Domain.Dependency;
+using XF.Domain.Repository;
+
+namespace Hotline.Application.Snapshot;
+
+[Injection(AppScopes = EAppScope.YiBin | EAppScope.LuZhou)]
+public class DefaultSnapshotApplication : SnapshotApplicationBase
+    , ISnapshotApplication, IScopeDependency
+{
+    public DefaultSnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository) : base(thirdLoginService, industryRepository, bulletinRepository, sessionContext, redPackRecordRepository, orderRepository, thirdAccountRepository, orderSnapshotRepository)
+    {
+    }
+}

+ 2 - 2
src/Hotline.Application/Snapshot/SnapshotApplication.cs → src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -20,7 +20,7 @@ namespace Hotline.Application.Snapshot;
 /// <summary>
 /// 随手拍应用层
 /// </summary>
-public class SnapshotApplication : ISnapshotApplication, IScopeDependency
+public abstract class SnapshotApplicationBase
 {
     private readonly IThirdAccountRepository _thirdAccountRepository;
     private readonly IRepository<Order> _orderRepository;
@@ -31,7 +31,7 @@ public class SnapshotApplication : ISnapshotApplication, IScopeDependency
     private readonly IRepository<RedPackRecord> _redPackRecordRepository;
     private readonly IRepository<OrderSnapshot> _orderSnapshotRepository;
 
-    public SnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository)
+    public SnapshotApplicationBase(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository)
     {
         _thirdLoginService = thirdLoginService;
         _industryRepository = industryRepository;

+ 22 - 0
src/Hotline.Application/Snapshot/ZiGongSnapshotApplication.cs

@@ -0,0 +1,22 @@
+using Hotline.DI;
+using Hotline.Orders;
+using Hotline.Snapshot;
+using Hotline.Users;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Authentications;
+using XF.Domain.Dependency;
+using XF.Domain.Repository;
+
+namespace Hotline.Application.Snapshot;
+
+[Injection(AppScopes = EAppScope.ZiGong)]
+public class ZiGongSnapshotApplication : SnapshotApplicationBase, ISnapshotApplication, IScopeDependency
+{
+    public ZiGongSnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Article.Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IRepository<OrderSnapshot> orderSnapshotRepository) : base(thirdLoginService, industryRepository, bulletinRepository, sessionContext, redPackRecordRepository, orderRepository, thirdAccountRepository, orderSnapshotRepository)
+    {
+    }
+}

+ 1 - 1
src/Hotline.WeChat/Hotline.WeChat.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>net7.0</TargetFramework>
+    <TargetFramework>net8.0</TargetFramework>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
   </PropertyGroup>

+ 6 - 0
src/Hotline/Authentications/FakeSessionContext.cs

@@ -44,5 +44,11 @@ namespace Hotline.Authentications
         /// 工号
         /// </summary>
         public string? StaffNo { get; init; }
+
+        /// <summary>
+        /// 第三方平台用户唯一标识
+        /// 例如: 微信的OpenId
+        /// </summary>
+        public string? OpenId { get; init; }
     }
 }

+ 1 - 1
src/Hotline/Authentications/Police110SessionContext.cs

@@ -55,7 +55,7 @@ namespace Hotline.Authentications
         /// <summary>
         /// 工号
         /// </summary>
-        public string? StaffNo { get; }
+        public string? StaffNo { get; init; }
 
         /// <summary>
         /// 第三方平台用户唯一标识