Parcourir la source

修改代码结构

qinchaoyue il y a 7 mois
Parent
commit
26cc214518

+ 2 - 11
Hotline.sln

@@ -52,14 +52,10 @@ EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XingTang.Sdk", "src\XingTang.Sdk\XingTang.Sdk.csproj", "{CF2A8B80-FF4E-4291-B383-D735BB629F32}"
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.XingTang", "src\Hotline.XingTang\Hotline.XingTang.csproj", "{9F99C272-5BC2-452C-9D97-BC756AF04669}"
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "XingTang.Sdk", "src\XingTang.Sdk\XingTang.Sdk.csproj", "{CF2A8B80-FF4E-4291-B383-D735BB629F32}"
-EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.Application.Tests", "src\Hotline.Application.Tests\Hotline.Application.Tests.csproj", "{801A8807-F95E-428B-B8C3-3F9244B9E080}"
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.XingTang", "src\Hotline.XingTang\Hotline.XingTang.csproj", "{9F99C272-5BC2-452C-9D97-BC756AF04669}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hotline.Application.Tests", "src\Hotline.Application.Tests\Hotline.Application.Tests.csproj", "{21E8510A-9D78-44B6-AC9C-2A9D4023853D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.Application.Tests", "src\Hotline.Application.Tests\Hotline.Application.Tests.csproj", "{21E8510A-9D78-44B6-AC9C-2A9D4023853D}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hotline.WeChat", "src\Hotline.WeChat\Hotline.WeChat.csproj", "{1A71273C-0ACC-4B70-8405-E443DE278D9F}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Hotline.WeChat", "src\Hotline.WeChat\Hotline.WeChat.csproj", "{1A71273C-0ACC-4B70-8405-E443DE278D9F}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -143,10 +139,6 @@ 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
@@ -185,7 +177,6 @@ Global
 		{9F99C272-5BC2-452C-9D97-BC756AF04669} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
 		{21E8510A-9D78-44B6-AC9C-2A9D4023853D} = {08D63205-1445-430F-A4AB-EF1744E3AC11}
 		{1A71273C-0ACC-4B70-8405-E443DE278D9F} = {D041C554-B78E-4AAF-B597-E309DC8EEF4F}
-		{801A8807-F95E-428B-B8C3-3F9244B9E080} = {08D63205-1445-430F-A4AB-EF1744E3AC11}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {4B8EA790-BD13-4422-8D63-D6DBB77B823F}

+ 11 - 10
src/Hotline.Api/Controllers/SnapshotController.cs → src/Hotline.Api/Controllers/Snapshot/SnapshotBaseController.cs

@@ -5,16 +5,17 @@ using Hotline.Share.Dtos.Snapshot;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 
-namespace Hotline.Api.Controllers
+namespace Hotline.Api.Controllers.Snapshot
 {
     /// <summary>
     /// 快照接口
     /// </summary>
-    public class SnapshotController : BaseController
+    // [NonController]
+    public abstract class SnapshotBaseController : BaseController
     {
         private readonly ISnapshotApplication _snapshotApplication;
 
-        public SnapshotController(ISnapshotApplication snapshotApplication)
+        public SnapshotBaseController(ISnapshotApplication snapshotApplication)
         {
             _snapshotApplication = snapshotApplication;
         }
@@ -26,7 +27,7 @@ namespace Hotline.Api.Controllers
         /// <returns></returns>
         [HttpGet("bulletions")]
         [AllowAnonymous]
-        public async Task<IReadOnlyList<BulletinOutDto>> QueryBulletinsAsync([FromQuery]BulletinInDto dto)
+        public virtual async Task<IReadOnlyList<BulletinOutDto>> QueryBulletinsAsync([FromQuery] BulletinInDto dto)
             => await _snapshotApplication.GetBulletinsAsync(dto);
 
         /// <summary>
@@ -36,7 +37,7 @@ namespace Hotline.Api.Controllers
         /// <returns></returns>
         [HttpGet("bulletions/{id}")]
         [AllowAnonymous]
-        public async Task<BulletinOutDto> QueryBulletionsDetailAsync([FromQuery] string id)
+        public virtual async Task<BulletinOutDto> QueryBulletionsDetailAsync([FromQuery] string id)
             => await _snapshotApplication.GetBulletinsDetailAsync(id);
 
         /// <summary>
@@ -45,7 +46,7 @@ namespace Hotline.Api.Controllers
         /// <returns></returns>
         [AllowAnonymous]
         [HttpGet("user")]
-        public async Task<SnapshotUserInfoOutDto> GetUserInfo()
+        public virtual async Task<SnapshotUserInfoOutDto> GetUserInfo()
             => await _snapshotApplication.GetSnapshotUserInfoAsync();
 
         /// <summary>
@@ -54,7 +55,7 @@ namespace Hotline.Api.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpGet("order")]
-        public async Task<PagedDto<OrderOutDto>> QueryOrderListAsync([FromQuery] OrderInDto dto)
+        public virtual async Task<PagedDto<OrderOutDto>> QueryOrderListAsync([FromQuery] OrderInDto dto)
             => await _snapshotApplication.GetSnapshotOrdersAsync(dto);
 
         /// <summary>
@@ -63,7 +64,7 @@ namespace Hotline.Api.Controllers
         /// <param name="id"></param>
         /// <returns></returns>
         [HttpGet("order/{id}")]
-        public async Task<OrderDetailOutDto> QueryOrderListAsync([FromQuery]string id)
+        public virtual async Task<OrderDetailOutDto> QueryOrderListAsync([FromQuery] string id)
             => await _snapshotApplication.GetSnapshotOrderDetailAsync(id);
 
         /// <summary>
@@ -72,7 +73,7 @@ namespace Hotline.Api.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpGet("redpack")]
-        public async Task<IReadOnlyList<RedPackDateOutDto>> QueryRedPackDateAsync([FromQuery] RedPackDateInDto dto)
+        public virtual async Task<IReadOnlyList<RedPackDateOutDto>> QueryRedPackDateAsync([FromQuery] RedPackDateInDto dto)
             => await _snapshotApplication.GetRedPackDateAsync(dto);
 
         /// <summary>
@@ -81,7 +82,7 @@ namespace Hotline.Api.Controllers
         /// <param name="dto"></param>
         /// <returns></returns>
         [HttpGet("redpack/month")]
-        public async Task<PagedDto<RedPackOutDto>> QueryRedPackDateAsync([FromQuery]RedPacksInDto dto)
+        public virtual async Task<PagedDto<RedPackOutDto>> QueryRedPackDateAsync([FromQuery] RedPacksInDto dto)
             => await _snapshotApplication.GetRedPacksAsync(dto);
     }
 }

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

@@ -0,0 +1,18 @@
+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)
+    {
+    }
+}

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

@@ -29,6 +29,9 @@ using Hotline.Configurations;
 using Hotline.DI;
 using Hotline.Share.Tools;
 using Hotline.Settings.TimeLimitDomain.ExpireTimeSupplier;
+using Hotline.WeChat;
+using Senparc.Weixin.RegisterServices;
+using Senparc.Weixin.AspNet;
 
 
 namespace Hotline.Api;
@@ -189,7 +192,7 @@ internal static class StartupExtensions
         services.AddScoped<IExpireTimeSupplier, WorkDaySupplier>();
         services.AddScoped<IExpireTimeSupplier, HourSupplier>();
 
-        services.AddScoped<IThirdIdentiyService, WeChatService>();
+        services.AddScoped<Users.IThirdIdentiyService, WeChatService>();
 
         services.AddSenparcWeixin(configuration);
 

+ 1 - 1
src/Hotline.Api/config/appsettings.Development.json

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

+ 3 - 4
src/Hotline.Application/Snapshot/SnapshotApplication.cs

@@ -1,5 +1,4 @@
-using Hotline.Article;
-using Hotline.Orders;
+using Hotline.Orders;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Article;
 using Hotline.Share.Dtos.Snapshot;
@@ -25,14 +24,14 @@ public class SnapshotApplication : ISnapshotApplication, IScopeDependency
 {
     private readonly IThirdAccountRepository _thirdAccountRepository;
     private readonly IRepository<Order> _orderRepository;
-    private readonly IRepository<Bulletin> _bulletinRepository;
+    private readonly IRepository<Article.Bulletin> _bulletinRepository;
     private readonly IRepository<Industry> _industryRepository;
     private readonly IThirdIdentiyService _thirdLoginService;
     private readonly ISessionContext _sessionContext;
     private readonly IRepository<RedPackRecord> _redPackRecordRepository;
     private readonly IRepository<OrderSnapshot> _orderSnapshotRepository;
 
-    public SnapshotApplication(IThirdIdentiyService thirdLoginService, IRepository<Industry> industryRepository, IRepository<Bulletin> bulletinRepository, ISessionContext sessionContext, IRepository<RedPackRecord> redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, 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)
     {
         _thirdLoginService = thirdLoginService;
         _industryRepository = industryRepository;