diff --git a/Yi.Abp.Net8/Yi.Abp.sln b/Yi.Abp.Net8/Yi.Abp.sln index d4e242fa..22d4ac71 100644 --- a/Yi.Abp.Net8/Yi.Abp.sln +++ b/Yi.Abp.Net8/Yi.Abp.sln @@ -64,18 +64,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.Domain.Sh EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.SqlSugarCore", "module\rbac\Yi.Framework.Rbac.SqlSugarCore\Yi.Framework.Rbac.SqlSugarCore.csproj", "{4503A2F9-139D-4CBC-AF11-689C34F0D77B}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "bbs", "bbs", "{E902A945-4F41-4E96-A0DA-9F66CDA22261}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Bbs.Domain.Shared", "module\bbs\Yi.Framework.Bbs.Domain.Shared\Yi.Framework.Bbs.Domain.Shared.csproj", "{EB9349E2-256D-41EB-A345-21635A1361B3}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Bbs.Domain", "module\bbs\Yi.Framework.Bbs.Domain\Yi.Framework.Bbs.Domain.csproj", "{4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Bbs.Application.Contracts", "module\bbs\Yi.Framework.Bbs.Application.Contracts\Yi.Framework.Bbs.Application.Contracts.csproj", "{7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Bbs.Application", "module\bbs\Yi.Framework.Bbs.Application\Yi.Framework.Bbs.Application.csproj", "{AD4EE9E6-F4A3-4139-AF05-71388167DE5B}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Bbs.SqlSugarCore", "module\bbs\Yi.Framework.Bbs.SqlSugarCore\Yi.Framework.Bbs.SqlSugarCore.csproj", "{6C86BA71-9F87-4E2C-B467-2950D77DCDFA}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "audit-logging", "audit-logging", "{73CCF2C4-B9FD-44AB-8D4B-0A421805B094}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.AuditLogging.SqlSugarCore", "module\audit-logging\Yi.Framework.AuditLogging.SqlSugarCore\Yi.Framework.AuditLogging.SqlSugarCore.csproj", "{48806510-8E18-4E1E-9BAF-5B97E88C5FC3}" @@ -98,20 +86,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.TenantManageme EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.TenantManagement.Application.Contracts", "module\tenant-management\Yi.Framework.TenantManagement.Application.Contracts\Yi.Framework.TenantManagement.Application.Contracts.csproj", "{FA735055-CBDD-4EFD-B84B-85810DA1425E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "code-gen", "code-gen", "{4FFE7212-21F2-476D-B628-3C65E6C5075E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.CodeGen.Application", "module\code-gen\Yi.Framework.CodeGen.Application\Yi.Framework.CodeGen.Application.csproj", "{97EC40D7-DBFA-467A-98CB-221AF27B14F2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.CodeGen.Application.Contracts", "module\code-gen\Yi.Framework.CodeGen.Application.Contracts\Yi.Framework.CodeGen.Application.Contracts.csproj", "{882BC563-2F75-4B95-AC96-F4BF23F5E69D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.CodeGen.Domain", "module\code-gen\Yi.Framework.CodeGen.Domain\Yi.Framework.CodeGen.Domain.csproj", "{85CB8517-2B80-42D8-B954-081079AC9BA0}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.CodeGen.Domain.Shared", "module\code-gen\Yi.Framework.CodeGen.Domain.Shared\Yi.Framework.CodeGen.Domain.Shared.csproj", "{EEFF0F05-2709-4151-A8CE-667935CEAE0B}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Caching.FreeRedis", "framework\Yi.Framework.Caching.FreeRedis\Yi.Framework.Caching.FreeRedis.csproj", "{862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.CodeGen.SqlSugarCore", "module\code-gen\Yi.Framework.CodeGen.SqlSugarCore\Yi.Framework.CodeGen.SqlSugarCore.csproj", "{FB09ACC2-A27D-4D87-8D85-1435FDED4D04}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client", "client", "{8B27846A-043D-4F2F-8140-5CEC9D1863B5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.HttpApi.Client", "client\Yi.Abp.HttpApi.Client\Yi.Abp.HttpApi.Client.csproj", "{6B554DCC-3A81-4624-9141-4E39365ADA35}" @@ -126,18 +102,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.SettingManagem EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.SettingManagement.SqlSugarCore", "module\setting-management\Yi.Framework.SettingManagement.SqlSugarCore\Yi.Framework.SettingManagement.SqlSugarCore.csproj", "{495C4643-39D4-46E7-BDC8-237589627BE4}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "chat-hub", "chat-hub", "{D8CDDE99-3684-4EED-A5E5-87F2AF4C78AB}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.ChatHub.Application.Contracts", "module\chat-hub\Yi.Framework.ChatHub.Application.Contracts\Yi.Framework.ChatHub.Application.Contracts.csproj", "{65D4D033-5504-44B9-B152-0172ACD64CE6}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.ChatHub.Domain.Shared", "module\chat-hub\Yi.Framework.ChatHub.Domain.Shared\Yi.Framework.ChatHub.Domain.Shared.csproj", "{DEEC0B15-190C-4464-B469-C45C6563C592}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.ChatHub.SqlSugarCore", "module\chat-hub\Yi.Framework.ChatHub.SqlSugarCore\Yi.Framework.ChatHub.SqlSugarCore.csproj", "{E476D266-8FB2-4D6B-AE2B-F0D279D4264E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.ChatHub.Domain", "module\chat-hub\Yi.Framework.ChatHub.Domain\Yi.Framework.ChatHub.Domain.csproj", "{C2DCA2FD-BFB4-4E76-967B-0AF8CC4F4D47}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.ChatHub.Application", "module\chat-hub\Yi.Framework.ChatHub.Application\Yi.Framework.ChatHub.Application.csproj", "{B7A1A8F3-CFA6-4ECF-A707-0F33FE0A6F1D}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Framework.Rbac.Test", "test\Yi.Framework.Rbac.Test\Yi.Framework.Rbac.Test.csproj", "{9ECF0841-53BE-4FD8-95D1-A7223C7F3A07}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tool", "tool", "{084CBEEC-5D37-4716-B9C7-D80D6960DFF4}" @@ -158,34 +122,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Yi.Abp.Tool.HttpApi.Client" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.SettingManagement.Application", "module\setting-management\Yi.Framework.SettingManagement.Application\Yi.Framework.SettingManagement.Application.csproj", "{2A31D7CB-BDCC-4253-BA73-273B6B5E1956}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "digital-collectibles", "digital-collectibles", "{B8F76A6B-2EEB-4E64-9F26-D84584E16B9C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.DigitalCollectibles.Application", "module\digital-collectibles\Yi.Framework.DigitalCollectibles.Application\Yi.Framework.DigitalCollectibles.Application.csproj", "{236B88D4-F018-4A5F-A506-7458F2308C70}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.DigitalCollectibles.Application.Contracts", "module\digital-collectibles\Yi.Framework.DigitalCollectibles.Application.Contracts\Yi.Framework.DigitalCollectibles.Application.Contracts.csproj", "{4FE7AC0E-91CC-4DF1-ACA7-ED83483C3F3B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.DigitalCollectibles.Domain", "module\digital-collectibles\Yi.Framework.DigitalCollectibles.Domain\Yi.Framework.DigitalCollectibles.Domain.csproj", "{9B5CAE1A-E062-4C9B-8121-E58FBF69309C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.DigitalCollectibles.Domain.Shared", "module\digital-collectibles\Yi.Framework.DigitalCollectibles.Domain.Shared\Yi.Framework.DigitalCollectibles.Domain.Shared.csproj", "{FFEC9DA6-1A13-480A-AE9E-2BF8763D3061}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.DigitalCollectibles.SqlSugarCore", "module\digital-collectibles\Yi.Framework.DigitalCollectibles.SqlSugarCore\Yi.Framework.DigitalCollectibles.SqlSugarCore.csproj", "{4CE6E4AE-0BA4-4984-A4F1-A9A414B1BB8F}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.WeChat.MiniProgram", "framework\Yi.Framework.WeChat.MiniProgram\Yi.Framework.WeChat.MiniProgram.csproj", "{81CEA2ED-917B-41D8-BE0D-39A785B050C0}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.BackgroundWorkers.Hangfire", "framework\Yi.Framework.BackgroundWorkers.Hangfire\Yi.Framework.BackgroundWorkers.Hangfire.csproj", "{862CA181-BEE6-4870-82D2-B662E527ED8C}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ai-stock", "ai-stock", "{DB46873F-981A-43D8-91B0-D464CCB65943}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Stock.Application", "module\ai-stock\Yi.Framework.Stock.Application\Yi.Framework.Stock.Application.csproj", "{B79CE23C-10F8-48A5-A039-5940A188CF5A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Stock.Application.Contracts", "module\ai-stock\Yi.Framework.Stock.Application.Contracts\Yi.Framework.Stock.Application.Contracts.csproj", "{846B781A-B77E-4F86-A31F-0B5B57AB0775}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Stock.Domain", "module\ai-stock\Yi.Framework.Stock.Domain\Yi.Framework.Stock.Domain.csproj", "{162821E4-8FE0-4A68-B3C0-49BD6596446F}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Stock.Domain.Shared", "module\ai-stock\Yi.Framework.Stock.Domain.Shared\Yi.Framework.Stock.Domain.Shared.csproj", "{10273544-715D-4BB3-893C-6F010D947BDD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.Stock.SqlSugarCore", "module\ai-stock\Yi.Framework.Stock.SqlSugarCore\Yi.Framework.Stock.SqlSugarCore.csproj", "{5F49318F-E6C7-4194-BAE0-83D4FB8D1983}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -264,26 +204,6 @@ Global {4503A2F9-139D-4CBC-AF11-689C34F0D77B}.Debug|Any CPU.Build.0 = Debug|Any CPU {4503A2F9-139D-4CBC-AF11-689C34F0D77B}.Release|Any CPU.ActiveCfg = Release|Any CPU {4503A2F9-139D-4CBC-AF11-689C34F0D77B}.Release|Any CPU.Build.0 = Release|Any CPU - {EB9349E2-256D-41EB-A345-21635A1361B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EB9349E2-256D-41EB-A345-21635A1361B3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EB9349E2-256D-41EB-A345-21635A1361B3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EB9349E2-256D-41EB-A345-21635A1361B3}.Release|Any CPU.Build.0 = Release|Any CPU - {4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4EABBC84-BCED-46C1-8CF1-62A7B8081ED7}.Release|Any CPU.Build.0 = Release|Any CPU - {7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20}.Release|Any CPU.Build.0 = Release|Any CPU - {AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD4EE9E6-F4A3-4139-AF05-71388167DE5B}.Release|Any CPU.Build.0 = Release|Any CPU - {6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6C86BA71-9F87-4E2C-B467-2950D77DCDFA}.Release|Any CPU.Build.0 = Release|Any CPU {48806510-8E18-4E1E-9BAF-5B97E88C5FC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48806510-8E18-4E1E-9BAF-5B97E88C5FC3}.Debug|Any CPU.Build.0 = Debug|Any CPU {48806510-8E18-4E1E-9BAF-5B97E88C5FC3}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -320,30 +240,10 @@ Global {FA735055-CBDD-4EFD-B84B-85810DA1425E}.Debug|Any CPU.Build.0 = Debug|Any CPU {FA735055-CBDD-4EFD-B84B-85810DA1425E}.Release|Any CPU.ActiveCfg = Release|Any CPU {FA735055-CBDD-4EFD-B84B-85810DA1425E}.Release|Any CPU.Build.0 = Release|Any CPU - {97EC40D7-DBFA-467A-98CB-221AF27B14F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {97EC40D7-DBFA-467A-98CB-221AF27B14F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {97EC40D7-DBFA-467A-98CB-221AF27B14F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {97EC40D7-DBFA-467A-98CB-221AF27B14F2}.Release|Any CPU.Build.0 = Release|Any CPU - {882BC563-2F75-4B95-AC96-F4BF23F5E69D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {882BC563-2F75-4B95-AC96-F4BF23F5E69D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {882BC563-2F75-4B95-AC96-F4BF23F5E69D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {882BC563-2F75-4B95-AC96-F4BF23F5E69D}.Release|Any CPU.Build.0 = Release|Any CPU - {85CB8517-2B80-42D8-B954-081079AC9BA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {85CB8517-2B80-42D8-B954-081079AC9BA0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85CB8517-2B80-42D8-B954-081079AC9BA0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {85CB8517-2B80-42D8-B954-081079AC9BA0}.Release|Any CPU.Build.0 = Release|Any CPU - {EEFF0F05-2709-4151-A8CE-667935CEAE0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EEFF0F05-2709-4151-A8CE-667935CEAE0B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EEFF0F05-2709-4151-A8CE-667935CEAE0B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EEFF0F05-2709-4151-A8CE-667935CEAE0B}.Release|Any CPU.Build.0 = Release|Any CPU {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}.Debug|Any CPU.Build.0 = Debug|Any CPU {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}.Release|Any CPU.ActiveCfg = Release|Any CPU {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3}.Release|Any CPU.Build.0 = Release|Any CPU - {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FB09ACC2-A27D-4D87-8D85-1435FDED4D04}.Release|Any CPU.Build.0 = Release|Any CPU {6B554DCC-3A81-4624-9141-4E39365ADA35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6B554DCC-3A81-4624-9141-4E39365ADA35}.Debug|Any CPU.Build.0 = Debug|Any CPU {6B554DCC-3A81-4624-9141-4E39365ADA35}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -364,26 +264,6 @@ Global {495C4643-39D4-46E7-BDC8-237589627BE4}.Debug|Any CPU.Build.0 = Debug|Any CPU {495C4643-39D4-46E7-BDC8-237589627BE4}.Release|Any CPU.ActiveCfg = Release|Any CPU {495C4643-39D4-46E7-BDC8-237589627BE4}.Release|Any CPU.Build.0 = Release|Any CPU - {65D4D033-5504-44B9-B152-0172ACD64CE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {65D4D033-5504-44B9-B152-0172ACD64CE6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {65D4D033-5504-44B9-B152-0172ACD64CE6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {65D4D033-5504-44B9-B152-0172ACD64CE6}.Release|Any CPU.Build.0 = Release|Any CPU - {DEEC0B15-190C-4464-B469-C45C6563C592}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DEEC0B15-190C-4464-B469-C45C6563C592}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DEEC0B15-190C-4464-B469-C45C6563C592}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DEEC0B15-190C-4464-B469-C45C6563C592}.Release|Any CPU.Build.0 = Release|Any CPU - {E476D266-8FB2-4D6B-AE2B-F0D279D4264E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E476D266-8FB2-4D6B-AE2B-F0D279D4264E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E476D266-8FB2-4D6B-AE2B-F0D279D4264E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E476D266-8FB2-4D6B-AE2B-F0D279D4264E}.Release|Any CPU.Build.0 = Release|Any CPU - {C2DCA2FD-BFB4-4E76-967B-0AF8CC4F4D47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C2DCA2FD-BFB4-4E76-967B-0AF8CC4F4D47}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C2DCA2FD-BFB4-4E76-967B-0AF8CC4F4D47}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C2DCA2FD-BFB4-4E76-967B-0AF8CC4F4D47}.Release|Any CPU.Build.0 = Release|Any CPU - {B7A1A8F3-CFA6-4ECF-A707-0F33FE0A6F1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B7A1A8F3-CFA6-4ECF-A707-0F33FE0A6F1D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B7A1A8F3-CFA6-4ECF-A707-0F33FE0A6F1D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B7A1A8F3-CFA6-4ECF-A707-0F33FE0A6F1D}.Release|Any CPU.Build.0 = Release|Any CPU {9ECF0841-53BE-4FD8-95D1-A7223C7F3A07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9ECF0841-53BE-4FD8-95D1-A7223C7F3A07}.Debug|Any CPU.Build.0 = Debug|Any CPU {9ECF0841-53BE-4FD8-95D1-A7223C7F3A07}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -420,26 +300,6 @@ Global {2A31D7CB-BDCC-4253-BA73-273B6B5E1956}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A31D7CB-BDCC-4253-BA73-273B6B5E1956}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A31D7CB-BDCC-4253-BA73-273B6B5E1956}.Release|Any CPU.Build.0 = Release|Any CPU - {236B88D4-F018-4A5F-A506-7458F2308C70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {236B88D4-F018-4A5F-A506-7458F2308C70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {236B88D4-F018-4A5F-A506-7458F2308C70}.Release|Any CPU.ActiveCfg = Release|Any CPU - {236B88D4-F018-4A5F-A506-7458F2308C70}.Release|Any CPU.Build.0 = Release|Any CPU - {4FE7AC0E-91CC-4DF1-ACA7-ED83483C3F3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4FE7AC0E-91CC-4DF1-ACA7-ED83483C3F3B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4FE7AC0E-91CC-4DF1-ACA7-ED83483C3F3B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4FE7AC0E-91CC-4DF1-ACA7-ED83483C3F3B}.Release|Any CPU.Build.0 = Release|Any CPU - {9B5CAE1A-E062-4C9B-8121-E58FBF69309C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B5CAE1A-E062-4C9B-8121-E58FBF69309C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B5CAE1A-E062-4C9B-8121-E58FBF69309C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B5CAE1A-E062-4C9B-8121-E58FBF69309C}.Release|Any CPU.Build.0 = Release|Any CPU - {FFEC9DA6-1A13-480A-AE9E-2BF8763D3061}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FFEC9DA6-1A13-480A-AE9E-2BF8763D3061}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FFEC9DA6-1A13-480A-AE9E-2BF8763D3061}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FFEC9DA6-1A13-480A-AE9E-2BF8763D3061}.Release|Any CPU.Build.0 = Release|Any CPU - {4CE6E4AE-0BA4-4984-A4F1-A9A414B1BB8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4CE6E4AE-0BA4-4984-A4F1-A9A414B1BB8F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4CE6E4AE-0BA4-4984-A4F1-A9A414B1BB8F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4CE6E4AE-0BA4-4984-A4F1-A9A414B1BB8F}.Release|Any CPU.Build.0 = Release|Any CPU {81CEA2ED-917B-41D8-BE0D-39A785B050C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {81CEA2ED-917B-41D8-BE0D-39A785B050C0}.Debug|Any CPU.Build.0 = Debug|Any CPU {81CEA2ED-917B-41D8-BE0D-39A785B050C0}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -448,26 +308,6 @@ Global {862CA181-BEE6-4870-82D2-B662E527ED8C}.Debug|Any CPU.Build.0 = Debug|Any CPU {862CA181-BEE6-4870-82D2-B662E527ED8C}.Release|Any CPU.ActiveCfg = Release|Any CPU {862CA181-BEE6-4870-82D2-B662E527ED8C}.Release|Any CPU.Build.0 = Release|Any CPU - {B79CE23C-10F8-48A5-A039-5940A188CF5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B79CE23C-10F8-48A5-A039-5940A188CF5A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B79CE23C-10F8-48A5-A039-5940A188CF5A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B79CE23C-10F8-48A5-A039-5940A188CF5A}.Release|Any CPU.Build.0 = Release|Any CPU - {846B781A-B77E-4F86-A31F-0B5B57AB0775}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {846B781A-B77E-4F86-A31F-0B5B57AB0775}.Debug|Any CPU.Build.0 = Debug|Any CPU - {846B781A-B77E-4F86-A31F-0B5B57AB0775}.Release|Any CPU.ActiveCfg = Release|Any CPU - {846B781A-B77E-4F86-A31F-0B5B57AB0775}.Release|Any CPU.Build.0 = Release|Any CPU - {162821E4-8FE0-4A68-B3C0-49BD6596446F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {162821E4-8FE0-4A68-B3C0-49BD6596446F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {162821E4-8FE0-4A68-B3C0-49BD6596446F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {162821E4-8FE0-4A68-B3C0-49BD6596446F}.Release|Any CPU.Build.0 = Release|Any CPU - {10273544-715D-4BB3-893C-6F010D947BDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10273544-715D-4BB3-893C-6F010D947BDD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10273544-715D-4BB3-893C-6F010D947BDD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10273544-715D-4BB3-893C-6F010D947BDD}.Release|Any CPU.Build.0 = Release|Any CPU - {5F49318F-E6C7-4194-BAE0-83D4FB8D1983}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5F49318F-E6C7-4194-BAE0-83D4FB8D1983}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5F49318F-E6C7-4194-BAE0-83D4FB8D1983}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5F49318F-E6C7-4194-BAE0-83D4FB8D1983}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -492,12 +332,6 @@ Global {C04D3F71-1557-46D0-B810-97B1FBB6AB73} = {9CC7A457-1236-40BA-B47B-E7B710A3F061} {A2BB899D-4F9A-4184-81BD-94B938E2AB03} = {9CC7A457-1236-40BA-B47B-E7B710A3F061} {4503A2F9-139D-4CBC-AF11-689C34F0D77B} = {9CC7A457-1236-40BA-B47B-E7B710A3F061} - {E902A945-4F41-4E96-A0DA-9F66CDA22261} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853} - {EB9349E2-256D-41EB-A345-21635A1361B3} = {E902A945-4F41-4E96-A0DA-9F66CDA22261} - {4EABBC84-BCED-46C1-8CF1-62A7B8081ED7} = {E902A945-4F41-4E96-A0DA-9F66CDA22261} - {7E569FD9-B1AB-4848-8AB7-FD9EFA1DBA20} = {E902A945-4F41-4E96-A0DA-9F66CDA22261} - {AD4EE9E6-F4A3-4139-AF05-71388167DE5B} = {E902A945-4F41-4E96-A0DA-9F66CDA22261} - {6C86BA71-9F87-4E2C-B467-2950D77DCDFA} = {E902A945-4F41-4E96-A0DA-9F66CDA22261} {73CCF2C4-B9FD-44AB-8D4B-0A421805B094} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853} {48806510-8E18-4E1E-9BAF-5B97E88C5FC3} = {73CCF2C4-B9FD-44AB-8D4B-0A421805B094} {791AC2FA-50D3-4408-8D68-31DA72F608BE} = {77B949E9-530E-45A5-9657-20F7D5C6875C} @@ -509,25 +343,13 @@ Global {9C8C3C53-3DCE-4516-867E-228858E61B26} = {73CCF2C4-B9FD-44AB-8D4B-0A421805B094} {17816837-E53B-486B-B796-53C601FE6CD9} = {499A8C71-7892-42D0-A77E-48756E1EFF16} {FA735055-CBDD-4EFD-B84B-85810DA1425E} = {499A8C71-7892-42D0-A77E-48756E1EFF16} - {4FFE7212-21F2-476D-B628-3C65E6C5075E} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853} - {97EC40D7-DBFA-467A-98CB-221AF27B14F2} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} - {882BC563-2F75-4B95-AC96-F4BF23F5E69D} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} - {85CB8517-2B80-42D8-B954-081079AC9BA0} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} - {EEFF0F05-2709-4151-A8CE-667935CEAE0B} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} {862BB0EF-3D4E-44FF-AB15-0EB74CE553D3} = {77B949E9-530E-45A5-9657-20F7D5C6875C} - {FB09ACC2-A27D-4D87-8D85-1435FDED4D04} = {4FFE7212-21F2-476D-B628-3C65E6C5075E} {6B554DCC-3A81-4624-9141-4E39365ADA35} = {8B27846A-043D-4F2F-8140-5CEC9D1863B5} {2D23B44A-DFA3-4C36-8516-4F5AE442403C} = {8B27846A-043D-4F2F-8140-5CEC9D1863B5} {00E49781-C6A0-491C-86A1-46F685C90915} = {8B27846A-043D-4F2F-8140-5CEC9D1863B5} {8C68059E-F3B1-4D28-A1C9-A5830F53E5D3} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853} {6FEE0EB3-EAD2-47F8-B6FC-3D0FD3CCABFF} = {8C68059E-F3B1-4D28-A1C9-A5830F53E5D3} {495C4643-39D4-46E7-BDC8-237589627BE4} = {8C68059E-F3B1-4D28-A1C9-A5830F53E5D3} - {D8CDDE99-3684-4EED-A5E5-87F2AF4C78AB} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853} - {65D4D033-5504-44B9-B152-0172ACD64CE6} = {D8CDDE99-3684-4EED-A5E5-87F2AF4C78AB} - {DEEC0B15-190C-4464-B469-C45C6563C592} = {D8CDDE99-3684-4EED-A5E5-87F2AF4C78AB} - {E476D266-8FB2-4D6B-AE2B-F0D279D4264E} = {D8CDDE99-3684-4EED-A5E5-87F2AF4C78AB} - {C2DCA2FD-BFB4-4E76-967B-0AF8CC4F4D47} = {D8CDDE99-3684-4EED-A5E5-87F2AF4C78AB} - {B7A1A8F3-CFA6-4ECF-A707-0F33FE0A6F1D} = {D8CDDE99-3684-4EED-A5E5-87F2AF4C78AB} {9ECF0841-53BE-4FD8-95D1-A7223C7F3A07} = {0D10EEF2-FBAE-4C72-B816-A52823FC299B} {4FEBBDD9-E4F4-4BAF-8599-E2D57C08A74F} = {084CBEEC-5D37-4716-B9C7-D80D6960DFF4} {2CE51D4C-1EF9-462B-BA14-7EA01A7E4AF1} = {084CBEEC-5D37-4716-B9C7-D80D6960DFF4} @@ -537,20 +359,8 @@ Global {4AE84CDE-2A47-4D68-8E93-86193F72E4E8} = {084CBEEC-5D37-4716-B9C7-D80D6960DFF4} {C8F97775-D903-4365-A4FF-3DA97E318CD2} = {084CBEEC-5D37-4716-B9C7-D80D6960DFF4} {2A31D7CB-BDCC-4253-BA73-273B6B5E1956} = {8C68059E-F3B1-4D28-A1C9-A5830F53E5D3} - {B8F76A6B-2EEB-4E64-9F26-D84584E16B9C} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853} - {236B88D4-F018-4A5F-A506-7458F2308C70} = {B8F76A6B-2EEB-4E64-9F26-D84584E16B9C} - {4FE7AC0E-91CC-4DF1-ACA7-ED83483C3F3B} = {B8F76A6B-2EEB-4E64-9F26-D84584E16B9C} - {9B5CAE1A-E062-4C9B-8121-E58FBF69309C} = {B8F76A6B-2EEB-4E64-9F26-D84584E16B9C} - {FFEC9DA6-1A13-480A-AE9E-2BF8763D3061} = {B8F76A6B-2EEB-4E64-9F26-D84584E16B9C} - {4CE6E4AE-0BA4-4984-A4F1-A9A414B1BB8F} = {B8F76A6B-2EEB-4E64-9F26-D84584E16B9C} {81CEA2ED-917B-41D8-BE0D-39A785B050C0} = {77B949E9-530E-45A5-9657-20F7D5C6875C} {862CA181-BEE6-4870-82D2-B662E527ED8C} = {77B949E9-530E-45A5-9657-20F7D5C6875C} - {DB46873F-981A-43D8-91B0-D464CCB65943} = {2317227D-7796-4E7B-BEDB-7CD1CAE7B853} - {B79CE23C-10F8-48A5-A039-5940A188CF5A} = {DB46873F-981A-43D8-91B0-D464CCB65943} - {846B781A-B77E-4F86-A31F-0B5B57AB0775} = {DB46873F-981A-43D8-91B0-D464CCB65943} - {162821E4-8FE0-4A68-B3C0-49BD6596446F} = {DB46873F-981A-43D8-91B0-D464CCB65943} - {10273544-715D-4BB3-893C-6F010D947BDD} = {DB46873F-981A-43D8-91B0-D464CCB65943} - {5F49318F-E6C7-4194-BAE0-83D4FB8D1983} = {DB46873F-981A-43D8-91B0-D464CCB65943} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {23D6FBC9-C970-4641-BC1E-2AEA59F51C18} diff --git a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/AspNetCore/Middlewares/ApiInfoMiddleware.cs b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/AspNetCore/Middlewares/ApiInfoMiddleware.cs index 8a8bb7b7..94f0dd48 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/AspNetCore/Middlewares/ApiInfoMiddleware.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.AspNetCore/Microsoft/AspNetCore/Middlewares/ApiInfoMiddleware.cs @@ -20,12 +20,12 @@ namespace Yi.Framework.AspNetCore.Microsoft.AspNetCore.Middlewares /// 异步任务 public async Task InvokeAsync(HttpContext context, RequestDelegate next) { - // 在响应开始时处理文件下载相关的响应头 - context.Response.OnStarting(() => - { - HandleFileDownloadResponse(context); - return Task.CompletedTask; - }); + // // 在响应开始时处理文件下载相关的响应头 + // context.Response.OnStarting(() => + // { + // HandleFileDownloadResponse(context); + // return Task.CompletedTask; + // }); // 继续处理管道中的下一个中间件 await next(context); diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockHolding/StockHoldingDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockHolding/StockHoldingDto.cs deleted file mode 100644 index 19dafdfe..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockHolding/StockHoldingDto.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockHolding -{ - /// - /// 用户股票持仓DTO - /// - public class StockHoldingDto : EntityDto - { - /// - /// 用户ID - /// - public Guid UserId { get; set; } - - /// - /// 股票ID - /// - public Guid StockId { get; set; } - - /// - /// 股票代码 - /// - public string StockCode { get; set; } - - /// - /// 股票名称 - /// - public string StockName { get; set; } - - /// - /// 持有数量 - /// - public int Quantity { get; set; } - - /// - /// 持仓成本 - /// - public decimal CostPrice { get; set; } - - /// - /// 当前价格 - /// - public decimal CurrentPrice { get; set; } - - /// - /// 持仓市值 - /// - public decimal MarketValue { get; set; } - - /// - /// 盈亏金额 - /// - public decimal ProfitLoss { get; set; } - - /// - /// 盈亏百分比 - /// - public decimal ProfitLossPercentage { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockHolding/StockHoldingGetListInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockHolding/StockHoldingGetListInputDto.cs deleted file mode 100644 index 8447c357..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockHolding/StockHoldingGetListInputDto.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockHolding -{ - /// - /// 获取用户持仓列表的输入DTO - /// - public class StockHoldingGetListInputDto : PagedAndSortedResultRequestDto - { - /// - /// 股票代码 - /// - public string? StockCode { get; set; } - - /// - /// 股票名称 - /// - public string? StockName { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/BuyStockInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/BuyStockInputDto.cs deleted file mode 100644 index cc154d9d..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/BuyStockInputDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockMarket -{ - /// - /// 买入股票输入DTO - /// - public class BuyStockInputDto - { - /// - /// 股票ID - /// - public Guid StockId { get; set; } - - /// - /// 买入数量 - /// - public int Quantity { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/CreateStockMarketInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/CreateStockMarketInputDto.cs deleted file mode 100644 index c0320597..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/CreateStockMarketInputDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockMarket; -/// -/// 创建股市输入DTO -/// -public class CreateStockMarketInputDto -{ - /// - /// 股市代码 - /// - public string MarketCode { get; set; } - - /// - /// 股市名称 - /// - public string MarketName { get; set; } - - /// - /// 股市描述 - /// - public string Description { get; set; } -} diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/SellStockInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/SellStockInputDto.cs deleted file mode 100644 index d552750e..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/SellStockInputDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockMarket -{ - /// - /// 卖出股票输入DTO - /// - public class SellStockInputDto - { - /// - /// 股票ID - /// - public Guid StockId { get; set; } - - /// - /// 卖出数量 - /// - public int Quantity { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/StockMarketDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/StockMarketDto.cs deleted file mode 100644 index 19659159..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/StockMarketDto.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockMarket -{ - /// - /// 股市信息DTO - /// - public class StockMarketDto : EntityDto - { - /// - /// 股市代码 - /// - public string MarketCode { get; set; } - - /// - /// 股市名称 - /// - public string MarketName { get; set; } - - /// - /// 股市描述 - /// - public string Description { get; set; } - - /// - /// 状态 - /// - public bool State { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/StockMarketGetListInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/StockMarketGetListInputDto.cs deleted file mode 100644 index 38cf5faa..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockMarket/StockMarketGetListInputDto.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockMarket -{ - /// - /// 获取股市列表的输入DTO - /// - public class StockMarketGetListInputDto : PagedAndSortedResultRequestDto - { - /// - /// 股市代码 - /// - public string? MarketCode { get; set; } - - /// - /// 股市名称 - /// - public string? MarketName { get; set; } - - /// - /// 状态 - /// - public bool? State { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockNews/StockNewsDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockNews/StockNewsDto.cs deleted file mode 100644 index 6a4150b2..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockNews/StockNewsDto.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockNews -{ - /// - /// 股市新闻DTO - /// - public class StockNewsDto : EntityDto - { - /// - /// 新闻标题 - /// - public string Title { get; set; } - - /// - /// 新闻内容 - /// - public string Content { get; set; } - - /// - /// 发布时间 - /// - public DateTime PublishTime { get; set; } - - /// - /// 新闻来源 - /// - public string Source { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 排序号 - /// - public int OrderNum { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockNews/StockNewsGetListInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockNews/StockNewsGetListInputDto.cs deleted file mode 100644 index 4a934fcd..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockNews/StockNewsGetListInputDto.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockNews -{ - /// - /// 获取股市新闻列表的输入DTO - /// - public class StockNewsGetListInputDto : PagedAndSortedResultRequestDto - { - /// - /// 新闻标题关键词 - /// - public string? Title { get; set; } - - /// - /// 新闻来源 - /// - public string? Source { get; set; } - - /// - /// 开始时间 - /// - public DateTime? StartTime { get; set; } - - /// - /// 结束时间 - /// - public DateTime? EndTime { get; set; } - - /// - /// 是否只显示最近10天的新闻 - /// - /// 默认为true,查询最近10天的新闻 - public bool IsRecent { get; set; } = true; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockPrice/StockPriceRecordDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockPrice/StockPriceRecordDto.cs deleted file mode 100644 index 8b7b5574..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockPrice/StockPriceRecordDto.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockPrice -{ - /// - /// 股市价格记录DTO - /// - public class StockPriceRecordDto : EntityDto - { - /// - /// 股票ID - /// - public Guid StockId { get; set; } - - /// - /// 记录时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 当前价 - /// - public decimal CurrentPrice { get; set; } - - /// - /// 交易量 - /// - public long Volume { get; set; } - - /// - /// 交易额 - /// - public decimal Turnover { get; set; } - - /// - /// 时间周期类型 - /// - public PeriodTypeEnum PeriodType { get; set; } - - /// - /// 记录时间 - /// - public DateTime RecordTime { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockPrice/StockPriceRecordGetListInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockPrice/StockPriceRecordGetListInputDto.cs deleted file mode 100644 index 84fcf6e1..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockPrice/StockPriceRecordGetListInputDto.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockPrice -{ - /// - /// 获取股市价格记录的输入DTO - /// - public class StockPriceRecordGetListInputDto : PagedAndSortedResultRequestDto - { - /// - /// 股票ID - /// - public Guid? StockId { get; set; } - - /// - /// 开始时间 - /// - public DateTime? StartTime { get; set; } - - /// - /// 结束时间 - /// - public DateTime? EndTime { get; set; } - - /// - /// 时间周期类型 - /// - public PeriodTypeEnum? PeriodType { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockTransaction/StockTransactionDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockTransaction/StockTransactionDto.cs deleted file mode 100644 index 955af11d..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockTransaction/StockTransactionDto.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockTransaction -{ - /// - /// 股票交易记录DTO - /// - public class StockTransactionDto : EntityDto - { - /// - /// 用户ID - /// - public Guid UserId { get; set; } - - /// - /// 股票ID - /// - public Guid StockId { get; set; } - - /// - /// 股票代码 - /// - public string StockCode { get; set; } - - /// - /// 股票名称 - /// - public string StockName { get; set; } - - /// - /// 交易类型 - /// - public TransactionTypeEnum TransactionType { get; set; } - - /// - /// 交易价格 - /// - public decimal Price { get; set; } - - /// - /// 交易数量 - /// - public int Quantity { get; set; } - - /// - /// 交易总额 - /// - public decimal TotalAmount { get; set; } - - /// - /// 交易费用 - /// - public decimal Fee { get; set; } - - /// - /// 交易时间 - /// - public DateTime CreationTime { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockTransaction/StockTransactionGetListInputDto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockTransaction/StockTransactionGetListInputDto.cs deleted file mode 100644 index 9c00eb73..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Dtos/StockTransaction/StockTransactionGetListInputDto.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using Volo.Abp.Application.Dtos; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Application.Contracts.Dtos.StockTransaction -{ - /// - /// 获取交易记录的输入DTO - /// - public class StockTransactionGetListInputDto : PagedAndSortedResultRequestDto - { - /// - /// 股票代码 - /// - public string? StockCode { get; set; } - - /// - /// 股票名称 - /// - public string? StockName { get; set; } - - /// - /// 交易类型 - /// - public TransactionTypeEnum? TransactionType { get; set; } - - /// - /// 开始时间 - /// - public DateTime? StartTime { get; set; } - - /// - /// 结束时间 - /// - public DateTime? EndTime { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockHoldingService.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockHoldingService.cs deleted file mode 100644 index 1f4cdd09..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockHoldingService.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockHolding; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockTransaction; - -namespace Yi.Framework.Stock.Application.Contracts.IServices -{ - /// - /// 用户持仓服务接口 - /// - public interface IStockHoldingService : IApplicationService - { - /// - /// 获取当前用户的持仓列表 - /// - /// 查询条件 - /// 持仓列表 - Task> GetUserHoldingsAsync(StockHoldingGetListInputDto input); - - /// - /// 获取当前用户的交易记录 - /// - /// 查询条件 - /// 交易记录列表 - Task> GetUserTransactionsAsync(StockTransactionGetListInputDto input); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockMarketService.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockMarketService.cs deleted file mode 100644 index 1a7fc6df..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockMarketService.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockMarket; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockPrice; - -namespace Yi.Framework.Stock.Application.Contracts.IServices -{ - /// - /// 股市服务接口 - /// - public interface IStockMarketService : IApplicationService - { - /// - /// 获取股市列表 - /// - /// 查询条件 - /// 股市列表 - Task> GetStockMarketListAsync(StockMarketGetListInputDto input); - - /// - /// 获取股市价格记录看板 - /// - /// 查询条件 - /// 股价记录列表 - Task> GetStockPriceRecordListAsync(StockPriceRecordGetListInputDto input); - - /// - /// 买入股票 - /// - /// 买入股票参数 - /// 操作结果 - Task BuyStockAsync(BuyStockInputDto input); - - /// - /// 卖出股票 - /// - /// 卖出股票参数 - /// 操作结果 - Task SellStockAsync(SellStockInputDto input); - - /// - /// 生成最新股票记录 - /// - /// 操作结果 - Task GenerateStocksAsync(); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockNewsService.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockNewsService.cs deleted file mode 100644 index 5689682c..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/IServices/IStockNewsService.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockNews; - -namespace Yi.Framework.Stock.Application.Contracts.IServices -{ - /// - /// 股市新闻服务接口 - /// - public interface IStockNewsService : IApplicationService - { - /// - /// 获取股市新闻列表 - /// - /// 查询条件 - /// 新闻列表 - Task> GetStockNewsListAsync(StockNewsGetListInputDto input); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Yi.Framework.Stock.Application.Contracts.csproj b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Yi.Framework.Stock.Application.Contracts.csproj deleted file mode 100644 index ae605feb..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/Yi.Framework.Stock.Application.Contracts.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/YiFrameworkStockApplicationContractsModule.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/YiFrameworkStockApplicationContractsModule.cs deleted file mode 100644 index cdafbd0d..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application.Contracts/YiFrameworkStockApplicationContractsModule.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Volo.Abp.SettingManagement; -using Yi.Framework.Stock.Domain.Shared; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Stock.Application.Contracts -{ - [DependsOn( - typeof(YiFrameworkStockDomainSharedModule), - - typeof(AbpSettingManagementApplicationContractsModule), - - typeof(YiFrameworkDddApplicationContractsModule))] - public class YiFrameworkStockApplicationContractsModule:AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockHoldingService.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockHoldingService.cs deleted file mode 100644 index 4f1f8959..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockHoldingService.cs +++ /dev/null @@ -1,107 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockHolding; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockTransaction; -using Yi.Framework.Stock.Application.Contracts.IServices; -using Yi.Framework.Stock.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; -using Volo.Abp.Users; - -namespace Yi.Framework.Stock.Application.Services -{ - /// - /// 用户持仓服务实现 - /// - [Authorize] - public class StockHoldingService : ApplicationService, IStockHoldingService - { - private readonly ISqlSugarRepository _stockHoldingRepository; - private readonly ISqlSugarRepository _stockTransactionRepository; - - public StockHoldingService( - ISqlSugarRepository stockHoldingRepository, - ISqlSugarRepository stockTransactionRepository) - { - _stockHoldingRepository = stockHoldingRepository; - _stockTransactionRepository = stockTransactionRepository; - } - - /// - /// 获取当前用户的持仓列表 - /// - [Authorize] - [HttpGet("stock/user-holdings")] - public async Task> GetUserHoldingsAsync(StockHoldingGetListInputDto input) - { - Guid userId = CurrentUser.GetId(); - RefAsync total = 0; - - var query = _stockHoldingRepository._DbQueryable - .Where(h => h.UserId == userId) - .WhereIF(!string.IsNullOrEmpty(input.StockCode), h => h.StockCode.Contains(input.StockCode)) - .WhereIF(!string.IsNullOrEmpty(input.StockName), h => h.StockName.Contains(input.StockName)) - .OrderByIF(!string.IsNullOrEmpty(input.Sorting),input.Sorting) - .OrderByIF(string.IsNullOrEmpty(input.Sorting),t=>t.CreationTime,OrderByType.Desc); - - var list = await query - .Select(h => new StockHoldingDto - { - Id = h.Id, - UserId = h.UserId, - StockId = h.StockId, - StockCode = h.StockCode, - StockName = h.StockName, - Quantity = h.Quantity, - CreationTime = h.CreationTime - }) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto(total, list); - } - - /// - /// 获取当前用户的交易记录 - /// - [Authorize] - [HttpGet("stock/user-transactions")] - public async Task> GetUserTransactionsAsync(StockTransactionGetListInputDto input) - { - Guid userId = CurrentUser.GetId(); - RefAsync total = 0; - - var query = _stockTransactionRepository._DbQueryable - .Where(t => t.UserId == userId) - .WhereIF(!string.IsNullOrEmpty(input.StockCode), t => t.StockCode.Contains(input.StockCode)) - .WhereIF(!string.IsNullOrEmpty(input.StockName), t => t.StockName.Contains(input.StockName)) - .WhereIF(input.TransactionType.HasValue, t => t.TransactionType == input.TransactionType.Value) - .WhereIF(input.StartTime.HasValue, t => t.CreationTime >= input.StartTime.Value) - .WhereIF(input.EndTime.HasValue, t => t.CreationTime <= input.EndTime.Value) - .OrderByIF(!string.IsNullOrEmpty(input.Sorting),input.Sorting) - .OrderByIF(string.IsNullOrEmpty(input.Sorting),t=>t.CreationTime,OrderByType.Desc); - - var list = await query - .Select(t => new StockTransactionDto - { - Id = t.Id, - UserId = t.UserId, - StockId = t.StockId, - StockCode = t.StockCode, - StockName = t.StockName, - TransactionType = t.TransactionType, - Price = t.Price, - Quantity = t.Quantity, - TotalAmount = t.TotalAmount, - Fee = t.Fee, - CreationTime = t.CreationTime - }) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto(total, list); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockMarketService.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockMarketService.cs deleted file mode 100644 index 2f22bfb2..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockMarketService.cs +++ /dev/null @@ -1,167 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockMarket; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockPrice; -using Yi.Framework.Stock.Application.Contracts.IServices; -using Yi.Framework.Stock.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.Stock.Domain.Managers; -using Mapster; - -namespace Yi.Framework.Stock.Application.Services -{ - /// - /// 股市服务实现 - /// - public class StockMarketService : ApplicationService, IStockMarketService - { - private readonly ISqlSugarRepository _stockMarketRepository; - private readonly ISqlSugarRepository _stockPriceRecordRepository; - private readonly StockMarketManager _stockMarketManager; - - public StockMarketService( - ISqlSugarRepository stockMarketRepository, - ISqlSugarRepository stockPriceRecordRepository, - StockMarketManager stockMarketManager) - { - _stockMarketRepository = stockMarketRepository; - _stockPriceRecordRepository = stockPriceRecordRepository; - _stockMarketManager = stockMarketManager; - } - - /// - /// 创建股市 - /// - [HttpPost("stock/markets")] - [Authorize] - public async Task CreateStockMarketAsync(CreateStockMarketInputDto input) - { - // 使用映射将输入DTO转换为实体 - var stockMarket = input.Adapt(); - - // 保存到数据库 - var result = await _stockMarketRepository.InsertReturnEntityAsync(stockMarket); - - // 使用映射将实体转换为返回DTO - return result.Adapt(); - } - - /// - /// 获取股市列表 - /// - [HttpGet("stock/markets")] - public async Task> GetStockMarketListAsync(StockMarketGetListInputDto input) - { - RefAsync total = 0; - - var query = _stockMarketRepository._DbQueryable - .WhereIF(!string.IsNullOrEmpty(input.MarketCode), m => m.MarketCode.Contains(input.MarketCode)) - .WhereIF(!string.IsNullOrEmpty(input.MarketName), m => m.MarketName.Contains(input.MarketName)) - .WhereIF(input.State.HasValue, m => m.State == input.State.Value) - .OrderByIF(!string.IsNullOrEmpty(input.Sorting),input.Sorting) - .OrderByIF(string.IsNullOrEmpty(input.Sorting),m=>m.OrderNum,OrderByType.Asc) - .OrderByIF(string.IsNullOrEmpty(input.Sorting),m=>m.CreationTime,OrderByType.Desc); - - var list = await query - .Select(m => new StockMarketDto - { - Id = m.Id, - MarketCode = m.MarketCode, - MarketName = m.MarketName, - Description = m.Description, - State = m.State, - CreationTime = m.CreationTime - }) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto(total, list); - } - - /// - /// 获取股市价格记录看板 - /// - [HttpGet("stock/price-records")] - public async Task> GetStockPriceRecordListAsync(StockPriceRecordGetListInputDto input) - { - RefAsync total = 0; - - var query = _stockPriceRecordRepository._DbQueryable - .WhereIF(input.StockId.HasValue, p => p.StockId == input.StockId.Value) - .WhereIF(input.StartTime.HasValue, p => p.RecordTime >= input.StartTime.Value) - .WhereIF(input.EndTime.HasValue, p => p.RecordTime <= input.EndTime.Value) - .WhereIF(input.PeriodType.HasValue, p => p.PeriodType == input.PeriodType.Value) - .Where(x=>x.RecordTime<=DateTime.Now) - .OrderByIF(!string.IsNullOrEmpty(input.Sorting),input.Sorting) - .OrderByIF(string.IsNullOrEmpty(input.Sorting),p=>p.RecordTime); - - var list = await query - .Select(p => new StockPriceRecordDto - { - Id = p.Id, - StockId = p.StockId, - CreationTime = p.CreationTime, - RecordTime = p.RecordTime, - CurrentPrice = p.CurrentPrice, - Volume = p.Volume, - Turnover = p.Turnover, - PeriodType = p.PeriodType - }) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto(total, list); - } - - /// - /// 买入股票 - /// - [HttpPost("stock/buy")] - [Authorize] - public async Task BuyStockAsync(BuyStockInputDto input) - { - // 获取当前登录用户ID - var userId = CurrentUser.GetId(); - - // 调用领域服务进行股票购买 - await _stockMarketManager.BuyStockAsync( - userId, - input.StockId, - input.Quantity - ); - } - - /// - /// 卖出股票 - /// - [HttpDelete("stock/sell")] - [Authorize] - public async Task SellStockAsync(SellStockInputDto input) - { - // 获取当前登录用户ID - var userId = CurrentUser.GetId(); - - // 调用领域服务进行股票卖出 - await _stockMarketManager.SellStockAsync( - userId, - input.StockId, - input.Quantity - ); - } - - /// - /// 生成最新股票记录 - /// - [HttpPost("stock/generate")] - [Authorize] - public async Task GenerateStocksAsync() - { - await _stockMarketManager.GenerateStocksAsync(); - } - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockNewsService.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockNewsService.cs deleted file mode 100644 index 1dd4ced1..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Services/StockNewsService.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Stock.Application.Contracts.Dtos.StockNews; -using Yi.Framework.Stock.Application.Contracts.IServices; -using Yi.Framework.Stock.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.Stock.Domain.Managers; - -namespace Yi.Framework.Stock.Application.Services -{ - /// - /// 股市新闻服务实现 - /// - public class StockNewsService : ApplicationService, IStockNewsService - { - private readonly ISqlSugarRepository _stockNewsRepository; - private readonly NewsManager _newsManager; - - public StockNewsService( - ISqlSugarRepository stockNewsRepository, - NewsManager newsManager) - { - _stockNewsRepository = stockNewsRepository; - _newsManager = newsManager; - } - - /// - /// 获取股市新闻列表 - /// - [HttpGet("/api/app/stock/news")] - public async Task> GetStockNewsListAsync(StockNewsGetListInputDto input) - { - RefAsync total = 0; - - // 计算10天前的日期 - DateTime tenDaysAgo = DateTime.Now.AddDays(-10); - - var query = _stockNewsRepository._DbQueryable - .WhereIF(!string.IsNullOrEmpty(input.Title), n => n.Title.Contains(input.Title)) - .WhereIF(!string.IsNullOrEmpty(input.Source), n => n.Source.Contains(input.Source)) - .WhereIF(input.StartTime.HasValue, n => n.PublishTime >= input.StartTime.Value) - .WhereIF(input.EndTime.HasValue, n => n.PublishTime <= input.EndTime.Value) - // 如果IsRecent为true,则只查询最近10天的新闻 - .WhereIF(input.IsRecent, n => n.PublishTime >= tenDaysAgo) - .OrderByIF(!string.IsNullOrEmpty(input.Sorting),input.Sorting) - .OrderByIF(string.IsNullOrEmpty(input.Sorting),n=>n.OrderNum,OrderByType.Asc) - .OrderByIF(string.IsNullOrEmpty(input.Sorting),n=>n.PublishTime,OrderByType.Desc) ; - - - var list = await query - .Select(n => new StockNewsDto - { - Id = n.Id, - Title = n.Title, - Content = n.Content, - PublishTime = n.PublishTime, - Source = n.Source, - CreationTime = n.CreationTime, - OrderNum = n.OrderNum - }) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto(total, list); - } - - /// - /// 生成股市新闻 - /// - /// 生成结果 - [HttpPost("/api/app/stock/news/generate")] - public async Task GenerateNewsAsync() - { - await _newsManager.GenerateNewsAsync(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Yi.Framework.Stock.Application.csproj b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Yi.Framework.Stock.Application.csproj deleted file mode 100644 index 2e7ba8dc..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/Yi.Framework.Stock.Application.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/YiFrameworkStockApplicationModule.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/YiFrameworkStockApplicationModule.cs deleted file mode 100644 index 67554bdd..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Application/YiFrameworkStockApplicationModule.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Yi.Framework.Stock.Application.Contracts; -using Yi.Framework.Stock.Domain; -using Yi.Framework.Ddd.Application; - -namespace Yi.Framework.Stock.Application -{ - [DependsOn( - typeof(YiFrameworkStockApplicationContractsModule), - typeof(YiFrameworkStockDomainModule), - - typeof(YiFrameworkDddApplicationModule) - - )] - public class YiFrameworkStockApplicationModule : AbpModule - { - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Enums/PeriodTypeEnum.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Enums/PeriodTypeEnum.cs deleted file mode 100644 index 4ca57fa4..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Enums/PeriodTypeEnum.cs +++ /dev/null @@ -1,41 +0,0 @@ -namespace Yi.Framework.Stock.Domain.Shared -{ - /// - /// 时间周期类型枚举 - /// - /// - /// 用于定义股票价格记录的时间周期类型 - /// - public enum PeriodTypeEnum - { - /// - /// 分钟 - /// - Minute = 0, - - /// - /// 小时 - /// - Hour = 1, - - /// - /// 天 - /// - Day = 2, - - /// - /// 周 - /// - Week = 3, - - /// - /// 月 - /// - Month = 4, - - /// - /// 年 - /// - Year = 5 - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Enums/TransactionTypeEnum.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Enums/TransactionTypeEnum.cs deleted file mode 100644 index b8e0d6d3..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Enums/TransactionTypeEnum.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Yi.Framework.Stock.Domain.Shared -{ - /// - /// 交易类型枚举 - /// - public enum TransactionTypeEnum - { - /// - /// 买入 - /// - Buy = 0, - - /// - /// 卖出 - /// - Sell = 1 - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Etos/StockTransactionEto.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Etos/StockTransactionEto.cs deleted file mode 100644 index e37f07d9..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Etos/StockTransactionEto.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Domain.Shared.Etos -{ - /// - /// 股票交易事件数据传输对象 - /// - public class StockTransactionEto - { - /// - /// 用户ID - /// - public Guid UserId { get; set; } - - /// - /// 股票ID - /// - public Guid StockId { get; set; } - - /// - /// 股票代码 - /// - public string StockCode { get; set; } - - /// - /// 股票名称 - /// - public string StockName { get; set; } - - /// - /// 交易类型 - /// - public TransactionTypeEnum TransactionType { get; set; } - - /// - /// 交易价格 - /// - public decimal Price { get; set; } - - /// - /// 交易数量 - /// - public int Quantity { get; set; } - - /// - /// 交易总额 - /// - public decimal TotalAmount { get; set; } - - /// - /// 交易费用 - /// - public decimal Fee { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Yi.Framework.Stock.Domain.Shared.csproj b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Yi.Framework.Stock.Domain.Shared.csproj deleted file mode 100644 index 94311f04..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/Yi.Framework.Stock.Domain.Shared.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/YiFrameworkStockDomainSharedModule.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/YiFrameworkStockDomainSharedModule.cs deleted file mode 100644 index a351386f..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain.Shared/YiFrameworkStockDomainSharedModule.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Volo.Abp.Domain; -using Volo.Abp.SettingManagement; - -namespace Yi.Framework.Stock.Domain.Shared -{ - [DependsOn( - - typeof(AbpSettingManagementDomainSharedModule), - typeof(AbpDddDomainSharedModule))] - public class YiFrameworkStockDomainSharedModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockHoldingAggregateRoot.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockHoldingAggregateRoot.cs deleted file mode 100644 index 4d815593..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockHoldingAggregateRoot.cs +++ /dev/null @@ -1,141 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Core.Data; - -namespace Yi.Framework.Stock.Domain.Entities -{ - /// - /// 用户股票持仓聚合根 - /// - /// - /// 记录用户持有的股票数量和相关信息 - /// - [SugarTable("Stock_Holding")] - public class StockHoldingAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject - { - - /// - /// 逻辑删除 - /// - public bool IsDeleted { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; set; } = DateTime.Now; - - /// - /// 创建者 - /// - public Guid? CreatorId { get; set; } - - /// - /// 最后修改者 - /// - public Guid? LastModifierId { get; set; } - - /// - /// 最后修改时间 - /// - public DateTime? LastModificationTime { get; set; } - - /// - /// 用户ID - /// - /// 关联到持有股票的用户 - public Guid UserId { get; set; } - - /// - /// 股票ID - /// - /// 关联到具体的股票 - public Guid StockId { get; set; } - - /// - /// 股票代码 - /// - /// 冗余字段,方便查询 - public string StockCode { get; set; } = string.Empty; - - /// - /// 股票名称 - /// - /// 冗余字段,方便查询 - public string StockName { get; set; } = string.Empty; - - /// - /// 持有数量 - /// - /// 用户持有的股票数量 - public int Quantity { get; set; } - - /// - /// 平均成本价 - /// - /// 用户购买这些股票的平均成本价 - public decimal AverageCostPrice { get; set; } - - /// - /// 持仓成本 - /// - /// 总投入成本 = 平均成本价 * 持有数量 - [SugarColumn(IsIgnore = true)] - public decimal TotalCost => AverageCostPrice * Quantity; - - public StockHoldingAggregateRoot() { } - - public StockHoldingAggregateRoot( - Guid userId, - Guid stockId, - string stockCode, - string stockName, - int quantity, - decimal averageCostPrice) - { - UserId = userId; - StockId = stockId; - StockCode = stockCode; - StockName = stockName; - Quantity = quantity; - AverageCostPrice = averageCostPrice; - } - - /// - /// 增加持仓数量 - /// - /// 增加的数量 - /// 本次购买价格 - public void AddQuantity(int quantity, decimal price) - { - if (quantity <= 0) - throw new ArgumentException("增加的数量必须大于0"); - - // 计算新的平均成本价 - decimal totalCost = AverageCostPrice * Quantity + price * quantity; - Quantity += quantity; - AverageCostPrice = totalCost / Quantity; - } - - /// - /// 减少持仓数量 - /// - /// 减少的数量 - public void ReduceQuantity(int quantity) - { - if (quantity <= 0) - throw new ArgumentException("减少的数量必须大于0"); - - if (quantity > Quantity) - throw new ArgumentException("减少的数量不能大于持有数量"); - - Quantity -= quantity; - - // 如果数量为0,标记为删除 - if (Quantity == 0) - { - IsDeleted = true; - } - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockMarketAggregateRoot.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockMarketAggregateRoot.cs deleted file mode 100644 index 937ff00f..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockMarketAggregateRoot.cs +++ /dev/null @@ -1,79 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Core.Data; - -namespace Yi.Framework.Stock.Domain.Entities -{ - /// - /// 股市聚合根实体 - /// - /// - /// 用于定义有哪些公司上架的股市 - /// - [SugarTable("Stock_Market")] - public class StockMarketAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject, IOrderNum, IState - { - /// - /// 逻辑删除 - /// - public bool IsDeleted { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 创建者 - /// - public Guid? CreatorId { get; set; } - - /// - /// 最后修改者 - /// - public Guid? LastModifierId { get; set; } - - /// - /// 最后修改时间 - /// - public DateTime? LastModificationTime { get; set; } - - /// - /// 排序 - /// - public int OrderNum { get; set; } = 0; - - /// - /// 状态 - /// - public bool State { get; set; } = true; - - /// - /// 股市代码 - /// - public string MarketCode { get; set; } = string.Empty; - - /// - /// 股市名称 - /// - public string MarketName { get; set; } = string.Empty; - - /// - /// 股市描述 - /// - public string Description { get; set; } = string.Empty; - - public StockMarketAggregateRoot() { } - - public StockMarketAggregateRoot( - string marketCode, - string marketName, - string description = "") - { - MarketCode = marketCode; - MarketName = marketName; - Description = description; - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockNewsAggregateRoot.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockNewsAggregateRoot.cs deleted file mode 100644 index db7c3803..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockNewsAggregateRoot.cs +++ /dev/null @@ -1,87 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Core.Data; - -namespace Yi.Framework.Stock.Domain.Entities -{ - /// - /// 股市新闻聚合根实体 - /// - /// - /// 用于记录影响股市波动的新闻事件 - /// - [SugarTable("Stock_News")] - public class StockNewsAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject, IOrderNum - { - /// - /// 逻辑删除 - /// - public bool IsDeleted { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 创建者ID - /// - public Guid? CreatorId { get; set; } - - /// - /// 最后修改时间 - /// - public DateTime? LastModificationTime { get; set; } - - /// - /// 最后修改者ID - /// - public Guid? LastModifierId { get; set; } - - /// - /// 排序号 - /// - public int OrderNum { get; set; } = 0; - - /// - /// 新闻标题 - /// - public string Title { get; set; } = string.Empty; - - /// - /// 新闻内容 - /// - [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)] - public string Content { get; set; } = string.Empty; - - /// - /// 发布时间 - /// - public DateTime PublishTime { get; set; } - - /// - /// 新闻来源 - /// - public string Source { get; set; } = string.Empty; - - /// - /// 新闻摘要 - /// - public string Summary { get; set; } = string.Empty; - - public StockNewsAggregateRoot() { } - - public StockNewsAggregateRoot( - string title, - string content, - string source = "") - { - Title = title; - Content = content; - Source = source; - PublishTime = DateTime.Now; - } - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockPriceRecordEntity.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockPriceRecordEntity.cs deleted file mode 100644 index 08dd09cc..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockPriceRecordEntity.cs +++ /dev/null @@ -1,78 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Auditing; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Domain.Entities -{ - /// - /// 股票价格记录实体 - /// - /// - /// 用于记录每支股票在不同时间点的价格数据,支持趋势分析和图表展示 - /// - [SugarTable("Stock_PriceRecord")] - public class StockPriceRecordEntity : Entity, IHasCreationTime - { - - /// - /// 股票ID - /// - /// 关联到具体的股票 - public Guid StockId { get; set; } - - /// - /// 创建时间(审计日志) - /// - public DateTime CreationTime { get; set; } - - /// - /// 记录时间 - /// - /// 价格记录的实际时间点 - public DateTime RecordTime { get; set; } - - /// - /// 当前价 - /// - public decimal CurrentPrice { get; set; } - - /// - /// 交易量 - /// - /// 该时间段内的交易股数 - public long Volume { get; set; } - - /// - /// 交易额 - /// - /// 该时间段内的交易金额 - public decimal Turnover { get; set; } - - /// - /// 时间周期类型 - /// - /// - /// 记录的时间周期类型:分钟、小时、日、周、月等 - /// - public PeriodTypeEnum PeriodType { get; set; } - - public StockPriceRecordEntity() { } - - public StockPriceRecordEntity( - Guid stockId, - decimal currentPrice, - long volume = 0, - decimal turnover = 0, - PeriodTypeEnum periodType = PeriodTypeEnum.Day) - { - StockId = stockId; - CreationTime = DateTime.Now; - RecordTime = DateTime.Now; - CurrentPrice = currentPrice; - Volume = volume; - Turnover = turnover; - PeriodType = periodType; - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockTransactionEntity.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockTransactionEntity.cs deleted file mode 100644 index 389a60e4..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Entities/StockTransactionEntity.cs +++ /dev/null @@ -1,121 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Auditing; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Domain.Entities -{ - /// - /// 股票交易记录实体 - /// - /// - /// 用于记录用户买入或卖出股票的交易历史 - /// - [SugarTable("Stock_Transaction")] - public class StockTransactionEntity : Entity, IAuditedObject - { - /// - /// 用户ID - /// - /// 进行交易的用户 - public Guid UserId { get; set; } - - /// - /// 股票ID - /// - /// 交易的股票 - public Guid StockId { get; set; } - - /// - /// 股票代码 - /// - /// 冗余字段,方便查询 - public string StockCode { get; set; } = string.Empty; - - /// - /// 股票名称 - /// - /// 冗余字段,方便查询 - public string StockName { get; set; } = string.Empty; - - /// - /// 交易类型 - /// - public TransactionTypeEnum TransactionType { get; set; } - - /// - /// 交易价格 - /// - /// 股票的单价 - public decimal Price { get; set; } - - /// - /// 交易数量 - /// - /// 买入或卖出的股票数量 - public int Quantity { get; set; } - - /// - /// 交易总额 - /// - /// 价格 × 数量 - public decimal TotalAmount { get; set; } - - /// - /// 交易费用 - /// - /// 手续费、佣金等 - public decimal Fee { get; set; } - - /// - /// 创建时间 - /// - /// 交易发生时间 - public DateTime CreationTime { get; set; } - - /// - /// 创建者ID - /// - public Guid? CreatorId { get; set; } - - /// - /// 最后修改时间 - /// - public DateTime? LastModificationTime { get; set; } - - /// - /// 最后修改者ID - /// - public Guid? LastModifierId { get; set; } - - /// - /// 备注 - /// - public string Remark { get; set; } = string.Empty; - - public StockTransactionEntity() { } - - public StockTransactionEntity( - Guid userId, - Guid stockId, - string stockCode, - string stockName, - TransactionTypeEnum transactionType, - decimal price, - int quantity, - decimal fee = 0) - { - Id = Guid.NewGuid(); - UserId = userId; - StockId = stockId; - StockCode = stockCode; - StockName = stockName; - TransactionType = transactionType; - Price = price; - Quantity = quantity; - TotalAmount = price * quantity; - Fee = fee; - CreationTime = DateTime.Now; - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/EventHandlers/StockTransactionEventHandler.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/EventHandlers/StockTransactionEventHandler.cs deleted file mode 100644 index 75fdc3c1..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/EventHandlers/StockTransactionEventHandler.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.Stock.Domain.Entities; -using Yi.Framework.Stock.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Stock.Domain.EventHandlers -{ - /// - /// 股票交易事件处理器 - /// - public class StockTransactionEventHandler : ILocalEventHandler, ITransientDependency - { - private readonly ISqlSugarRepository _transactionRepository; - - public StockTransactionEventHandler( - ISqlSugarRepository transactionRepository) - { - _transactionRepository = transactionRepository; - } - - public async Task HandleEventAsync(StockTransactionEto eventData) - { - // 创建交易记录实体 - var transaction = new StockTransactionEntity( - eventData.UserId, - eventData.StockId, - eventData.StockCode, - eventData.StockName, - eventData.TransactionType, - eventData.Price, - eventData.Quantity, - eventData.Fee - ); - - // 保存交易记录 - await _transactionRepository.InsertAsync(transaction); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/NewsManager.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/NewsManager.cs deleted file mode 100644 index 7e9ff774..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/NewsManager.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Volo.Abp.Domain.Services; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.Stock.Domain.Entities; -using Yi.Framework.Stock.Domain.Managers.SemanticKernel; -using Yi.Framework.Stock.Domain.Managers.SemanticKernel.Plugins; -using System.Text; -using System.IO; - -namespace Yi.Framework.Stock.Domain.Managers; - -public class NewsManager:DomainService -{ - private SemanticKernelClient _skClient; - private ISqlSugarRepository _newsRepository; - public NewsManager(SemanticKernelClient skClient,ISqlSugarRepository newsRepository) - { - _skClient = skClient; - _newsRepository = newsRepository; - } - - /// - /// 获取最近的新闻 - /// - /// 获取数量 - /// 最近的新闻列表 - public async Task> GetRecentNewsAsync(int count = 10) - { - return await _newsRepository._DbQueryable - .OrderByDescending(n => n.CreationTime) - .Take(count) - .Select(n => new StockNewsAggregateRoot - { - Title = n.Title, - Summary = n.Summary, - Source = n.Source, - CreationTime = n.CreationTime - }) - .ToListAsync(); - } - - /// - /// 生成一个新闻 - /// - /// - public async Task GenerateNewsAsync() - { - // 获取最近10条新闻 - var recentNews = await GetRecentNewsAsync(10); - - // 构建新闻背景上下文 - var newsContext = new StringBuilder(); - if (recentNews.Any()) - { - newsContext.AppendLine("以下是最近的新闻简介:"); - foreach (var news in recentNews) - { - newsContext.AppendLine($"- {news.CreationTime:yyyy-MM-dd} 来源:{news.Source}"); - newsContext.AppendLine($" 标题:{news.Title}"); - newsContext.AppendLine($" 简介:{news.Summary}"); - newsContext.AppendLine(); - } - } - else - { - newsContext.AppendLine("目前没有最近的新闻记录。"); - } - - var promptPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "stock", "newsPrompt.txt"); - var question = await File.ReadAllTextAsync(promptPath); - question = question.Replace("{{newsContext}}", newsContext.ToString()); - - await _skClient.ChatCompletionAsync(question, ("NewsPlugins","save_news")); - } - - public async Task SaveNewsAsync(NewsModel news) - { - var newsEntity = new StockNewsAggregateRoot( - title: news.Title, - content: news.Content, - source: news.Source - ) - { - Summary = news.Summary, - CreationTime = DateTime.Now, - IsDeleted = false, - OrderNum = 0 - }; - - await _newsRepository.InsertAsync(newsEntity); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/Plugins/NewsPlugins.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/Plugins/NewsPlugins.cs deleted file mode 100644 index be6fecfb..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/Plugins/NewsPlugins.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.ComponentModel; -using System.Text.Json.Serialization; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.SemanticKernel; - -namespace Yi.Framework.Stock.Domain.Managers.SemanticKernel.Plugins; - -public class NewsPlugins -{ - private readonly IServiceProvider _serviceProvider; - - public NewsPlugins(IServiceProvider serviceProvider) - { - _serviceProvider = serviceProvider; - } - - [KernelFunction("save_news"), Description("生成并保存一个新闻")] - public async Task SaveAsync(NewsModel news) - { - var newsManager = _serviceProvider.GetRequiredService(); - await newsManager.SaveNewsAsync(news); - } -} - -public class NewsModel -{ - [JsonPropertyName("title")] - [DisplayName("新闻标题")] - public string Title { get; set; } - - [JsonPropertyName("content")] - [DisplayName("新闻内容")] - public string Content { get; set; } - - [JsonPropertyName("summary")] - [DisplayName("新闻简介")] - public string Summary { get; set; } - - [JsonPropertyName("source")] - [DisplayName("新闻来源")] - public string Source { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/Plugins/StockPlugins.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/Plugins/StockPlugins.cs deleted file mode 100644 index 2cecdbf7..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/Plugins/StockPlugins.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.ComponentModel; -using System.Text.Json.Serialization; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.SemanticKernel; - -namespace Yi.Framework.Stock.Domain.Managers.SemanticKernel.Plugins; - -public class StockPlugins -{ - private readonly IServiceProvider _serviceProvider; - - public StockPlugins(IServiceProvider serviceProvider) - { - _serviceProvider = serviceProvider; - } - - [KernelFunction("save_stocks"), Description("生成并且保存多个股票记录")] - public async Task SaveAsync(List stockModels) - { - var stockMarketManager= _serviceProvider.GetRequiredService(); - await stockMarketManager.SaveStockAsync(stockModels); - } -} - -public class StockModel -{ - [JsonPropertyName("id")] - [DisplayName("股票id")] - public Guid Id { get; set; } - - [JsonPropertyName("values")] - [DisplayName("股票未来24小时价格")] - public decimal[] Values { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/SemanticKernelClient.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/SemanticKernelClient.cs deleted file mode 100644 index 0443b2ef..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/SemanticKernelClient.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Microsoft.SemanticKernel; -using Microsoft.SemanticKernel.ChatCompletion; -using Microsoft.SemanticKernel.Connectors.OpenAI; -using Volo.Abp.DependencyInjection; - -namespace Yi.Framework.Stock.Domain.Managers.SemanticKernel; - -public class SemanticKernelClient:ITransientDependency -{ - public Kernel Kernel { get;} - - public SemanticKernelClient(Kernel kernel) - { - this.Kernel = kernel; - } - /// - /// 执行插件 - /// - /// - /// - /// - /// - public async Task InovkerFunctionAsync(string input, string pluginName, string functionName) - { - KernelFunction jsonFun = this.Kernel.Plugins.GetFunction(pluginName, functionName); - var result = await this.Kernel.InvokeAsync(function: jsonFun, new KernelArguments() { ["input"] = input }); - return result.GetValue(); - } - - /// - /// 聊天对话,调用方法 - /// - /// - public async Task> ChatCompletionAsync(string question,params (string,string)[] functions) - { - if (functions is null) - { - throw new Exception("请选择插件"); - } - var openSettings = new OpenAIPromptExecutionSettings() - { - FunctionChoiceBehavior = FunctionChoiceBehavior.Auto(functions.Select(x=>this.Kernel.Plugins.GetFunction(x.Item1, x.Item2)).ToList(),true), - // ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions, - MaxTokens =1000 - }; - - var chatCompletionService = this.Kernel.GetRequiredService(); - - var results =await chatCompletionService.GetChatMessageContentsAsync( - question, - executionSettings: openSettings, - kernel: Kernel); - return results; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/SemanticKernelOptions.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/SemanticKernelOptions.cs deleted file mode 100644 index afa754d4..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/SemanticKernel/SemanticKernelOptions.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.Stock.Domain.Managers.SemanticKernel -{ - public class SemanticKernelOptions - { - public List ModelIds { get; set; } - public string Endpoint { get; set; } - public string ApiKey { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/StockMarketManager.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/StockMarketManager.cs deleted file mode 100644 index 648f232d..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Managers/StockMarketManager.cs +++ /dev/null @@ -1,446 +0,0 @@ -using System; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Stock.Domain.Entities; -using Yi.Framework.Stock.Domain.Shared; -using Yi.Framework.Stock.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.Stock.Domain.Managers.SemanticKernel; -using Yi.Framework.Stock.Domain.Managers.SemanticKernel.Plugins; -using Microsoft.Extensions.Hosting; -using System.Text; -using System.IO; - -namespace Yi.Framework.Stock.Domain.Managers -{ - /// - /// 股市领域服务 - /// - /// - /// 处理股票交易相关业务,例如买入、卖出等 - /// - public class StockMarketManager : DomainService - { - private readonly ISqlSugarRepository _stockHoldingRepository; - private readonly ISqlSugarRepository _stockTransactionRepository; - private readonly ISqlSugarRepository _stockPriceRecordRepository; - private readonly ISqlSugarRepository _stockMarketRepository; - private readonly ILocalEventBus _localEventBus; - private readonly SemanticKernelClient _skClient; - private readonly IHostEnvironment _hostEnvironment; - private readonly NewsManager _newsManager; - - public StockMarketManager( - ISqlSugarRepository stockHoldingRepository, - ISqlSugarRepository stockTransactionRepository, - ISqlSugarRepository stockPriceRecordRepository, - ISqlSugarRepository stockMarketRepository, - ILocalEventBus localEventBus, - SemanticKernelClient skClient, - IHostEnvironment hostEnvironment, - NewsManager newsManager) - { - _stockHoldingRepository = stockHoldingRepository; - _stockTransactionRepository = stockTransactionRepository; - _stockPriceRecordRepository = stockPriceRecordRepository; - _stockMarketRepository = stockMarketRepository; - _localEventBus = localEventBus; - _skClient = skClient; - _hostEnvironment = hostEnvironment; - _newsManager = newsManager; - } - - /// - /// 购买股票 - /// - /// 用户ID - /// 股票ID - /// 购买数量 - /// - public async Task BuyStockAsync(Guid userId, Guid stockId, int quantity) - { - if (quantity <= 0) - { - throw new UserFriendlyException("购买数量必须大于0"); - } - - // 通过stockId查询获取股票信息 - var stockInfo = await _stockMarketRepository.GetFirstAsync(s => s.Id == stockId); - if (stockInfo == null) - { - throw new UserFriendlyException("找不到指定的股票"); - } - - string stockCode = stockInfo.MarketCode; // 根据实际字段调整 - string stockName = stockInfo.MarketName; // 根据实际字段调整 - - // 获取当前股票价格 - decimal currentPrice = await GetCurrentStockPriceAsync(stockId); - - // 计算总金额和手续费 - decimal totalAmount = currentPrice * quantity; - decimal fee = CalculateTradingFee(totalAmount, TransactionTypeEnum.Buy); - decimal totalCost = totalAmount + fee; - - // 扣减用户资金 - await _localEventBus.PublishAsync( - new MoneyChangeEventArgs { UserId = userId, Number = -totalCost }, false); - - // 更新或创建用户持仓 - var holding = await _stockHoldingRepository.GetFirstAsync(h => - h.UserId == userId && - h.StockId == stockId && - !h.IsDeleted); - - if (holding == null) - { - // 创建新持仓 - holding = new StockHoldingAggregateRoot( - userId, - stockId, - stockCode, - stockName, - quantity, - currentPrice); - - await _stockHoldingRepository.InsertAsync(holding); - } - else - { - // 更新现有持仓 - holding.AddQuantity(quantity, currentPrice); - await _stockHoldingRepository.UpdateAsync(holding); - } - // 发布交易事件 - await _localEventBus.PublishAsync(new StockTransactionEto - { - UserId = userId, - StockId = stockId, - StockCode = stockCode, - StockName = stockName, - TransactionType = TransactionTypeEnum.Buy, - Price = currentPrice, - Quantity = quantity, - TotalAmount = totalAmount, - Fee = fee - }, false); - } - - /// - /// 卖出股票 - /// - /// 用户ID - /// 股票ID - /// 卖出数量 - /// - public async Task SellStockAsync(Guid userId, Guid stockId, int quantity) - { - // 验证卖出时间 - VerifySellTime(); - - if (quantity <= 0) - { - throw new UserFriendlyException("卖出数量必须大于0"); - } - - // 获取用户持仓 - var holding = await _stockHoldingRepository.GetFirstAsync(h => - h.UserId == userId && - h.StockId == stockId && - !h.IsDeleted); - - if (holding == null) - { - throw new UserFriendlyException("您没有持有该股票"); - } - - if (holding.Quantity < quantity) - { - throw new UserFriendlyException("持仓数量不足"); - } - - // 获取当前股票价格 - decimal currentPrice = await GetCurrentStockPriceAsync(stockId); - - // 计算总金额和手续费 - decimal totalAmount = currentPrice * quantity; - decimal fee = CalculateTradingFee(totalAmount, TransactionTypeEnum.Sell); - decimal actualIncome = totalAmount - fee; - - // 增加用户资金 - await _localEventBus.PublishAsync( - new MoneyChangeEventArgs { UserId = userId, Number = actualIncome }, false); - - // 更新用户持仓 - holding.ReduceQuantity(quantity); - - if (holding.Quantity > 0) - { - await _stockHoldingRepository.UpdateAsync(holding); - } - else - { - await _stockHoldingRepository.DeleteAsync(holding); - } - - // 发布交易事件 - await _localEventBus.PublishAsync(new StockTransactionEto - { - UserId = userId, - StockId = stockId, - StockCode = holding.StockCode, - StockName = holding.StockName, - TransactionType = TransactionTypeEnum.Sell, - Price = currentPrice, - Quantity = quantity, - TotalAmount = totalAmount, - Fee = fee - }, false); - } - - /// - /// 获取股票当前价格 - /// - /// 股票ID - /// 当前价格 - public async Task GetCurrentStockPriceAsync(Guid stockId) - { - // 获取最新的价格记录 - var latestPriceRecord = await _stockPriceRecordRepository._DbQueryable - .Where(p => p.StockId == stockId) - .Where(x=>x.RecordTime<=DateTime.Now) - .OrderByDescending(p => p.RecordTime) - .FirstAsync(); - - if (latestPriceRecord == null) - { - throw new UserFriendlyException("无法获取股票价格信息"); - } - - return latestPriceRecord.CurrentPrice; - } - - /// - /// 计算交易手续费 - /// - /// 交易金额 - /// 交易类型 - /// 手续费 - private decimal CalculateTradingFee(decimal amount, TransactionTypeEnum transactionType) - { - // 买入不收手续费,卖出收2% - decimal feeRate = transactionType == TransactionTypeEnum.Buy ? 0m : 0.02m; - return amount * feeRate; - } - - /// - /// 验证卖出时间 - /// - /// 如果不在允许卖出的时间范围内 - private void VerifySellTime() - { - // 如果是开发环境,跳过验证 - if (_hostEnvironment.IsDevelopment()) - { - return; - } - - DateTime now = DateTime.Now; - - // 检查是否为工作日(周一到周五) - if (now.DayOfWeek == DayOfWeek.Saturday || now.DayOfWeek == DayOfWeek.Sunday) - { - throw new UserFriendlyException("股票只能在工作日(周一至周五)卖出"); - } - - // 检查是否在下午5点到6点之间 - if (now.Hour < 17 || now.Hour >= 18) - { - throw new UserFriendlyException("股票只能在下午5点到6点之间卖出"); - } - } - - - /// - /// 批量保存多个股票的最新价格记录 - /// - /// 价格记录列表 - /// 保存的记录数量 - public async Task BatchSaveStockPriceRecordsAsync(List priceRecords) - { - if (priceRecords == null || !priceRecords.Any()) - { - return; - } - - // 验证数据 - for (int i = 0; i < priceRecords.Count; i++) - { - var record = priceRecords[i]; - if (record.CurrentPrice <= 0) - { - throw new UserFriendlyException($"股票ID {record.StockId} 的价格必须大于0"); - } - - // 计算交易额(如果未设置) - if (record.Turnover == 0 && record.Volume > 0) - { - record.Turnover = record.CurrentPrice * record.Volume; - } - } - - await _stockPriceRecordRepository.InsertManyAsync(priceRecords); - } - - public async Task SaveStockAsync(List stockModels) - { - if (stockModels == null || !stockModels.Any()) - { - return; - } - - // 收集所有股票ID - var stockIds = stockModels.Select(m => m.Id).ToList(); - - // 一次性查询所有相关股票信息 - var stockMarkets = await _stockMarketRepository.GetListAsync(s => stockIds.Contains(s.Id)); - - // 构建字典以便快速查找 - var stockMarketsDict = stockMarkets.ToDictionary(s => s.Id); - - // 将StockModel转换为StockPriceRecordEntity - var priceRecords = new List(); - - // 获取当前小时的起始时间点 - var currentHour = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, 0, 0); - - foreach (var stockModel in stockModels) - { - if (stockModel.Values == null || !stockModel.Values.Any()) - { - continue; - } - - // 从字典中查找股票信息,而不是每次查询数据库 - if (!stockMarketsDict.TryGetValue(stockModel.Id, out var stockMarket)) - { - continue; - } - - // 为每个价格点创建一个记录,并设置递增的时间 - for (int i = 0; i < stockModel.Values.Count(); i++) - { - var priceValue = stockModel.Values[i]; - var recordTime = currentHour.AddHours(i); // 从当前小时开始,每个价格点加1小时 - - var priceRecord = new StockPriceRecordEntity - { - StockId = stockMarket.Id, - CurrentPrice = priceValue, - Volume = 0, // 可以根据实际情况设置 - Turnover = 0, // 可以根据实际情况设置 - PeriodType = PeriodTypeEnum.Hour, - RecordTime = recordTime // 直接在这里设置时间 - }; - - priceRecords.Add(priceRecord); - } - } - - // 批量保存价格记录 - if (priceRecords.Any()) - { - await _stockPriceRecordRepository.InsertManyAsync(priceRecords); - } - } - - /// - /// 获取所有活跃股票的最新价格 - /// - /// 股票ID和最新价格的字典 - private async Task> GetLatestStockPricesAsync() - { - // 获取所有活跃的股票 - var activeStocks = await _stockMarketRepository.GetListAsync(s => s.State && !s.IsDeleted); - var result = new Dictionary(); - - foreach (var stock in activeStocks) - { - try - { - var price = await GetCurrentStockPriceAsync(stock.Id); - result.Add(stock.Id, price); - } - catch - { - // 如果获取价格失败,使用默认价格10 - result.Add(stock.Id, 10m); - } - } - - return result; - } - - /// - /// 生成最新股票记录 - /// - /// - public async Task GenerateStocksAsync() - { - // 获取所有活跃股票的最新价格 - var stockPrices = await GetLatestStockPricesAsync(); - if (!stockPrices.Any()) - { - return; // 没有股票数据,直接返回 - } - - // 获取所有活跃股票信息,用于构建提示词 - var activeStocks = await _stockMarketRepository.GetListAsync(s => - s.State && !s.IsDeleted && stockPrices.Keys.Contains(s.Id)); - - // 获取最近10条新闻 - var recentNews = await _newsManager.GetRecentNewsAsync(10); - - // 构建新闻上下文 - var newsContext = new StringBuilder(); - if (recentNews.Any()) - { - newsContext.AppendLine("以下是最近的新闻摘要:"); - foreach (var news in recentNews) - { - newsContext.AppendLine($"- {news.CreationTime:yyyy-MM-dd}: {news.Title}"); - newsContext.AppendLine($" {news.Summary}"); - newsContext.AppendLine(); - } - } - else - { - newsContext.AppendLine("最近没有重要新闻报道。"); - } - - // 构建股票信息上下文 - var stocksContext = new StringBuilder(); - stocksContext.AppendLine("以下是需要预测的股票信息:"); - foreach (var stock in activeStocks) - { - if (stockPrices.TryGetValue(stock.Id, out var price)) - { - stocksContext.AppendLine($"{stock.MarketName}:id:{stock.Id},简介:{stock.Description} 最后一次价格:{price:F2}"); - } - } - - // 从文件读取问题模板 - string promptTemplate = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "wwwroot", "stock", "marketPrompt.txt")); - - // 替换变量 - string question = promptTemplate - .Replace("{{newsContext}}", newsContext.ToString()) - .Replace("{{stocksContext}}", stocksContext.ToString()); - - await _skClient.ChatCompletionAsync(question, ("StockPlugins", "save_stocks")); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Yi.Framework.Stock.Domain.csproj b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Yi.Framework.Stock.Domain.csproj deleted file mode 100644 index 55c6a318..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/Yi.Framework.Stock.Domain.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/YiFrameworkStockDomainModule.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/YiFrameworkStockDomainModule.cs deleted file mode 100644 index 35820783..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.Domain/YiFrameworkStockDomainModule.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.SemanticKernel; -using Volo.Abp.Caching; -using Volo.Abp.Domain; -using Yi.Framework.Mapster; -using Yi.Framework.Stock.Domain.Managers; -using Yi.Framework.Stock.Domain.Managers.SemanticKernel; -using Yi.Framework.Stock.Domain.Managers.SemanticKernel.Plugins; -using Yi.Framework.Stock.Domain.Shared; - -namespace Yi.Framework.Stock.Domain -{ - [DependsOn( - typeof(YiFrameworkStockDomainSharedModule), - typeof(YiFrameworkMapsterModule), - typeof(AbpDddDomainModule), - typeof(AbpCachingModule) - )] - public class YiFrameworkStockDomainModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - var services = context.Services; - - // 配置绑定 - var semanticKernelSection = configuration.GetSection("SemanticKernel"); - services.Configure(configuration.GetSection("SemanticKernel")); - - services.AddHttpClient(); -#pragma warning disable SKEXP0010 - // 从配置中获取值 - var options = semanticKernelSection.Get(); - //股市优先使用第一个ai模型 - services.AddKernel() - .AddOpenAIChatCompletion( - modelId: options.ModelIds.FirstOrDefault(), - endpoint: new Uri(options.Endpoint), - apiKey: options.ApiKey); -#pragma warning restore SKEXP0010 - - // 添加插件 - services.AddSingleton(sp => KernelPluginFactory.CreateFromType(serviceProvider: sp)); - services.AddSingleton(sp => KernelPluginFactory.CreateFromType(serviceProvider: sp)); - - // 注册NewsManager - services.AddTransient(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.SqlSugarCore/Yi.Framework.Stock.SqlSugarCore.csproj b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.SqlSugarCore/Yi.Framework.Stock.SqlSugarCore.csproj deleted file mode 100644 index e6030e96..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.SqlSugarCore/Yi.Framework.Stock.SqlSugarCore.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.SqlSugarCore/YiFrameworkStockSqlSugarCoreModule.cs b/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.SqlSugarCore/YiFrameworkStockSqlSugarCoreModule.cs deleted file mode 100644 index 071a9325..00000000 --- a/Yi.Abp.Net8/module/ai-stock/Yi.Framework.Stock.SqlSugarCore/YiFrameworkStockSqlSugarCoreModule.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Yi.Framework.Stock.Domain; -using Yi.Framework.AuditLogging.SqlSugarCore; -using Yi.Framework.Mapster; -using Yi.Framework.Rbac.SqlSugarCore; -using Yi.Framework.SettingManagement.SqlSugarCore; -using Yi.Framework.SqlSugarCore; -using Yi.Framework.TenantManagement.SqlSugarCore; - -namespace Yi.Framework.Stock.SqlsugarCore -{ - [DependsOn( - typeof(YiFrameworkStockDomainModule), - - typeof(YiFrameworkRbacSqlSugarCoreModule), - - typeof(YiFrameworkSettingManagementSqlSugarCoreModule), - typeof(YiFrameworkAuditLoggingSqlSugarCoreModule), - typeof(YiFrameworkTenantManagementSqlSugarCoreModule), - typeof(YiFrameworkMapsterModule), - typeof(YiFrameworkSqlSugarCoreModule) - )] - public class YiFrameworkStockSqlSugarCoreModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - //默认不开放,可根据项目需要是否Db直接对外开放 - //context.Services.AddTransient(x => x.GetRequiredService().SqlSugarClient); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/AccessLog/AccessLogDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/AccessLog/AccessLogDto.cs deleted file mode 100644 index 0ff1db50..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/AccessLog/AccessLogDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.AccessLog -{ - public class AccessLogDto - { - public long Number { get; set; } - public DateTime? LastModificationTime { get; set; } - public DateTime CreationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/BaseAnalyseTopUserDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/BaseAnalyseTopUserDto.cs deleted file mode 100644 index 48386106..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/BaseAnalyseTopUserDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse; - -/// -/// 用户排行榜 -/// -public class BaseAnalyseTopUserDto -{ - public Guid UserId { get; set; } - public string UserName { get; set; } - public string? Nick { get; set; } - public int Order { get; set; } - public string? Icon { get; set; } - public int Level { get; set; } - /// - /// 用户等级名称 - /// - public string LevelName { get; set; } - /// - /// 用户限制 - /// - public UserLimitEnum UserLimit { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/MoneyTopUserDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/MoneyTopUserDto.cs deleted file mode 100644 index 23781369..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/MoneyTopUserDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse; - -public class MoneyTopUserDto:BaseAnalyseTopUserDto -{ - public decimal Money { get; set; } - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/PointsTopUserDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/PointsTopUserDto.cs deleted file mode 100644 index 573c69aa..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/PointsTopUserDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse; - -public class PointsTopUserDto:BaseAnalyseTopUserDto -{ - public int Points { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/RegisterAnalyseDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/RegisterAnalyseDto.cs deleted file mode 100644 index baa88cac..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/RegisterAnalyseDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse; - -public class RegisterAnalyseDto -{ - public RegisterAnalyseDto(DateTime time, int number) - { - Time = time; - Number = number; - } - - /// - /// 时间 - /// - public DateTime Time { get; set; } - - /// - /// 人数 - /// - public int Number { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/ValueTopUserDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/ValueTopUserDto.cs deleted file mode 100644 index 01ef7681..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Analyse/ValueTopUserDto.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse; - -public class ValueTopUserDto:BaseAnalyseTopUserDto -{ - public decimal Value { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Argee/AgreeDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Argee/AgreeDto.cs deleted file mode 100644 index 6b9f8815..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Argee/AgreeDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Argee -{ - public class AgreeDto - { - public AgreeDto(bool isAgree) - { - IsAgree = isAgree; - if (isAgree) - { - - Message = "点赞成功,点赞+1"; - } - else - { - - Message = "取消点赞,点赞-1"; - } - - } - - public bool IsAgree { get; set; } - public string Message { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleAllOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleAllOutputDto.cs deleted file mode 100644 index 454cf0e7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleAllOutputDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article -{ - public class ArticleAllOutputDto : EntityDto - { - - //批量查询,不给内容,性能考虑 - //public string Content { get; set; } - public string Name { get; set; } - public Guid DiscussId { get; set; } - public Guid ParentId { get; set; } - - public List? Children { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleCreateInputVo.cs deleted file mode 100644 index 0258a37b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleCreateInputVo.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article -{ - /// - /// Article输入创建对象 - /// - public class ArticleCreateInputVo - { - public string Content { get; set; } - public string Name { get; set; } - public Guid DiscussId { get; set; } - public Guid ParentId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListInputVo.cs deleted file mode 100644 index b10278a1..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListInputVo.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article -{ - public class ArticleGetListInputVo : PagedAllResultRequestDto - { - public string? Content { get; set; } - public string? Name { get; set; } - public Guid? DiscussId { get; set; } - public Guid? ParentId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListOutputDto.cs deleted file mode 100644 index 01c347c1..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetListOutputDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article -{ - public class ArticleGetListOutputDto : EntityDto - { - public string Name { get; set; } - public Guid DiscussId { get; set; } - - public List? Children { get; set; } - - public DateTime CreationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetOutputDto.cs deleted file mode 100644 index b76fa472..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleGetOutputDto.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Domain.Shared.Consts; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article -{ - public class ArticleGetOutputDto : EntityDto - { - public string Content { get; set; } - public string Name { get; set; } - public Guid DiscussId { get; set; } - public Guid ParentId { get; set; } - - public DateTime CreationTime { get; set; } - - public bool HasPermission { get;internal set; } - - /// - /// 设置权限 - /// - public void SetPassPermission() - { - HasPermission = true; - } - /// - /// 设置无权限 - /// - public void SetNoPermission() - { - HasPermission = false; - Content=DiscussConst.Privacy; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleImprotDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleImprotDto.cs deleted file mode 100644 index 9adb2ac5..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleImprotDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article -{ - public class ArticleImprotDto - { - /// - /// 主题id - /// - [Required] - public Guid DiscussId { get; set; } - - public Guid ArticleParentId { get; set; }= Guid.Empty; - - public ArticleImportTypeEnum ImportType { get; set; } = ArticleImportTypeEnum.Default; -} -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleUpdateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleUpdateInputVo.cs deleted file mode 100644 index 0e6f6ed0..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Article/ArticleUpdateInputVo.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article -{ - public class ArticleUpdateInputVo - { - public string Content { get; set; } - public string Name { get; set; } - public Guid DiscussId { get; set; } - public Guid ParentId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentDefineGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentDefineGetListOutputDto.cs deleted file mode 100644 index f651300c..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentDefineGetListOutputDto.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Assignment; - -public class AssignmentDefineGetListOutputDto : EntityDto -{ - /// - /// 任务名称 - /// - public string Name { get; set; } - - /// - /// 备注 - /// - public string Remarks { get; set; } - - /// - /// 任务类型 - /// - public AssignmentTypeEnum AssignmentType { get; set; } - - /// - /// 任务需求类型 - /// - public AssignmentRequirementTypeEnum AssignmentRequirementType{ get; set; } - - /// - /// 总共步骤数 - /// - public int TotalStepNumber { get; set; } - - /// - /// 前置任务id - /// - public Guid? PreAssignmentId { get; set; } - - /// - /// 任务奖励的钱钱数量 - /// - public decimal RewardsMoneyNumber { get; set; } - - public int OrderNum { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentGetListInput.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentGetListInput.cs deleted file mode 100644 index af308e36..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentGetListInput.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Assignment; - -public class AssignmentGetListInput -{ - /// - /// 任务查询条件 - /// - public AssignmentQueryStateEnum AssignmentQueryState { get; set; } = AssignmentQueryStateEnum.Progress; -} - -public enum AssignmentQueryStateEnum -{ - /// - /// 正在进行 - /// - Progress, - - /// - /// 已结束 - /// - End -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentGetListOutputDto.cs deleted file mode 100644 index cdd7baf1..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Assignment/AssignmentGetListOutputDto.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Assignment; - -public class AssignmentGetListOutputDto:EntityDto -{ - /// - /// 任务名称 - /// - public string Name { get; set; } - - /// - /// 备注 - /// - public string Remarks { get; set; } - /// - /// 当前步骤数 - /// - public int CurrentStepNumber { get; set; } - - /// - /// 总共步骤数 - /// - public int TotalStepNumber { get; set; } - /// - /// 任务类型 - /// - public AssignmentTypeEnum AssignmentType { get; set; } - - /// - /// 任务需求类型 - /// - public AssignmentRequirementTypeEnum AssignmentRequirementType{ get; set; } - /// - /// 任务状态 - /// - public AssignmentStateEnum AssignmentState { get; set; } - - /// - /// 任务奖励的钱钱数量 - /// - public decimal RewardsMoneyNumber { get; set; } - /// - /// 任务过期时间 - /// - public DateTime? ExpireTime { get; set; } - - public DateTime? CompleteTime { get; set; } - - - public DateTime CreationTime { get; set; } - public int OrderNum { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Bank/BankCardDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Bank/BankCardDto.cs deleted file mode 100644 index 82e5df09..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Bank/BankCardDto.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Bank -{ - public class BankCardDto:EntityDto - { - /// - /// 满期限时间,可空 - /// - public DateTime? FulltermTime { get; set; } - public DateTime? LastDepositTime { get; set; } - public DateTime CreationTime { get; set; } - - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 当前存储的钱 - /// - public decimal StorageMoney { get; set; } - - - /// - /// 最大可存储的钱钱 - /// - public decimal MaxStorageMoney { get; set; } - - - - /// - /// 银行卡状态 - /// - public BankCardStateEnum BankCardState { get; set; } = BankCardStateEnum.Unused; - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Bank/InterestRecordsDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Bank/InterestRecordsDto.cs deleted file mode 100644 index c27d5554..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Bank/InterestRecordsDto.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Bank -{ - public class InterestRecordsDto : EntityDto - { - public DateTime CreationTime { get; set; } - - /// - /// 当前汇率值 - /// - public decimal Value { get; set; } - - /// - /// 是否波动期 - /// - public bool IsFluctuate { get; set; } - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerCreateInputVo.cs deleted file mode 100644 index b0e429b8..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerCreateInputVo.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner -{ - /// - /// Banner输入创建对象 - /// - public class BannerCreateInputVo - { - public string Name { get; set; } - public string? Logo { get; set; } - public string? Color { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetListInputVo.cs deleted file mode 100644 index 5e496646..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetListInputVo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner -{ - public class BannerGetListInputVo : PagedAndSortedResultRequestDto - { - public string? Name { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetListOutputDto.cs deleted file mode 100644 index a44287af..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetListOutputDto.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner -{ - public class BannerGetListOutputDto : EntityDto - { - public string Name { get; set; } - public string? Logo { get; set; } - public string? Color { get; set; } - - public DateTime CreationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetOutputDto.cs deleted file mode 100644 index c31e1861..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerGetOutputDto.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner -{ - public class BannerGetOutputDto : EntityDto - { - public string Name { get; set; } - public string? Logo { get; set; } - public string? Color { get; set; } - - public DateTime CreationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerUpdateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerUpdateInputVo.cs deleted file mode 100644 index 369bc283..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Banner/BannerUpdateInputVo.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner -{ - public class BannerUpdateInputVo - { - public string? Name { get; set; } - public string? Logo { get; set; } - public string? Color { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserAnalyseGetOutput.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserAnalyseGetOutput.cs deleted file mode 100644 index 34edba67..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserAnalyseGetOutput.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser -{ - public class BbsUserAnalyseGetOutput - { - /// - /// 注册人数 - /// - public long RegisterNumber { get; set; } - - - /// - /// 在线人数 - /// - public long OnlineNumber { get; set; } - - /// - /// 昨天新增用户 - /// - public long YesterdayNewUser { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserGetListOutputDto.cs deleted file mode 100644 index 52018463..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserGetListOutputDto.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Rbac.Application.Contracts.Dtos.User; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser -{ - public class BbsUserGetListOutputDto: UserGetListOutputDto - { - /// - /// 用户等级 - /// - public int Level { get; set; } - - /// - /// 用户限制 - /// - public UserLimitEnum UserLimit { get; set; } - - /// - /// 钱钱 - /// - public decimal Money { get; set; } - - - /// - /// 经验 - /// - public long Experience { get; set; } - - /// - /// 用户等级名称 - /// - public string LevelName { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserGetOutputDto.cs deleted file mode 100644 index cce27810..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/BbsUser/BbsUserGetOutputDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Rbac.Application.Contracts.Dtos.User; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser -{ - public class BbsUserGetOutputDto: UserGetOutputDto - { - /// - /// 用户等级 - /// - public int Level { get; set; } - - /// - /// 用户限制 - /// - public UserLimitEnum UserLimit { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentCreateInputVo.cs deleted file mode 100644 index 6cc4abb1..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentCreateInputVo.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment -{ - /// - /// Comment输入创建对象 - /// - public class CommentCreateInputVo - { - - /// - /// 评论id - /// - public string? Content { get; set; } - - /// - /// 主题id - /// - public Guid DiscussId { get; set; } - - /// - /// 第一层评论id,第一层为0 - /// - public Guid RootId { get; set; } - - /// - /// 被回复的CommentId,第一层为0 - /// - public Guid ParentId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetListInputVo.cs deleted file mode 100644 index 14920c8e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetListInputVo.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment -{ - public class CommentGetListInputVo - { - public DateTime? creationTime { get; set; } - public string? Content { get; set; } - - //ӦѡĪѯ - public Guid? DiscussId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetListOutputDto.cs deleted file mode 100644 index fc7b23a3..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetListOutputDto.cs +++ /dev/null @@ -1,49 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Rbac.Application.Contracts.Dtos.User; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment -{ - /// - /// ۶෴ - /// - public class CommentGetListOutputDto : EntityDto - { - - public DateTime? CreationTime { get; set; } - - - - - public string Content { get; set; } - - - /// - /// id - /// - public Guid DiscussId { get; set; } - - public Guid ParentId { get; set; } - - public Guid RootId { get; set; } - - /// - /// û,ûϢ - /// - public BbsUserGetOutputDto CreateUser { get; set; } - - - public Guid? CreatorId { get; set; } - - /// - /// ۵ûϢ - /// - public BbsUserGetOutputDto CommentedUser { get; set; } - - - /// - /// һΣǴһά飬Childrenֻڶʱֻһ - /// - public List Children { get; set; } = new List(); - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetOutputDto.cs deleted file mode 100644 index cd348c86..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentGetOutputDto.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Rbac.Application.Contracts.Dtos.User; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment -{ - /// - /// أصۼ - /// - public class CommentGetOutputDto : EntityDto - { - - public DateTime? CreateTime { get; set; } - public string Content { get; set; } - - public Guid DiscussId { get; set; } - - - /// - /// ûidΪû - /// - - public BbsUserGetOutputDto User { get; set; } - /// - /// ڵid - /// - public Guid RootId { get; set; } - - /// - /// ظCommentId - /// - public Guid ParentId { get; set; } - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentUpdateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentUpdateInputVo.cs deleted file mode 100644 index 02d7fb44..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Comment/CommentUpdateInputVo.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment -{ - public class CommentUpdateInputVo - { - - public string Content { get; set; } - - //²ܽת - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussCreateInput.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussCreateInput.cs deleted file mode 100644 index 2834c938..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussCreateInput.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss -{ - /// - /// Discuss输入创建对象 - /// - public class DiscussCreateInput - { - public DiscussTypeEnum DiscussType { get; set; } - - public string Title { get; set; } - public string? Types { get; set; } - public string? Introduction { get; set; } - public DateTime? CreateTime { get; set; } = DateTime.Now; - public string Content { get; set; } - public string? Color { get; set; } - - public Guid PlateId { get; set; } - - /// - /// 默认公开 - /// - public DiscussPermissionTypeEnum PermissionType { get; set; } = DiscussPermissionTypeEnum.Public; - /// - /// 封面 - /// - public string? Cover { get; set; } - - public int OrderNum { get; set; } = 0; - - /// - /// 是否禁止评论创建功能 - /// - public bool IsDisableCreateComment { get; set; } - - /// - /// 标签 - /// - public List? DiscussLableIds { get; set; } - - /// - /// 角色 - /// - public List? PermissionRoleCodes { get; set; } = new List(); - - /// - /// 悬赏类型主题 - /// - public DiscussRewardCreateInput? RewardData { get; set; } - } - - - public class DiscussRewardCreateInput - { - /// - /// 悬赏最小价值 - /// - public decimal MinValue { get; set; } - - /// - /// 悬赏最大价值 - /// - public decimal? MaxValue { get; set; } - - /// - /// 作者联系方式 - /// - public string Contact { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetListInputVo.cs deleted file mode 100644 index 9c93e93d..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetListInputVo.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss -{ - public class DiscussGetListInputVo : PagedAndSortedResultRequestDto - { - /// - /// 创建者的用户名 - /// - public string? UserName { get; set; } - public Guid? UserId { get; set; } - - public string? Title { get; set; } - - public Guid? PlateId { get; set; } - - //默认查询非置顶 - public bool? IsTop { get; set; } - - - //查询方式 - public QueryDiscussTypeEnum Type { get; set; } = QueryDiscussTypeEnum.New; - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetListOutputDto.cs deleted file mode 100644 index 8678f9a2..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetListOutputDto.cs +++ /dev/null @@ -1,58 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Bbs.Application.Contracts.Dtos.DiscussLable; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Rbac.Application.Contracts.Dtos.User; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss -{ - public class DiscussGetListOutputDto : EntityDto - { - /// - /// 是否禁止评论创建功能 - /// - public bool IsDisableCreateComment { get; set; } - /// - /// 是否已点赞,默认未登录不点赞 - /// - public bool IsAgree { get; set; } = false; - public string Title { get; set; } - public string? Introduction { get; set; } - - public int AgreeNum { get; set; } - public int SeeNum { get; set; } - - //批量查询,不给内容,性能考虑 - //public string Content { get; set; } - public string? Color { get; set; } - - public Guid PlateId { get; set; } - - //是否置顶,默认false - public bool IsTop { get; set; } - - public DiscussTypeEnum DiscussType { get; set; } - - public DiscussPermissionTypeEnum PermissionType { get; set; } - //是否禁止,默认false - public bool IsBan { get; set; } - - - /// - /// 封面 - /// - public string? Cover { get; set; } - - public DateTime CreationTime { get; set; } - - /// - /// 所需角色 - /// - public List? PermissionRoleCodes { get; set; } = new List(); - - public BbsUserGetListOutputDto User { get; set; } - public List? DiscussLableIds { get; set; } = new List(); - public List Lables { get; set; } = new List(); - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetOutputDto.cs deleted file mode 100644 index ab36be8b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussGetOutputDto.cs +++ /dev/null @@ -1,73 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Bbs.Application.Contracts.Dtos.DiscussLable; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Rbac.Application.Contracts.Dtos.User; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss -{ - public class DiscussGetOutputDto : EntityDto - { - /// - /// 是否禁止评论创建功能 - /// - public bool IsDisableCreateComment { get; set; } - public string Title { get; set; } - public string? Introduction { get; set; } - public int AgreeNum { get; set; } - public int SeeNum { get; set; } - public string Content { get; set; } - public string? Color { get; set; } - - public Guid PlateId { get; set; } - //是否置顶,默认false - public bool IsTop { get; set; } - /// - /// 主题类型 - /// - public DiscussTypeEnum DiscussType { get; set; } - /// - /// 封面 - /// - public string? Cover { get; set; } - //是否私有,默认false - public bool IsPrivate { get; set; } - - //私有需要判断code权限 - public string? PrivateCode { get; set; } - public DateTime CreationTime { get; set; } - public DiscussPermissionTypeEnum PermissionType { get; set; } - public bool IsAgree { get; set; } = false; - public List PermissionRoleCodes { get; set; } = new List(); - - - - public BbsUserGetListOutputDto User { get; set; } - - public PlateGetOutputDto Plate { get; set; } - - public List? DiscussLableIds { get; set; } = new List(); - public List Lables { get; set; } =new List(); - - public bool HasPermission { get;internal set; } - - public DiscussRewardGetOutputDto? RewardData { get; set; } - /// - /// 设置权限 - /// - public void SetPassPermission() - { - HasPermission = true; - } - /// - /// 设置无权限 - /// - public void SetNoPermission() - { - HasPermission = false; - Content=DiscussConst.Privacy; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussRewardGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussRewardGetOutputDto.cs deleted file mode 100644 index ed49f831..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussRewardGetOutputDto.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss; - -public class DiscussRewardGetOutputDto -{ - /// - /// 是否已解决 - /// - public bool IsResolved{ get; set; } - /// - /// 悬赏最小价值 - /// - public decimal MinValue { get; set; } - - /// - /// 悬赏最大价值 - /// - public decimal? MaxValue { get; set; } - - /// - /// 作者联系方式 - /// - public string Contact { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussUpdateInput.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussUpdateInput.cs deleted file mode 100644 index 628d331b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Discuss/DiscussUpdateInput.cs +++ /dev/null @@ -1,39 +0,0 @@ -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss -{ - public class DiscussUpdateInput - { - public string Title { get; set; } - public string? Types { get; set; } - public string? Introduction { get; set; } - public string Content { get; set; } - public string? Color { get; set; } - - public List? PermissionUserIds { get; set; } - - public DiscussPermissionTypeEnum PermissionType { get; set; } - - /// - /// 封面 - /// - public string? Cover { get; set; } - - public int OrderNum { get; set; } - - /// - /// 是否禁止评论创建功能 - /// - public bool IsDisableCreateComment { get; set; } - - /// - /// 标签 - /// - public List? DiscussLableIds { get; set; } - - /// - /// 需求角色 - /// - public List? PermissionRoleCodes { get; set; } = new List(); - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/DiscussLable/DiscussLableGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/DiscussLable/DiscussLableGetOutputDto.cs deleted file mode 100644 index 40ebe4c7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/DiscussLable/DiscussLableGetOutputDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.DiscussLable; - -public class DiscussLableGetOutputDto:EntityDto -{ - public Guid Id { get; set; } - public string Name { get; set; } - public string? Color { get; set; } - public string? BackgroundColor { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Integral/SignInDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Integral/SignInDto.cs deleted file mode 100644 index 6923cf99..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Integral/SignInDto.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Integral -{ - public class SignInDto - { - /// - /// 签到数据 - /// - public List SignInItem { get; set; }=new List(); - - /// - /// 当前连续签到次数 - /// - public int CurrentContinuousNumber { get; set; } - } - - - public class SignInItemDto : EntityDto - { - /// - /// 签到时间 - /// - public DateTime CreationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelGetListInputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelGetListInputDto.cs deleted file mode 100644 index 76a7ee49..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelGetListInputDto.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Level -{ - public class LevelGetListInputDto:PagedResultRequestDto - { /// - /// 当前等级 - /// - public int? MinLevel { get; set; } - - /// - /// 等级名称 - /// - public string? Name { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelOutputDto.cs deleted file mode 100644 index f6584fa9..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Level/LevelOutputDto.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Level -{ - public class LevelOutputDto : EntityDto - { - public Guid Id { get; set; } - - /// - /// 当前等级 - /// - public int CurrentLevel { get; set; } - - /// - /// 最小所需经验值 - /// - public decimal MinExperience { get; set; } - - /// - /// 等级名称 - /// - public string Name { get; set; } - - /// - /// 等级称号 - /// - public string? Nick { get; set; } - - /// - /// 等候logo - /// - public string? Logo { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableCreateInputVo.cs deleted file mode 100644 index 872bbd34..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableCreateInputVo.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType -{ - /// - /// Label输入创建对象 - /// - public class DiscussLableCreateInputVo - { - public string Name { get; set; } - public string? Color { get; set; } - public string? BackgroundColor { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListInputVo.cs deleted file mode 100644 index ef8ba68a..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListInputVo.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType -{ - public class DiscussLableGetListInputVo : PagedAndSortedResultRequestDto - { - public string? Name { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListOutputDto.cs deleted file mode 100644 index 2f15e1e1..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableGetListOutputDto.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType -{ - public class DiscussLableGetListOutputDto : EntityDto - { - public string Name { get; set; } - public string? Color { get; set; } - public string? BackgroundColor { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableOutputDto.cs deleted file mode 100644 index fe34703e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableOutputDto.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType -{ - public class DiscussLableOutputDto : EntityDto - { - public string Name { get; set; } - public string? Color { get; set; } - public string? BackgroundColor { get; set; } - public Guid UserId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableUpdateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableUpdateInputVo.cs deleted file mode 100644 index b91b6d41..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/MyType/DiscussLableUpdateInputVo.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType -{ - public class DiscussLableUpdateInputVo - { - public string Name { get; set; } - public string? Color { get; set; } - public string? BackgroundColor { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListInputVo.cs deleted file mode 100644 index 866dcbbc..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListInputVo.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Application.Dtos; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Notice -{ - public class BbsNoticeGetListInputVo:PagedAllResultRequestDto - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs deleted file mode 100644 index fe3aea20..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Notice/BbsNoticeGetListOutputDto.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Notice -{ - public class BbsNoticeGetListOutputDto - { - /// - /// 消息,支持html - /// - public string Message { get; set; } - - /// - /// 消息类型 - /// - public NoticeTypeEnum NoticeType { get; } - - /// - /// 是否已读 - /// - public bool IsRead { get; private set; } - - /// - /// 已读时间 - /// - public DateTime? ReadTime { get; private set; } - - /// - /// 消息创建时间 - /// - public DateTime CreationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateCreateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateCreateInputVo.cs deleted file mode 100644 index e2855ab4..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateCreateInputVo.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate -{ - /// - /// Plate输入创建对象 - /// - public class PlateCreateInputVo - { - public string Name { get; set; } - public string? Logo { get; set; } - public string? Introduction { get; set; } - - public string Code { get; set; } - - public int OrderNum { get; set; } - - public bool IsDisableCreateDiscuss { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListInputVo.cs deleted file mode 100644 index b424154c..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListInputVo.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate -{ - public class PlateGetListInputVo : PagedAllResultRequestDto - { - public string? Name { get; set; } - public string? Code { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListOutputDto.cs deleted file mode 100644 index a0ae195c..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetListOutputDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate -{ - public class PlateGetListOutputDto : EntityDto - { - - public string Name { get; set; } - public string? Logo { get; set; } - public string? Introduction { get; set; } - - public string Code { get; set; } - - public DateTime CreationTime { get; set; } - - public int OrderNum { get; set; } - public bool IsDisableCreateDiscuss { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetOutputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetOutputDto.cs deleted file mode 100644 index d5d71cb9..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateGetOutputDto.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate -{ - public class PlateGetOutputDto : EntityDto - { - public string Name { get; set; } - public string? Logo { get; set; } - public string? Introduction { get; set; } - public string Code { get; set; } - - public DateTime CreationTime { get; set; } - - public int OrderNum { get; set; } - public bool IsDisableCreateDiscuss { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateUpdateInputVo.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateUpdateInputVo.cs deleted file mode 100644 index 52603146..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Plate/PlateUpdateInputVo.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate -{ - public class PlateUpdateInputVo - { - public string? Name { get; set; } - public string? Logo { get; set; } - public string? Introduction { get; set; } - - public string? Code { get; set; } - - public int OrderNum { get; set; } - - - public bool IsDisableCreateDiscuss { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/BbsShopAccountDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/BbsShopAccountDto.cs deleted file mode 100644 index 56e7575e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/BbsShopAccountDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Shop; - -public class BbsShopAccountDto -{ - /// - /// 钱钱 - /// - public decimal Money { get; set; } - - /// - /// 积分 - /// - public int Points { get; set; } - - /// - /// 价值 - /// - public decimal Value { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/BuyShopInputDto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/BuyShopInputDto.cs deleted file mode 100644 index 321e23a4..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/BuyShopInputDto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Shop; - -public class BuyShopInputDto -{ - public Guid GoodsId { get; set; } - public string ContactInformation { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/ShopGetListOutput.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/ShopGetListOutput.cs deleted file mode 100644 index 9401c085..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Dtos/Shop/ShopGetListOutput.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Shop; - -public class ShopGetListOutput:EntityDto -{ - /// - /// 上架时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 商品类型 - /// - public GoodsTypeEnum GoodsType{ get; set; } - - /// - /// 下架时间 - /// - public DateTime? EndTime { get; set; } - - /// - /// 商品名称 - /// - public string Name { get; set; } - - /// - /// 每人限购数量 - /// - public int LimitNumber { get; set; } - - /// - /// 当前库存数量 - /// - public int StockNumber { get; set; } - - /// - /// 商品图片url - /// - public string ImageUrl { get; set; } - - /// - /// 描述 - /// - public string Describe { get; set; } - - /// - /// 编号 - /// - public string Code { get; set; } - - /// - /// 所需钱钱 - /// - public decimal NeedMoney { get; set; } - - /// - /// 所需价值 - /// - public decimal NeedValue { get; set; } - - /// - /// 所需积分 - /// - public decimal NeedPoints { get; set; } - - public int OrderNum { get; set; } - - /// - /// 是否已限制 - /// - public bool IsLimit { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IAccessLogService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IAccessLogService.cs deleted file mode 100644 index 09af4933..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IAccessLogService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - public interface IAccessLogService - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IArticleService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IArticleService.cs deleted file mode 100644 index 04a8bddd..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IArticleService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Yi.Framework.Bbs.Application.Contracts.Dtos.Article; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - /// - /// Article服务抽象 - /// - public interface IArticleService : IYiCrudAppService - { - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IBannerService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IBannerService.cs deleted file mode 100644 index 63c3d2e5..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IBannerService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - /// - /// Banner抽象 - /// - public interface IBannerService : IYiCrudAppService - { - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IBbsUserInfoService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IBbsUserInfoService.cs deleted file mode 100644 index d6a5f0c4..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IBbsUserInfoService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - public interface IBbsUserInfoService - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ICommentService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ICommentService.cs deleted file mode 100644 index c3e693c7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ICommentService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Yi.Framework.Bbs.Application.Contracts.Dtos.Comment; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - /// - /// Comment服务抽象 - /// - public interface ICommentService : IYiCrudAppService - { - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussLableService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussLableService.cs deleted file mode 100644 index 14c0e3f7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussLableService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Yi.Framework.Bbs.Application.Contracts.Dtos.MyType; -using Yi.Framework.Ddd.Application.Contracts; -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - /// - /// Label服务抽象 - /// - public interface IDiscussLableService : IYiCrudAppService - { - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussService.cs deleted file mode 100644 index 6a2a34f8..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IDiscussService.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - /// - /// Discuss服务抽象 - /// - public interface IDiscussService : IYiCrudAppService - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ILevelService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ILevelService.cs deleted file mode 100644 index 66d5b9f7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ILevelService.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Level; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - public interface ILevelService : IYiCrudAppService - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IPlateService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IPlateService.cs deleted file mode 100644 index e2a05217..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/IPlateService.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - /// - /// Plate服务抽象 - /// - public interface IPlateService : IYiCrudAppService - { - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ISettingService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ISettingService.cs deleted file mode 100644 index ba722425..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/IServices/ISettingService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Application.Services; - -namespace Yi.Framework.Bbs.Application.Contracts.IServices -{ - /// - /// Setting应用抽象 - /// - public interface ISettingService : IApplicationService - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Yi.Framework.Bbs.Application.Contracts.csproj b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Yi.Framework.Bbs.Application.Contracts.csproj deleted file mode 100644 index a4775b67..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/Yi.Framework.Bbs.Application.Contracts.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/YiFrameworkBbsApplicationContractsModule.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/YiFrameworkBbsApplicationContractsModule.cs deleted file mode 100644 index 99753575..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application.Contracts/YiFrameworkBbsApplicationContractsModule.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Volo.Abp.Modularity; -using Yi.Framework.Bbs.Domain.Shared; -using Yi.Framework.Rbac.Application.Contracts; - -namespace Yi.Framework.Bbs.Application.Contracts -{ - [DependsOn(typeof(YiFrameworkBbsDomainSharedModule), - - typeof(YiFrameworkRbacApplicationContractsModule) - )] - public class YiFrameworkBbsApplicationContractsModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Extensions/AccessLogExtensions.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Extensions/AccessLogExtensions.cs deleted file mode 100644 index 54387205..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Extensions/AccessLogExtensions.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Microsoft.AspNetCore.Builder; - -namespace Yi.Framework.Bbs.Application.Extensions; - -public static class AccessLogExtensions -{ - public static IApplicationBuilder UseAccessLog(this IApplicationBuilder app) - { - app.UseMiddleware(); - return app; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Extensions/AccessLogMiddleware.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Extensions/AccessLogMiddleware.cs deleted file mode 100644 index 24634a61..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Extensions/AccessLogMiddleware.cs +++ /dev/null @@ -1,91 +0,0 @@ -using FreeRedis; -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Options; -using Volo.Abp.Caching; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Shared.Caches; -using Yi.Framework.Bbs.Domain.Shared.Etos; - -namespace Yi.Framework.Bbs.Application.Extensions; - -/// -/// 访问日志中间件 -/// 并发最高,采用缓存,默认10分钟才会真正操作一次数据库 -/// 需考虑一致性问题,又不能上锁影响性能 -/// -public class AccessLogMiddleware : IMiddleware, ITransientDependency -{ - private static int _accessLogNumber = 0; - - internal static void ResetAccessLogNumber() - { - _accessLogNumber = 0; - } - internal static int GetAccessLogNumber() - { - return _accessLogNumber; - } - - - public async Task InvokeAsync(HttpContext context, RequestDelegate next) - { - await next(context); - - Interlocked.Increment(ref _accessLogNumber); - } -} - -public class AccessLogResetEventHandler : ILocalEventHandler, - ITransientDependency -{ - /// - /// 缓存前缀 - /// - private string CacheKeyPrefix => LazyServiceProvider.LazyGetRequiredService>() - .Value.KeyPrefix; - - /// - /// 使用懒加载防止报错 - /// - private IRedisClient RedisClient => LazyServiceProvider.LazyGetRequiredService(); - - /// - /// 属性注入 - /// - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - - private bool EnableRedisCache - { - get - { - var redisEnabled = LazyServiceProvider.LazyGetRequiredService()["Redis:IsEnabled"]; - return redisEnabled.IsNullOrEmpty() || bool.Parse(redisEnabled); - } - } - - //该事件由job定时10秒触发 - public async Task HandleEventAsync(AccessLogResetArgs eventData) - { - if (EnableRedisCache) - { - //分布式锁 - if (await RedisClient.SetNxAsync("AccessLogLock",true,TimeSpan.FromSeconds(5))) - { - //自增长数 - var incrNumber= AccessLogMiddleware.GetAccessLogNumber(); - //立即重置,开始计算,方式丢失 - AccessLogMiddleware.ResetAccessLogNumber(); - if (incrNumber>0) - { - await RedisClient.IncrByAsync( - $"{CacheKeyPrefix}{AccessLogCacheConst.Key}:{DateTime.Now.Date:yyyyMMdd}", incrNumber); - } - - - } - - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/AccessLogService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/AccessLogService.cs deleted file mode 100644 index 1c90ae40..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/AccessLogService.cs +++ /dev/null @@ -1,140 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Yi.Framework.Bbs.Application.Contracts.Dtos.AccessLog; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services -{ - public class AccessLogService : ApplicationService, IAccessLogService - { - private readonly ISqlSugarRepository _repository; - - public AccessLogService(ISqlSugarRepository repository) - { - _repository = repository; - } - - public DateTime GetWeekFirst() - { - var week = DateTime.Now.DayOfWeek; - switch (week) - { - case DayOfWeek.Sunday: - return DateTime.Now.AddDays(-6).Date; - - case DayOfWeek.Monday: - return DateTime.Now.AddDays(-0).Date; - - case DayOfWeek.Tuesday: - return DateTime.Now.AddDays(-1).Date; - - case DayOfWeek.Wednesday: - return DateTime.Now.AddDays(-2).Date; - - case DayOfWeek.Thursday: - return DateTime.Now.AddDays(-3).Date; - - case DayOfWeek.Friday: - return DateTime.Now.AddDays(-4).Date; - - case DayOfWeek.Saturday: - return DateTime.Now.AddDays(-5).Date; - - default: - throw new ArgumentException("日期错误"); - } - } - - - /// - /// 获取全部访问流量(3个月) - /// - /// - /// - public async Task> GetListAsync([FromQuery] AccessLogTypeEnum accessLogType) - { - var entities = await _repository._DbQueryable.Where(x => x.AccessLogType == accessLogType) - .Where(x => x.CreationTime >= DateTime.Now.AddMonths(-3)) - .OrderBy(x => x.CreationTime).ToListAsync(); - var output = entities.Adapt>(); - output?.ForEach(x => x.CreationTime = x.CreationTime.Date); - return output; - } - - /// - /// 首页点击触发 - /// - /// - [HttpPost("access-log")] - public async Task AccessAsync() - { - //可判断http重复,防止同一ip多次访问 - var last = await _repository._DbQueryable.Where(x=>x.AccessLogType==AccessLogTypeEnum.HomeClick).OrderByDescending(x => x.CreationTime).FirstAsync(); - - if (last is null || last.CreationTime.Date != DateTime.Today) - { - await _repository.InsertAsync(new AccessLogAggregateRoot(){AccessLogType=AccessLogTypeEnum.HomeClick}); - } - else - { - await _repository._Db.Updateable().SetColumns(it => it.Number == it.Number + 1) - .Where(it => it.Id == last.Id).ExecuteCommandAsync(); - } - } - - /// - /// 获取当前周首页点击数据 - /// - /// - public async Task GetWeekAsync([FromQuery] AccessLogTypeEnum accessLogType) - { - var lastSeven = await _repository._DbQueryable - .Where(x => x.AccessLogType == accessLogType) - .OrderByDescending(x => x.CreationTime).ToPageListAsync(1, 7); - - return WeekTimeHandler(lastSeven.ToArray()); - } - - /// - /// Todo: 可放入领域层 - /// - /// - /// - private AccessLogDto[] WeekTimeHandler(AccessLogAggregateRoot[] data) - { - data = data.Where(x => x.CreationTime >= GetWeekFirst()).OrderByDescending(x => x.CreationTime) - .DistinctBy(x => x.CreationTime.DayOfWeek).ToArray(); - - Dictionary processedData = new Dictionary(); - - // 初始化字典,将每天的数据都设为0 - foreach (DayOfWeek dayOfWeek in Enum.GetValues(typeof(DayOfWeek))) - { - processedData.Add(dayOfWeek, new AccessLogDto()); - } - - - // 处理原始数据 - foreach (var item in data) - { - DayOfWeek dayOfWeek = item.CreationTime.DayOfWeek; - // 如果当天有数据,则更新字典中的值为对应的Number - var sss = data.Adapt(); - processedData[dayOfWeek] = item.Adapt(); - } - - var result = processedData.Values.ToList(); - - //此时的时间是周日-周一-周二,需要处理 - var first = result[0]; // 获取第一个元素 - result.RemoveAt(0); // 移除第一个元素 - result.Add(first); // 将第一个元素添加到末尾 - - return result.ToArray(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsForumAnalyseService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsForumAnalyseService.cs deleted file mode 100644 index 03d91c94..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsForumAnalyseService.cs +++ /dev/null @@ -1,132 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.Rbac.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Analyses -{ - public class BbsForumAnalyseService : ApplicationService, IApplicationService - { - private ForumManager _forumManager; - private ISqlSugarRepository _agreeRepository; - public BbsForumAnalyseService(ForumManager forumManager, ISqlSugarRepository agreeRepository) - { - _forumManager = forumManager; - _agreeRepository = agreeRepository; - } - - /// - /// 推荐主题,随机返回主题列表 - /// - /// - [HttpGet("analyse/bbs-discuss/random")] - public async Task> GetRandomDiscussAsync([FromQuery] PagedResultRequestDto input) - { - var output = await _forumManager._discussRepository._DbQueryable - .Where(discuss=>discuss.PermissionType== DiscussPermissionTypeEnum.Public) - .LeftJoin((discuss, user) => discuss.CreatorId == user.Id) - .LeftJoin((discuss, user, info) => user.Id == info.UserId) - - .OrderBy(discuss => SqlFunc.GetRandom()) - .Select((discuss, user, info) => new DiscussGetListOutputDto - { - Id = discuss.Id, - // IsAgree = SqlFunc.Subqueryable().WhereIF(CurrentUser.Id != null, x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(), - - User = new BbsUserGetListOutputDto() - { - Id = user.Id, - UserName = user.UserName, - Nick = user.Nick, - Icon = user.Icon, - Level = info.Level, - UserLimit = info.UserLimit - } - - }, true) - .ToPageListAsync(input.SkipCount, input.MaxResultCount); - var discussId = output.Select(x => x.Id); - //点赞字典,key为主题id,y为用户ids - var agreeDic = - (await _agreeRepository._DbQueryable.Where(x => discussId.Contains(x.DiscussId)).ToListAsync()) - .GroupBy(x => x.DiscussId) - .ToDictionary(x => x.Key, y => y.Select(y => y.CreatorId).ToList()); - - //等级、是否点赞赋值 - output?.ForEach(x => - { - if (CurrentUser.Id is not null) - { - //默认fasle - if (agreeDic.TryGetValue(x.Id,out var userIds)) - { - x.IsAgree = userIds.Contains(CurrentUser.Id); - } - } - }); - - return output; - } - - /// - /// 作者主题,返回当前作者最新的主题 - /// - /// - [HttpGet("analyse/bbs-discuss/author/{userId}")] - public async Task> GetAuthorDiscussAsync( - [FromRoute] Guid userId, - [FromQuery] PagedResultRequestDto input) - { - var output = await _forumManager._discussRepository._DbQueryable.Where(discuss=>discuss.CreatorId==userId) - .Where(discuss=>discuss.PermissionType== DiscussPermissionTypeEnum.Public) - .LeftJoin((discuss, user) => discuss.CreatorId == user.Id) - .LeftJoin((discuss, user, info) => user.Id == info.UserId) - .OrderByDescending(discuss => discuss.CreationTime) - .Select((discuss, user, info) => new DiscussGetListOutputDto - { - Id = discuss.Id, - User = new BbsUserGetListOutputDto() - { - Id = user.Id, - UserName = user.UserName, - Nick = user.Nick, - Icon = user.Icon, - Level = info.Level, - UserLimit = info.UserLimit - } - - }, true) - .ToPageListAsync(input.SkipCount, input.MaxResultCount); - var discussId = output.Select(x => x.Id); - //点赞字典,key为主题id,y为用户ids - var agreeDic = - (await _agreeRepository._DbQueryable.Where(x => discussId.Contains(x.DiscussId)).ToListAsync()) - .GroupBy(x => x.DiscussId) - .ToDictionary(x => x.Key, y => y.Select(y => y.CreatorId).ToList()); - - //等级、是否点赞赋值 - output?.ForEach(x => - { - if (CurrentUser.Id is not null) - { - //默认fasle - if (agreeDic.TryGetValue(x.Id,out var userIds)) - { - x.IsAgree = userIds.Contains(CurrentUser.Id); - } - } - }); - - return output; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsUserAnalyseService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsUserAnalyseService.cs deleted file mode 100644 index 2daa4bb3..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Analyses/BbsUserAnalyseService.cs +++ /dev/null @@ -1,294 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Analyse; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Integral; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.DigitalCollectibles.Application.Contracts.IServices; -using Yi.Framework.Rbac.Application.Contracts.IServices; -using Yi.Framework.Rbac.Domain.Authorization; -using Yi.Framework.Rbac.Domain.Shared.Consts; -using Yi.Framework.Rbac.Domain.Shared.Model; - -namespace Yi.Framework.Bbs.Application.Services.Analyses -{ - public class BbsUserAnalyseService : ApplicationService, IApplicationService - { - private BbsUserManager _bbsUserManager; - private IOnlineService _onlineService; - private readonly IPointAnalyseService _pointAnalyseService; - private readonly IValueAnalyseService _valueAnalyseService; - - public BbsUserAnalyseService(BbsUserManager bbsUserManager, IOnlineService onlineService, - IPointAnalyseService pointAnalyseService, IValueAnalyseService valueAnalyseService) - { - _bbsUserManager = bbsUserManager; - _onlineService = onlineService; - _pointAnalyseService = pointAnalyseService; - _valueAnalyseService = valueAnalyseService; - } - - - /// - /// 人数注册统计(近3个月) - /// - /// - /// - [HttpGet("analyse/bbs-user/register")] - public async Task> GetRegisterAsync() - - { - using (DataFilter.DisablePermissionHandler()) - { - var users = await _bbsUserManager._userRepository._DbQueryable - .Where(u => u.CreationTime >= DateTime.Now.AddMonths(-3)) - .LeftJoin((u, info) => u.Id == info.UserId) - .Select((u, info) => new BbsUserGetListOutputDto() - { - Id = u.Id, - Icon = u.Icon, - Level = info.Level, - UserLimit = info.UserLimit, - Money = info.Money, - Experience = info.Experience, - CreationTime = u.CreationTime - }) - .ToListAsync(); - - var minCreateUser = users.MinBy(x => x.CreationTime); - - var userCreateTimeDic = users.OrderBy(x => x.CreationTime) - .GroupBy(x => x.CreationTime.Date) - .ToDictionary(x => x.Key.Date, y => y.Count()); - - DateTime startDate = minCreateUser.CreationTime.Date; - DateTime endDate = DateTime.Today; - - List output = new List(); - - // 计算从起始日期到今天的所有天数 - for (DateTime date = startDate; date <= endDate; date = date.AddDays(1)) - { - var count = 0; - userCreateTimeDic.TryGetValue(date, out count); - RegisterAnalyseDto dayInfo = new RegisterAnalyseDto(date, count); - output.Add(dayInfo); - } - - return output; - } - } - - - /// - /// 财富排行榜 - /// - /// - [HttpGet("analyse/bbs-user/money-top/{userId?}")] - public async Task> GetMoneyTopAsync([FromQuery] PagedResultRequestDto input, - [FromRoute] Guid? userId) - { - using (DataFilter.DisablePermissionHandler()) - { - var pageIndex = input.SkipCount; - - - RefAsync total = 0; - var output = await _bbsUserManager._userRepository._DbQueryable - .LeftJoin((u, info) => u.Id == info.UserId) - .OrderByDescending((u, info) => info.Money) - .Select((u, info) => - new MoneyTopUserDto - { - UserName = u.UserName, - Nick = u.Nick, - Money = info.Money, - Icon = u.Icon, - Level = info.Level, - UserLimit = info.UserLimit, - Order = SqlFunc.RowNumber(SqlFunc.Desc(info.Money)) - } - ) - .ToPageListAsync(pageIndex, input.MaxResultCount, total); - - var levelCache = await _bbsUserManager.GetLevelCacheMapAsync(); - - output.ForEach(x => { x.LevelName = levelCache[x.Level].Name; }); - return new PagedResultDto - { - Items = output, - TotalCount = total - }; - } - } - - - /// - /// 推荐好友,随机返回好友列表 - /// - /// - [HttpGet("analyse/bbs-user/random")] - public async Task> GetRandomUserAsync([FromQuery] PagedResultRequestDto input) - { - using (DataFilter.DisablePermissionHandler()) - { - var randUserIds = await _bbsUserManager._userRepository._DbQueryable - //.Where(x => x.UserName != UserConst.Admin) - .OrderBy(x => SqlFunc.GetRandom()) - .Select(x => x.Id).ToPageListAsync(input.SkipCount, input.MaxResultCount); - var output = await _bbsUserManager.GetBbsUserInfoAsync(randUserIds); - return output.Adapt>(); - - //这里关闭了数据权限,所有用户都能查询的到 - } - //这里有数据权限,会根据用户角色进行过滤 - } - - /// - /// 用户分析 - /// - /// - [HttpGet("analyse/bbs-user")] - public async Task GetUserAnalyseAsync() - { - using (DataFilter.DisablePermissionHandler()) - { - var sss = DataFilter.IsEnabled(); - var registerUser = await _bbsUserManager._userRepository._DbQueryable.CountAsync(); - - - DateTime now = DateTime.Now; - DateTime yesterday = now.AddDays(-1); - DateTime startTime = new DateTime(yesterday.Year, yesterday.Month, yesterday.Day, 0, 0, 0); - DateTime endTime = startTime.AddHours(24); - var yesterdayNewUser = await _bbsUserManager._userRepository._DbQueryable - .Where(x => x.CreationTime >= startTime && x.CreationTime <= endTime).CountAsync(); - - var userOnline = (await _onlineService.GetListAsync(new OnlineUserModel { })).TotalCount; - - var output = new BbsUserAnalyseGetOutput() - { OnlineNumber = userOnline, RegisterNumber = registerUser, YesterdayNewUser = yesterdayNewUser }; - - return output; - } - } - - - /// - /// 积分排行榜 - /// - /// - [HttpGet("analyse/dc-user/points-top/{userId?}")] - public async Task> GetPointsTopAsync([FromQuery] PagedResultRequestDto input, - [FromRoute] Guid? userId) - { - var result = await _pointAnalyseService.GetValueTopAsync(input, null); - - var userIds = result.Items.Select(x => x.UserId).ToList(); - - var baseOutput = await _bbsUserManager._userRepository._DbQueryable - .Where(u => userIds.Contains(u.Id)) - .LeftJoin((u, info) => u.Id == info.UserId) - .Select((u, info) => - new BaseAnalyseTopUserDto - { - UserName = u.UserName, - Nick = u.Nick, - Icon = u.Icon, - Level = info.Level, - UserLimit = info.UserLimit, - UserId = info.UserId - } - ).ToListAsync(); - - - var output = new List(); - var levelCache = await _bbsUserManager.GetLevelCacheMapAsync(); - result.Items.ToList().ForEach(x => - { - var currentUserInfo = baseOutput.Where(u => u.UserId == x.UserId).FirstOrDefault(); - - if (currentUserInfo is not null) - { - output.Add(new PointsTopUserDto - { - UserName = currentUserInfo.UserName, - Nick = currentUserInfo.Nick, - Order = x.Order, - Icon = currentUserInfo.Icon, - Level = currentUserInfo.Level, - LevelName = levelCache[currentUserInfo.Level].Name, - UserLimit = UserLimitEnum.Normal, - Points = x.Points - }); - } - }); - return new PagedResultDto - { - Items = output, - TotalCount = result.TotalCount - }; - } - - /// - /// 价值排行榜 - /// - /// - [HttpGet("analyse/dc-user/value-top/{userId?}")] - public async Task> GetValueTopAsync([FromQuery] PagedResultRequestDto input, - [FromRoute] Guid? userId) - { - var result = await _valueAnalyseService.GetValueTopAsync(input, null); - - var userIds = result.Items.Select(x => x.UserId).ToList(); - - var baseOutput = await _bbsUserManager._userRepository._DbQueryable - .Where(u => userIds.Contains(u.Id)) - .LeftJoin((u, info) => u.Id == info.UserId) - .Select((u, info) => - new BaseAnalyseTopUserDto - { - UserName = u.UserName, - Nick = u.Nick, - Icon = u.Icon, - Level = info.Level, - UserLimit = info.UserLimit, - UserId = info.UserId - } - ).ToListAsync(); - - - var output = new List(); - var levelCache = await _bbsUserManager.GetLevelCacheMapAsync(); - result.Items.ToList().ForEach(x => - { - var currentUserInfo = baseOutput.Where(u => u.UserId == x.UserId).FirstOrDefault(); - - if (currentUserInfo is not null) - { - output.Add(new ValueTopUserDto - { - UserName = currentUserInfo.UserName, - Nick = currentUserInfo.Nick, - Order = x.Order, - Icon = currentUserInfo.Icon, - Level = currentUserInfo.Level, - LevelName =levelCache[currentUserInfo.Level].Name, - UserLimit = UserLimitEnum.Normal, - Value = x.Value - }); - } - }); - return new PagedResultDto - { - Items = output, - TotalCount = result.TotalCount - }; - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/AssignmentService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/AssignmentService.cs deleted file mode 100644 index 456fdfea..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/AssignmentService.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Assignment; -using Yi.Framework.Bbs.Domain.Entities.Assignment; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Application.Services; - -/// -/// 任务系统 -/// -[Authorize] -public class AssignmentService : ApplicationService -{ - private readonly AssignmentManager _assignmentManager; - - public AssignmentService(AssignmentManager assignmentManager) - { - _assignmentManager = assignmentManager; - } - - /// - /// 接收任务 - /// - /// - [HttpPost("assignment/accept/{id}")] - public async Task AcceptAsync([FromRoute] Guid id) - { - await _assignmentManager.AcceptAsync(CurrentUser.GetId(), id); - } - - /// - /// 领取任务奖励 - /// - /// - [HttpPost("assignment/complete/{id}")] - public async Task ReceiveRewardsAsync([FromRoute] Guid id) - { - await _assignmentManager.ReceiveRewardsAsync(id); - } - - /// - /// 查看可接受的任务 - /// - /// - [HttpGet("assignment/receive")] - public async Task> GetCanReceiveListAsync() - { - var entities = await _assignmentManager.GetCanReceiveListAsync(CurrentUser.GetId()); - var output = entities.Adapt>(); - return output; - } - - /// - /// 查询接受的任务 - /// - [HttpGet("assignment")] - public async Task> GetListAsync([FromQuery] AssignmentGetListInput input) - { - var output = await _assignmentManager._assignmentRepository._DbQueryable - .Where(x => x.UserId == CurrentUser.GetId()) - .WhereIF(input.AssignmentQueryState == AssignmentQueryStateEnum.Progress, - x => x.AssignmentState == AssignmentStateEnum.Progress|| - x.AssignmentState == AssignmentStateEnum.Completed) - .WhereIF(input.AssignmentQueryState == AssignmentQueryStateEnum.End, - x => x.AssignmentState == AssignmentStateEnum.End || - x.AssignmentState == AssignmentStateEnum.Expired) - .OrderBy(x=>x.CreationTime) - .LeftJoin((x, define) => x.AssignmentDefineId==define.Id) - .Select((x, define) => new AssignmentGetListOutputDto - { - Id = x.Id - },true) - .ToListAsync(); - - return output; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs deleted file mode 100644 index 182b6a64..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Bank/BankService.cs +++ /dev/null @@ -1,109 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Bank; -using Yi.Framework.Bbs.Domain.Entities.Bank; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Bank -{ - public class BankService : ApplicationService - { - private BankManager _bankManager; - private BbsUserManager _bbsUserManager; - private ISqlSugarRepository _repository; - private ISqlSugarRepository _interestRepository; - public BankService(BankManager bankManager, BbsUserManager userManager, ISqlSugarRepository repository, ISqlSugarRepository interestRepository) - { - _bankManager = bankManager; - _bbsUserManager = userManager; - _repository = repository; - _interestRepository = interestRepository; - } - - /// - /// 获取最近24小时汇率记录 - /// - /// - [HttpGet("bank/interest")] - public async Task> GetInterestRecordsAsync() - { - var entities = await _interestRepository._DbQueryable.OrderByDescending(x => x.CreationTime).ToPageListAsync(1, 24); - var output = entities.Adapt>().OrderBy(x=>x.CreationTime).ToList(); - return output; - } - - /// - /// 获取登录用户全部银行卡信息 - /// - /// - [Authorize] - [HttpGet("bank")] - public async Task> GetBankCardListAsync() - { - var entities = await _repository._DbQueryable.Where(x => x.UserId == CurrentUser.Id).OrderBy(x=>x.CreationTime).ToListAsync(); - var output = entities.Adapt>(); - return output; - } - - /// - /// 给用户申请银行卡 - /// - /// - [Authorize] - [HttpPost("bank/applying")] - public async Task ApplyingBankCardAsync() - { - var userInfo = await _bbsUserManager.GetBbsUserInfoAsync(CurrentUser.Id!.Value); - var banCardNum = await _repository.CountAsync(x => x.UserId == CurrentUser.Id!.Value); - - var diffNum = userInfo.Level - banCardNum; - if (diffNum <= 0) - { - throw new UserFriendlyException($"申请失败,当前等级-【{userInfo.Level}】,最多可申领-【{userInfo.Level}】张银行卡,目前已拥有-【{banCardNum}】,请提升你的等级信誉,行长会考虑的"); - } - else - { - await _bankManager.ApplyingBankCardAsync(CurrentUser.Id.Value, diffNum); - } - } - - /// - /// 给银行卡提款 - /// - /// - /// - [Authorize] - [HttpPut("bank/draw/{cardId}")] - public Task DrawMoneyAsync(Guid cardId) - { - return _bankManager.DrawMoneyAsync(cardId); - } - /// - /// 给银行卡存款 - /// - /// - /// - /// - [Authorize] - [HttpPut("bank/deposit/{cardId}/{moneyNum}")] - public async Task DepositAsync(Guid cardId, decimal moneyNum) - { - if (moneyNum < 50) - { - throw new UserFriendlyException("存款金额不能小于50"); - } - var userInfo = await _bbsUserManager.GetBbsUserInfoAsync(CurrentUser.Id!.Value); - if (userInfo.Money < moneyNum) - { - throw new UserFriendlyException("存钱失败!你的钱钱不足,再存进去,就负数啦~"); - } - - await _bankManager.DepositAsync(cardId, moneyNum); - } - - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BbsNoticeService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BbsNoticeService.cs deleted file mode 100644 index 562593b2..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BbsNoticeService.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Notice; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services -{ - public class BbsNoticeService : ApplicationService - { - private ISqlSugarRepository _repository; - public BbsNoticeService(ISqlSugarRepository repository) - { - _repository = repository; - } - - - /// - /// 查询用户的消息,需登录 - /// - /// - /// - /// - [Authorize] - public async Task> GetListAsync(BbsNoticeGetListInputVo input) - { - RefAsync total = 0; - var entities = await _repository._DbQueryable.Where(x => x.AcceptUserId == CurrentUser.Id) - .OrderByDescending(x => x.CreationTime) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - var output = entities.Adapt>(); - return new PagedResultDto(total, output); - } - - /// - /// 已读消息,不传guid,代表一键已读,需登录 - /// - /// - [Authorize] - [Route("bbs-notice/read/{noticeId?}")] - public async Task PutReadAsync(Guid? noticeId) - { - //一键已读 - if (noticeId is null) - { - await _repository._Db.Updateable() - .SetColumns(it => it.IsRead == true) - .Where(x => x.AcceptUserId == CurrentUser.Id) - .Where(x => x.IsRead == false) - .ExecuteCommandAsync(); - } - //已读一条 - else - { - await _repository._Db.Updateable() - .SetColumns(it => it.IsRead == true) - .Where(x => x.AcceptUserId == CurrentUser.Id) - .Where(x => x.IsRead == false) - .Where(x => x.Id == noticeId) - .ExecuteCommandAsync(); - - } - - } - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BbsUserInfoService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BbsUserInfoService.cs deleted file mode 100644 index 495428c8..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/BbsUserInfoService.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Managers; - -namespace Yi.Framework.Bbs.Application.Services -{ - public class BbsUserInfoService : ApplicationService, IBbsUserInfoService - { - private readonly BbsUserManager _bbsUserManager; - public BbsUserInfoService(BbsUserManager bbsUserManager) - { - _bbsUserManager = bbsUserManager; - } - - [HttpGet("bbs-user/{userNameOrUserId}")] - public async Task GetUserInfoByUserNameOrUserIdAsync([FromRoute][Required] string userNameOrUserId) - { - Guid userId; - if (Guid.TryParse(userNameOrUserId, out var userGuidId)) - { - userId = userGuidId; - } - else - { - var userEntity = await _bbsUserManager._userRepository.GetFirstAsync(x => x.UserName == userNameOrUserId); - if (userEntity == null) - { - throw new UserFriendlyException("该用户不存在"); - } - userId= userEntity.Id; - } - - var output =await _bbsUserManager.GetBbsUserInfoAsync(userId); - - //不是自己 - if (CurrentUser.Id != output.Id) - { - output.Phone = null; - output.Email=null; - } - return output!; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/AgreeService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/AgreeService.cs deleted file mode 100644 index 1163efd5..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/AgreeService.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Volo.Abp; -using Volo.Abp.Application.Services; -using Volo.Abp.Uow; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Argee; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Forum -{ - /// - /// 点赞功能 - /// - public class AgreeService : ApplicationService, IApplicationService - { - public AgreeService(ISqlSugarRepository repository, ISqlSugarRepository discssRepository, BbsUserManager bbsUserManager) - { - _repository = repository; - _discssRepository = discssRepository; - _bbsUserManager = bbsUserManager; - } - private readonly BbsUserManager _bbsUserManager; - private ISqlSugarRepository _repository { get; set; } - - private ISqlSugarRepository _discssRepository { get; set; } - - - /// - /// 点赞,返回true为点赞+1,返回false为点赞-1 - /// Todo: 可放入领域层,但是没必要,这个项目太简单了 - /// - /// - [Authorize] - public async Task PostOperateAsync(Guid discussId) - { - await _bbsUserManager.VerifyUserLimitAsync(CurrentUser.GetId()); - var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == CurrentUser.Id); - //判断是否已经点赞过 - if (entity is null) - { - //没点赞过,添加记录即可,,修改总点赞数量 - await _repository.InsertAsync(new AgreeEntity(discussId)); - var discussEntity = await _discssRepository.GetByIdAsync(discussId); - if (discussEntity is null) - { - throw new UserFriendlyException("主题为空"); - } - discussEntity.AgreeNum += 1; - await _discssRepository.UpdateAsync(discussEntity); - - return new AgreeDto(true); - - } - else - { - //点赞过,删除即可,修改总点赞数量 - await _repository.DeleteAsync(entity); - var discussEntity = await _discssRepository.GetByIdAsync(discussId); - if (discussEntity is null) - { - throw new UserFriendlyException("主题为空"); - } - discussEntity.AgreeNum -= 1; - await _discssRepository.UpdateAsync(discussEntity); - - return new AgreeDto(false); - } - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/ArticleService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/ArticleService.cs deleted file mode 100644 index 96a0b795..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/ArticleService.cs +++ /dev/null @@ -1,196 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Text; -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Article; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Repositories; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Model; -using Yi.Framework.Ddd.Application; -using Yi.Framework.Rbac.Domain.Authorization; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Forum -{ - /// - /// Article服务实现 - /// - public class ArticleService : YiCrudAppService, - IArticleService - { - public ArticleService(IArticleRepository articleRepository, - ISqlSugarRepository discussRepository, - ForumManager forumManager) : base(articleRepository) - { - _articleRepository = articleRepository; - _discussRepository = discussRepository; - _forumManager = forumManager; - } - - private readonly ForumManager _forumManager; - private readonly IArticleRepository _articleRepository; - private readonly ISqlSugarRepository _discussRepository; - - public override async Task> GetListAsync(ArticleGetListInputVo input) - { - RefAsync total = 0; - - var entities = await _articleRepository._DbQueryable - .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) - .WhereIF(input.StartTime is not null && input.EndTime is not null, - x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); - } - - /// - /// 查询文章 - /// - /// - /// - public override async Task GetAsync(Guid id) - { - var entity = await _articleRepository.GetAsync(id); - var output = entity.Adapt(); - if (!await _forumManager.VerifyDiscussPermissionAsync(entity.DiscussId, CurrentUser.Id, CurrentUser.Roles)) - { - output.SetNoPermission(); - } - else - { - output.SetPassPermission(); - } - - return output; - } - - /// - /// 获取文章全部树级信息 - /// - /// - /// - /// - [Route("article/all/discuss-id/{discussId}")] - public async Task> GetAllAsync([FromRoute] Guid discussId) - { - var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId); - var items = entities.Adapt>(); - return items; - } - - /// - /// 查询文章概述 - /// - /// - /// - /// - public async Task> GetDiscussIdAsync([FromRoute] Guid discussId) - { - if (!await _discussRepository.IsAnyAsync(x => x.Id == discussId)) - { - throw new UserFriendlyException(DiscussConst.No_Exist); - } - - var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId); - var items = await MapToGetListOutputDtosAsync(entities); - return items; - } - - /// - /// 发表文章 - /// - /// - /// - /// - [Permission("bbs:article:add")] - [Authorize] - public override async Task CreateAsync(ArticleCreateInputVo input) - { - await VerifyPermissionAsync(input.DiscussId); - return await base.CreateAsync(input); - } - - /// - /// 更新文章 - /// - /// - /// - /// - public override async Task UpdateAsync(Guid id, ArticleUpdateInputVo input) - { - var entity = await _articleRepository.GetByIdAsync(id); - await VerifyPermissionAsync(entity.DiscussId); - return await base.UpdateAsync(id, input); - } - - - /// - /// 删除文章 - /// - /// - /// - public override async Task DeleteAsync(Guid id) - { - var entity = await _articleRepository.GetByIdAsync(id); - await VerifyPermissionAsync(entity.DiscussId); - await base.DeleteAsync(id); - } - - - /// - /// 导入文章 - /// - /// - public async Task PostImportAsync([FromQuery] ArticleImprotDto input, - [FromForm] [Required] IFormFileCollection file) - { - await VerifyPermissionAsync(input.DiscussId); - var fileObjs = new List(); - if (file.Count > 0) - { - foreach (var item in file) - { - if (item.Length > 0) - { - using (var stream = item.OpenReadStream()) - { - using (var fileStream = new MemoryStream()) - { - await item.CopyToAsync(fileStream); - var bytes = fileStream.ToArray(); - - // 将字节转换成字符串 - var content = Encoding.UTF8.GetString(bytes); - fileObjs.Add(new FileObject() { FileName = item.FileName, Content = content }); - } - } - } - } - } - else - { - throw new UserFriendlyException("未选择文件"); - } - - //使用简单工厂根据传入的类型进行判断 - await _forumManager.PostImportAsync(input.DiscussId, input.ArticleParentId, fileObjs, input.ImportType); - } - - - private async Task VerifyPermissionAsync(Guid discussId) - { - if (!await _forumManager.VerifyDiscussPermissionAsync(discussId, CurrentUser.Id, isVerifyLook: false)) - { - throw new UserFriendlyException("您无权限进行操作", "403"); - } - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/BannerService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/BannerService.cs deleted file mode 100644 index 805149c8..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/BannerService.cs +++ /dev/null @@ -1,32 +0,0 @@ -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Ddd.Application; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Forum -{ - /// - /// Banner服务实现 - /// - public class BannerService : YiCrudAppService, - IBannerService - { - private ISqlSugarRepository _repository; - public BannerService(ISqlSugarRepository repository) : base(repository) - { - _repository = repository; - } - - public override async Task> GetListAsync(BannerGetListInputVo input) - { - RefAsync total = 0; - var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs deleted file mode 100644 index be2b8603..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/CommentService.cs +++ /dev/null @@ -1,147 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Comment; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Ddd.Application; -using Yi.Framework.Rbac.Domain.Authorization; -using Yi.Framework.Rbac.Domain.Extensions; -using Yi.Framework.Rbac.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Forum -{ - /// - /// 评论 - /// - public class CommentService : YiCrudAppService, - ICommentService - { - private readonly ISqlSugarRepository _repository; - private readonly BbsUserManager _bbsUserManager; - public CommentService(ForumManager forumManager, ISqlSugarRepository discussRepository, IDiscussService discussService, ISqlSugarRepository CommentRepository, BbsUserManager bbsUserManager) : base(CommentRepository) - { - _forumManager = forumManager; - _discussRepository = discussRepository; - _discussService = discussService; - _repository = CommentRepository; - _bbsUserManager = bbsUserManager; - } - private ForumManager _forumManager { get; set; } - private ISqlSugarRepository _discussRepository { get; set; } - - private IDiscussService _discussService { get; set; } - - /// - /// 获取改主题下的评论,结构为二维列表,该查询无分页 - /// - /// - /// - /// - public async Task> GetDiscussIdAsync([FromRoute] Guid discussId, [FromQuery] CommentGetListInputVo input) - { - await _forumManager.VerifyDiscussPermissionAsync(discussId,CurrentUser.Id); - - var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Content), x => x.Content.Contains(input.Content)) - .Where(x => x.DiscussId == discussId) - .Includes(x => x.CreateUser) - .ToListAsync(); - - //该实体需要进行转换 - - //同时为所有用户id进行bbs的扩展即可 - List userIds = entities.Where(x => x.CreatorId != null).Select(x => x.CreatorId ?? Guid.Empty).ToList(); - var bbsUserInfoDic = (await _bbsUserManager.GetBbsUserInfoAsync(userIds)).ToDictionary(x => x.Id); - - //------数据查询完成------,以下只是dto的简单组装 - - //从根目录开始组装 - //结果初始值,第一层等于全部根节点 - var allOutPut = entities.OrderByDescending(x => x.CreationTime).ToList(); - - //获取全量主题评论, 先获取顶级的,将其他子组合到顶级下,形成一个二维,先转成dto - List allOutoutDto = await MapToGetListOutputDtosAsync(allOutPut); - - //开始映射额外用户信息字段 - allOutoutDto?.ForEach(x => x.CreateUser = bbsUserInfoDic[x.CreatorId ?? Guid.Empty].Adapt()); - - //开始组装dto的层级关系 - //将全部数据进行hash - var dic = allOutoutDto.ToDictionary(x => x.Id); - - foreach (var comment in allOutoutDto) - { - //不是根节点,需要赋值 被评论者用户信息等 - if (comment.ParentId != Guid.Empty) - { - if (dic.ContainsKey(comment.ParentId)) - { - var parentComment = dic[comment.ParentId]; - comment.CommentedUser = parentComment.CreateUser; - } - else - { - continue; - } - } - //root或者parent id,根节点都是等于0的 - var id = comment.RootId; - if (id != Guid.Empty) - { - dic[id].Children.Add(comment); - } - - } - - //子类需要排序 - var rootOutoutDto = allOutoutDto.Where(x => x.ParentId == Guid.Empty).ToList(); - rootOutoutDto?.ForEach(x => - { - x.Children = x.Children.OrderByDescending(x => x.CreationTime).ToList(); - }); - return new PagedResultDto(entities.Count(), rootOutoutDto); - } - - - /// - /// 发表评论 - /// - /// - /// - /// - [Permission("bbs:comment:add")] - [Authorize] - public override async Task CreateAsync(CommentCreateInputVo input) - { - if (string.IsNullOrWhiteSpace(input.Content)|| input.Content=="


") - { - throw new UserFriendlyException("评论不能为空"); - } - await _bbsUserManager.VerifyUserLimitAsync(CurrentUser.GetId()); - var discuess = await _discussRepository.GetFirstAsync(x => x.Id == input.DiscussId); - if (discuess is null) - { - throw new UserFriendlyException(DiscussConst.No_Exist); - } - //不是超级管理员,且主题开启禁止评论 - - if (discuess.IsDisableCreateComment == true && !CurrentUser.GetPermissions().Contains(UserConst.AdminPermissionCode)) - { - throw new UserFriendlyException("该主题已禁止评论功能"); - } - - - var entity = await _forumManager.CreateCommentAsync(input.DiscussId, input.ParentId, input.RootId, input.Content); - return await MapToGetOutputDtoAsync(entity); - } - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussLableService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussLableService.cs deleted file mode 100644 index 7994bada..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussLableService.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Data; -using Yi.Framework.Bbs.Application.Contracts.Dtos.MyType; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Ddd.Application; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Forum -{ - /// - /// DiscussLable服务实现 - /// - public class DiscussLableService : YiCrudAppService, - IDiscussLableService - { - private ISqlSugarRepository _repository; - - public DiscussLableService(ISqlSugarRepository repository) : base(repository) - { - _repository = repository; - } - - [HttpGet("discuss-lable/all")] - public async Task> GetAllListAsync(DiscussLableGetListInputVo input) - { - var order = input.Sorting ?? nameof(DiscussLableAggregateRoot.Name); - var output = await _repository._DbQueryable - .WhereIF(input.Name is not null, x => x.Name.Contains(input.Name)) - .OrderBy(order) - .Select(x => new DiscussLableGetListOutputDto(), true) - .ToListAsync(); - return new ListResultDto(output); - } - - public override async Task> GetListAsync( - DiscussLableGetListInputVo input) - { - RefAsync total = 0; - var order = input.Sorting ?? nameof(DiscussLableAggregateRoot.Name); - var output = await _repository._DbQueryable - .WhereIF(input.Name is not null, x => x.Name.Contains(input.Name)) - .OrderBy(order) - .Select(x => new DiscussLableGetListOutputDto(), true) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - return new PagedResultDto(total, output); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussService.cs deleted file mode 100644 index 82c53b1c..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/DiscussService.cs +++ /dev/null @@ -1,343 +0,0 @@ -using System.Linq; -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Application.Contracts.Dtos.BbsUser; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss; -using Yi.Framework.Bbs.Application.Contracts.Dtos.DiscussLable; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Repositories; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Ddd.Application; -using Yi.Framework.Rbac.Application.Contracts.Dtos.User; -using Yi.Framework.Rbac.Domain.Authorization; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.Rbac.Domain.Extensions; -using Yi.Framework.Rbac.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Forum -{ - /// - /// Discuss应用服务实现,用于参数校验、领域服务业务组合、日志记录、事务处理、账户信息 - /// - public class DiscussService : YiCrudAppService, - IDiscussService - { - private ISqlSugarRepository _discussTopRepository; - private ISqlSugarRepository _agreeRepository; - private BbsUserManager _bbsUserManager; - private IDiscussLableRepository _discussLableRepository; - - public DiscussService(BbsUserManager bbsUserManager, ForumManager forumManager, - ISqlSugarRepository discussTopRepository, - ISqlSugarRepository plateEntityRepository, ILocalEventBus localEventBus, - ISqlSugarRepository agreeRepository, IDiscussLableRepository discussLableRepository) : base( - forumManager._discussRepository) - { - _forumManager = forumManager; - _plateEntityRepository = plateEntityRepository; - _localEventBus = localEventBus; - _agreeRepository = agreeRepository; - _discussLableRepository = discussLableRepository; - _discussTopRepository = discussTopRepository; - _bbsUserManager = bbsUserManager; - } - - private readonly ILocalEventBus _localEventBus; - private ForumManager _forumManager { get; set; } - - - private ISqlSugarRepository _plateEntityRepository { get; set; } - - /// - /// 单查 - /// - /// - /// - public override async Task GetAsync(Guid id) - { - //查询主题发布 浏览主题 事件,浏览数+1 - var output = await _forumManager._discussRepository._DbQueryable - .LeftJoin((discuss, user) => discuss.CreatorId == user.Id) - .LeftJoin((discuss, user, info) => user.Id == info.UserId) - .LeftJoin((discuss, user, info, plate) => plate.Id == discuss.PlateId) - .Select((discuss, user, info, plate) => new DiscussGetOutputDto - { - Id = discuss.Id, - IsAgree = false, - User = new BbsUserGetListOutputDto() - { - UserName = user.UserName, - Nick = user.Nick, - Icon = user.Icon, - Id = user.Id, - Level = info.Level, - UserLimit = info.UserLimit, - Money = info.Money, - Experience = info.Experience - }, - Plate = new Contracts.Dtos.Plate.PlateGetOutputDto() - { - Name = plate.Name, - Id = plate.Id, - Code = plate.Code, - Introduction = plate.Introduction, - Logo = plate.Logo - } - }, true) - .FirstAsync(discuss => discuss.Id == id); - - if (output is null) - { - throw new UserFriendlyException("该主题不存在", "404"); - } - - switch (output.DiscussType) - { - case DiscussTypeEnum.Article: break; - //查询的是悬赏主题 - case DiscussTypeEnum.Reward: - var reward = await _forumManager._discussRewardRepository.GetAsync(x => x.DiscussId == output.Id); - output.RewardData = reward.Adapt(); - break; - } - - - //组装点赞 - var agreeCreatorList = - (await _agreeRepository._DbQueryable.Where(x => x.DiscussId == output.Id).Select(x => x.CreatorId) - .ToListAsync()); - //已登录 - if (CurrentUser.Id is not null) - { - output.IsAgree = agreeCreatorList.Contains(CurrentUser.Id); - } - - //组装标签 - var lableDic = await _discussLableRepository.GetDiscussLableCacheMapAsync(); - foreach (var lableId in output.DiscussLableIds) - { - if (lableDic.TryGetValue(lableId, out var item)) - { - output.Lables.Add(item.Adapt()); - } - } - - //如果没有权限 - if (!await _forumManager.VerifyDiscussPermissionAsync(output.Id, CurrentUser.Id, CurrentUser.Roles)) - { - output.SetNoPermission(); - } - else - { - output.SetPassPermission(); - } - - await _localEventBus.PublishAsync(new SeeDiscussEventArgs - { DiscussId = output.Id, OldSeeNum = output.SeeNum }); - return output; - } - - /// - /// 查询 - /// - /// - /// - public override async Task> GetListAsync( - [FromQuery] DiscussGetListInputVo input) - { - //需要关联创建者用户 - RefAsync total = 0; - var items = await _forumManager._discussRepository._DbQueryable - .WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title.Contains(input.Title)) - .WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId) - .WhereIF(input.IsTop is not null, x => x.IsTop == input.IsTop) - .WhereIF(input.UserId is not null, x => x.CreatorId == input.UserId) - .LeftJoin((discuss, user) => discuss.CreatorId == user.Id) - .WhereIF(input.UserName is not null, (discuss, user) => user.UserName == input.UserName!) - .LeftJoin((discuss, user, info) => user.Id == info.UserId) - .OrderByDescending(discuss => discuss.OrderNum) - //已提示杰哥新增表达式 - // .OrderByIF(input.Type == QueryDiscussTypeEnum.New, - // @"COALESCE(discuss.LastModificationTime, discuss.CreationTime) DESC") - //采用上方写法 - .OrderByIF(input.Type == QueryDiscussTypeEnum.New, discuss => discuss.CreationTime, OrderByType.Desc) - // .OrderByIF(input.Type == QueryDiscussTypeEnum.New,discuss=>SqlFunc.Coalesce(discuss.LastModificationTime,discuss.CreationTime),OrderByType.Desc) - .OrderByIF(input.Type == QueryDiscussTypeEnum.Host, discuss => discuss.SeeNum, OrderByType.Desc) - .OrderByIF(input.Type == QueryDiscussTypeEnum.Suggest, discuss => discuss.AgreeNum, OrderByType.Desc) - .Select((discuss, user, info) => new DiscussGetListOutputDto - { - Id = discuss.Id, - // 优化查询,不使用子查询 - // IsAgree = SqlFunc.Subqueryable().WhereIF(CurrentUser.Id != null, x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(), - User = new BbsUserGetListOutputDto() - { - Id = user.Id, - UserName = user.UserName, - Nick = user.Nick, - Icon = user.Icon, - Level = info.Level, - UserLimit = info.UserLimit, - Money = info.Money, - Experience = info.Experience - } - }, true) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - var discussId = items.Select(x => x.Id); - - //点赞字典,key为主题id,y为用户ids - var agreeDic = - (await _agreeRepository._DbQueryable.Where(x => discussId.Contains(x.DiscussId)).ToListAsync()) - .GroupBy(x => x.DiscussId) - .ToDictionary(x => x.Key, y => y.Select(y => y.CreatorId).ToList()); - - var levelCacheDic = await _bbsUserManager.GetLevelCacheMapAsync(); - var lableDic = await _discussLableRepository.GetDiscussLableCacheMapAsync(); - - //组装等级、是否点赞赋值、标签 - items?.ForEach(x => - { - x.User.LevelName = levelCacheDic[x.User.Level].Name; - if (CurrentUser.Id is not null) - { - //默认fasle - if (agreeDic.TryGetValue(x.Id, out var userIds)) - { - x.IsAgree = userIds.Contains(CurrentUser.Id); - } - } - - foreach (var lableId in x.DiscussLableIds) - { - if (lableDic.TryGetValue(lableId, out var item)) - { - x.Lables.Add(item.Adapt()); - } - } - }); - return new PagedResultDto(total, items); - } - - /// - /// 获取首页的置顶主题 - /// - /// - public async Task> GetListTopAsync() - { - var output = await _discussTopRepository._DbQueryable - .LeftJoin((top, discuss) => top.DiscussId == discuss.Id) - .LeftJoin((top, discuss, user) => discuss.CreatorId == user.Id) - .LeftJoin((top, discuss, user, info) => user.Id == info.UserId) - .OrderByDescending(top => top.OrderNum) - .Select((top, discuss, user, info) => new DiscussGetListOutputDto - { - Id = discuss.Id, - IsAgree = SqlFunc.Subqueryable().WhereIF(CurrentUser.Id != null, - x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(), - User = new BbsUserGetListOutputDto - { - Id = user.Id, - Name = user.Name, - Sex = user.Sex, - State = user.State, - Address = user.Address, - Age = user.Age, - CreationTime = user.CreationTime, - Level = info.Level, - Introduction = user.Introduction, - Icon = user.Icon, - Nick = user.Nick, - UserName = user.UserName, - Remark = user.Remark, - UserLimit = info.UserLimit, - Money = info.Money, - Experience = info.Experience, - } - }, true) - .ToListAsync(); - var levelCacheDic = await _bbsUserManager.GetLevelCacheMapAsync(); - var lableDic = await _discussLableRepository.GetDiscussLableCacheMapAsync(); - - output?.ForEach(x => - { - x.User.LevelName = levelCacheDic[x.User.Level].Name; - foreach (var lableId in x.DiscussLableIds) - { - if (lableDic.TryGetValue(lableId, out var item)) - { - x.Lables.Add(item.Adapt()); - } - } - }); - return output; - } - - /// - /// 创建主题 - /// - /// - /// - [Permission("bbs:discuss:add")] - [Authorize] - public override async Task CreateAsync(DiscussCreateInput input) - { - var plate = await _plateEntityRepository.FindAsync(x => x.Id == input.PlateId); - if (plate is null) - { - throw new UserFriendlyException(PlateConst.No_Exist); - } - - if (await _forumManager._discussRepository.IsAnyAsync(x => x.Title == input.Title)) - { - throw new UserFriendlyException(DiscussConst.Repeat); - } - - //如果开启了禁用创建主题 - if (plate.IsDisableCreateDiscuss == true) - { - //只有超级管理员权限才能进行发布 - if (!CurrentUser.GetPermissions().Contains(UserConst.AdminPermissionCode)) - { - throw new UserFriendlyException("该板块已禁止创建主题,请在其他板块中发布"); - } - } - - await _bbsUserManager.VerifyUserLimitAsync(CurrentUser.GetId()); - var entity = await _forumManager.CreateDiscussAsync(await MapToEntityAsync(input), - input.RewardData.Adapt()); - return await MapToGetOutputDtoAsync(entity); - } - - /// - /// 设置悬赏主题已解决 - /// - /// - /// - [HttpPut("discuss/reward/resolve/{discussId}")] - [Authorize] - public async Task SetRewardResolvedAsync([FromRoute] Guid discussId) - { - var reward = await _forumManager._discussRewardRepository.GetFirstAsync(x => x.DiscussId == discussId); - if (reward is null) - { - throw new UserFriendlyException("未找到该悬赏主题", "404"); - } - - //设置已解决 - reward.SetResolved(); - await _forumManager._discussRewardRepository.UpdateAsync(reward); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/PlateService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/PlateService.cs deleted file mode 100644 index 71e8f5d6..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Forum/PlateService.cs +++ /dev/null @@ -1,37 +0,0 @@ -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Ddd.Application; -using Yi.Framework.Rbac.Application.Contracts.Dtos.Config; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Forum -{ - /// - /// Plate服务实现 - /// - public class PlateService : YiCrudAppService, - IPlateService - { - private ISqlSugarRepository _repository; - public PlateService(ISqlSugarRepository repository) : base(repository) - { - _repository = repository; - } - - public override async Task> GetListAsync(PlateGetListInputVo input) - { - RefAsync total = 0; - - var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) - .WhereIF(!string.IsNullOrEmpty(input.Code), x => x.Name.Contains(input.Code!)) - .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) - .OrderByDescending(x => x.OrderNum) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/IntegralService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/IntegralService.cs deleted file mode 100644 index 7d192f8b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/IntegralService.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Integral; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Rbac.Domain.Authorization; - -namespace Yi.Framework.Bbs.Application.Services.Integral -{ - public class IntegralService : ApplicationService - { - private IntegralManager _integralManager; - private ICurrentUser _currentUser; - private ILocalEventBus _localEventBus; - public IntegralService(IntegralManager integralManager, ICurrentUser currentUser, ILocalEventBus localEventBus) - { - _integralManager = integralManager; - _currentUser = currentUser; - _localEventBus = localEventBus; - } - - - /// - /// 签到 - /// - /// - [Authorize] - public async Task PostSignInAsync() - { - var value = await _integralManager.SignInAsync(_currentUser.Id ?? Guid.Empty); - return new { value }; - } - - /// - /// 获取本月签到记录 - /// Todo: 可放入领域层 - /// - /// - [Authorize] - [HttpGet("integral/sign-in/record")] - public async Task GetSignInRecordAsync() - { - var output = new SignInDto(); - DateTime lastMonth = DateTime.Now.AddMonths(-1); - DateTime lastDayOfMonth = new DateTime(lastMonth.Year, lastMonth.Month, 1).AddMonths(1).AddDays(-1); - DateTime startOfLastDay = new DateTime(lastDayOfMonth.Year, lastDayOfMonth.Month, lastDayOfMonth.Day, 0, 0, 0); - - //获取当前用户本月的数据+上个月最后一天的数据 - var entities = await _integralManager._signInRepository.GetListAsync(x => x.CreatorId == CurrentUser.Id - && x.CreationTime >= startOfLastDay); - - if (entities.Count() == 0) - { - //返回默认值 - return output; - } - //拿到最末尾的数据 - var lastEntity = entities.OrderBy(x => x.CreationTime).LastOrDefault(); - - //判断当前时间和最后时间是否为连续的 - if (lastEntity.CreationTime.Day >= DateTime.Now.AddDays(-1).Day) - { - - output.CurrentContinuousNumber = lastEntity.ContinuousNumber; - } - - //去除上个月查询的数据 - output.SignInItem = entities.Where(x => x.CreationTime.Month == DateTime.Now.Month).Select(x => new SignInItemDto { Id = x.Id, CreationTime = x.CreationTime }).OrderBy(x => x.CreationTime).ToList(); - return output; - - - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LevelService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LevelService.cs deleted file mode 100644 index 735e1bd9..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LevelService.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Level; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Entities.Integral; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Ddd.Application; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Integral -{ - /// - /// 等级服务 - /// - public class LevelService : YiCrudAppService, ILevelService - { - private ISqlSugarRepository _repository; - private LevelManager _levelManager; - public LevelService(ISqlSugarRepository repository, LevelManager levelManager) : base(repository) - { - _repository = repository; - _levelManager = levelManager; - } - - /// - /// 查询等级配置 - /// - /// - /// - public override async Task> GetListAsync(LevelGetListInputDto input) - { - RefAsync total = 0; - - var entities = await _repository._DbQueryable - .WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name.Contains(input.Name!)) - .WhereIF(input.MinLevel is not null, x => x.CurrentLevel >= input.MinLevel) - .OrderBy(x => x.CurrentLevel) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - return new PagedResultDto(total, await MapToGetListOutputDtosAsync(entities)); - } - - /// - /// 升级等级 - /// - /// - [Authorize] - public async Task UpdateUpgradeAsync(int experience) - { - if (experience <= 0) - { - throw new UserFriendlyException(LevelConst.Level_Low_Zero); - } - await _levelManager.ChangeLevelByMoneyAsync(CurrentUser.Id!.Value, experience); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LuckyService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LuckyService.cs deleted file mode 100644 index 22efc4a2..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Integral/LuckyService.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using Microsoft.AspNetCore.Authorization; -using Volo.Abp.Application.Services; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Application.Contracts.IServices; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Shared.Etos; - -namespace Yi.Framework.Bbs.Application.Services.Integral -{ - public class LuckyService : ApplicationService - { - private ILocalEventBus _localEventBus; - private BbsUserManager _bbsUserManager; - public LuckyService(ILocalEventBus localEventBus, BbsUserManager bbsUserManager) { _bbsUserManager = bbsUserManager; _localEventBus = localEventBus; } - - /// - /// 大转盘 - /// Todo: 可放入领域层,但是太简单了,不重要 - /// - /// - [Authorize] - public async Task PostWheel() - { - var userInfo = await _bbsUserManager.GetBbsUserInfoAsync(CurrentUser.Id.Value); - if (userInfo.Money < 50) - { - throw new UserFriendlyException("钱钱不足!"); - } - - - int[] values = new int[10] { 0, 10, 30, 50, 60, 80, 90, 100, 200, 666 }; - var index = GetWheelIndex(); - var value = values[index] - 50; - - //修改钱钱,如果钱钱不足,直接会丢出去,那本次抽奖将无效 - await _localEventBus.PublishAsync(new MoneyChangeEventArgs { UserId = CurrentUser.Id!.Value, Number = value }, false); - - return index; - } - - private int GetWheelIndex() - { - int[] probabilities = {5 , 30, 40, 30, 20, 10, 4, 3, 2, 1 }; - - int total = 0; - foreach (var prob in probabilities) - { - total += prob; - } - - int randomNum = new Random().Next(1, total + 1); - - int cumulativeProb = 0; - for (int i = 0; i < probabilities.Length; i++) - { - cumulativeProb += probabilities[i]; - if (randomNum <= cumulativeProb) - { - return i; - } - } - var value = probabilities.Length - 1; - return value; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/SettingService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/SettingService.cs deleted file mode 100644 index cb30eeb1..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/SettingService.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Volo.Abp.Application.Services; -using Yi.Framework.Bbs.Application.Contracts.IServices; - -namespace Yi.Framework.Bbs.Application.Services -{ - /// - /// Setting服务实现 - /// - public class SettingService : ApplicationService, - ISettingService - { - - /// - /// 获取头像文件 - /// - /// - public List GetIcon() - { - return Directory.GetFiles("wwwroot/icon").Select(x => "wwwroot/icon/"+ Path.GetFileName(x)).ToList(); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Shop/BbsShopService.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Shop/BbsShopService.cs deleted file mode 100644 index 267a58a3..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Services/Shop/BbsShopService.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Shop; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Shop; -using Yi.Framework.Bbs.Domain.Managers; -using Yi.Framework.Bbs.Domain.Managers.Shop; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Application.Services.Shop; - -/// -/// bbs商城服务 -/// -public class BbsShopService : ApplicationService -{ - private readonly ISqlSugarRepository _repository; - private readonly ISqlSugarRepository _applyRepository; - private readonly BbsShopManager _bbsShopManager; - private readonly ISqlSugarRepository _bbsUserRepository; - private ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService(); - - public BbsShopService(ISqlSugarRepository repository, - ISqlSugarRepository applyRepository, BbsShopManager bbsShopManager, - ISqlSugarRepository bbsUserRepository) - { - _repository = repository; - _applyRepository = applyRepository; - _bbsShopManager = bbsShopManager; - _bbsUserRepository = bbsUserRepository; - } - - //商城列表 - [Authorize] - public async Task> GetListAsync(PagedAndSortedResultRequestDto input) - { - var output = new List(); - var userId = CurrentUser.GetId(); - RefAsync total = 0; - var entities = await _repository._DbQueryable - .Where(x => x.EndTime > DateTime.Now) - .OrderBy(x => x.OrderNum) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - var applyEntities = await _applyRepository.GetListAsync(x => x.UserId == userId); - - foreach (var entity in entities) - { - var dto = entity.Adapt(); - if (entity.GoodsType == GoodsTypeEnum.Apply) - { - //大于限购数量 - if (applyEntities.Count(x => x.GoodsId == entity.Id) >= entity.LimitNumber) - { - dto.IsLimit = true; - } - } - - output.Add(dto); - } - - return new PagedResultDto(total, output); - } - - /// - /// 购买商品 - /// - [Authorize] - public async Task PostBuyAsync([FromBody] BuyShopInputDto input) - { - var userId = CurrentUser.GetId(); - await _bbsShopManager.BuyAsync(userId, input.GoodsId, input.ContactInformation); - } - - /// - /// 获取该用户汇总信息(钱钱、积分、价值) - /// - [Authorize] - public async Task GetAccountAsync() - { - var userId = CurrentUser.GetId(); - var output = new BbsShopAccountDto(); - var money = await _bbsUserRepository._DbQueryable.Where(x => x.UserId == userId).Select(x => x.Money) - .FirstAsync(); - var eto = new SetAccountInfoEto(userId); - await LocalEventBus.PublishAsync(eto, false); - //钱钱累加 - output.Money =money+ eto.Money; - output.Points = eto.Points; - output.Value = eto.Value; - return output; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Yi.Framework.Bbs.Application.csproj b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Yi.Framework.Bbs.Application.csproj deleted file mode 100644 index 7e696380..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/Yi.Framework.Bbs.Application.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/YiFrameworkBbsApplicationModule.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/YiFrameworkBbsApplicationModule.cs deleted file mode 100644 index c5e8ee20..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Application/YiFrameworkBbsApplicationModule.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Volo.Abp.Modularity; -using Yi.Framework.Bbs.Application.Contracts; -using Yi.Framework.Bbs.Domain; -using Yi.Framework.Rbac.Application; - -namespace Yi.Framework.Bbs.Application -{ - [DependsOn(typeof(YiFrameworkBbsDomainModule), - typeof(YiFrameworkBbsApplicationContractsModule), - - - typeof(YiFrameworkRbacApplicationModule) - )] - public class YiFrameworkBbsApplicationModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/AccessLogCacheItem.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/AccessLogCacheItem.cs deleted file mode 100644 index 2c2f61ad..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/AccessLogCacheItem.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Caches; - -public class AccessLogCacheItem -{ - public AccessLogCacheItem(long number) - { - Number = number; - } - - public long Number { get; set; } - public DateTime LastModificationTime { get; set; }=DateTime.Now; - - public DateTime LastInsertTime { get; set; }=DateTime.Now; -} - -public class AccessLogCacheConst -{ - - public const string Key = "AccessLog"; -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/DiscussLableCacheItem.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/DiscussLableCacheItem.cs deleted file mode 100644 index 3d374a7b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/DiscussLableCacheItem.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Caches; - -public class DiscussLableCacheItem -{ - public Guid Id { get; set; } - public string Name { get; set; } - public string? Color { get; set; } - public string? BackgroundColor { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/LevelCacheItem.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/LevelCacheItem.cs deleted file mode 100644 index fe75653b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Caches/LevelCacheItem.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Caches -{ - public class LevelCacheItem - { - public Guid Id { get; set; } - - /// - /// 当前等级 - /// - public int CurrentLevel { get; set; } - - /// - /// 最小所需经验值 - /// - public decimal MinExperience { get; set; } - - /// - /// 等级名称 - /// - public string Name { get; set; } - - /// - /// 等级称号 - /// - public string? Nick { get; set; } - - /// - /// 等候logo - /// - public string? Logo { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/ArticleConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/ArticleConst.cs deleted file mode 100644 index b55d8c59..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/ArticleConst.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Consts -{ - /// - /// 常量定义 - /// - - public class ArticleConst - { - public const string No_Exist = "传入的文章id不存在"; - - public const string No_Permission = "该文章无权限"; - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/CommentConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/CommentConst.cs deleted file mode 100644 index b5719756..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/CommentConst.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Consts -{ - /// - /// 常量定义 - /// - - public class CommentConst - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs deleted file mode 100644 index 05d8aae7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussConst.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Consts -{ - /// - /// 常量定义 - /// - public class DiscussConst - { - public const string Repeat = "创建主题重复"; - public const string No_Exist = "传入的主题id不存在"; - - public const string Privacy = "【私密】您无该主题权限,可联系作者申请开放"; - - public const string AgreeNotice = """ -
-

🍗 您的主题 [{0}] 有 [{1}] 用户点赞!

-
- """; - - public const string CommentNotice = """ -
-

🍖 您的主题 [{0}] 有 [{1}] 用户评论!

-
- """; - - public const string CommentNoticeToReply = """ -
-

🍖 您在主题 [{0}] 的评论有 [{1}] 用户回复!

-
- """; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussLableConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussLableConst.cs deleted file mode 100644 index 0c622228..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/DiscussLableConst.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Consts; - -public class DiscussLableConst -{ - public const string DiscussLableCacheKey="DiscussLable:All"; -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/LabelConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/LabelConst.cs deleted file mode 100644 index a0cfac28..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/LabelConst.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Consts -{ - /// - /// 常量定义 - /// - - public class LabelConst - { - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/LevelConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/LevelConst.cs deleted file mode 100644 index b5bb0b81..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/LevelConst.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Consts -{ - public class LevelConst - { - public const string LevelCacheKey="Level:All"; - - public const string Level_Low_Zero = "经验提升等级低于或等于0"; - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/MoneyConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/MoneyConst.cs deleted file mode 100644 index 2f8a296d..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/MoneyConst.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Consts -{ - public class MoneyConst - { - public const string Money_Low_Zero = "钱钱不足"; - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/PlateConst.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/PlateConst.cs deleted file mode 100644 index cc8bbe00..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Consts/PlateConst.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Consts -{ - /// - /// 常量定义 - /// - - public class PlateConst - { - public const string No_Exist = "传入的板块id不存在"; - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AccessLogTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AccessLogTypeEnum.cs deleted file mode 100644 index 04344ebd..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AccessLogTypeEnum.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Enums; - -public enum AccessLogTypeEnum -{ - /// - /// 首页点击量 - /// - HomeClick, - - /// - /// 接口请求量 - /// - Request -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/ArticleImportTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/ArticleImportTypeEnum.cs deleted file mode 100644 index 1f5a6024..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/ArticleImportTypeEnum.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; - -namespace Yi.Framework.Bbs.Domain.Shared.Enums -{ - [JsonConverter(typeof(StringEnumConverter))] - public enum ArticleImportTypeEnum - { - [Description("默认导入方式")] - Default, - - [Description("vuePresss方式")] - VuePress - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentRequirementTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentRequirementTypeEnum.cs deleted file mode 100644 index 037dd9ff..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentRequirementTypeEnum.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Enums; - -public enum AssignmentRequirementTypeEnum -{ - /// - /// 主题 - /// - Discuss = 2, - - /// - /// 评论 - /// - Comment = 4, - - /// - /// 点赞 - /// - Agree = 8, - - /// - /// 更新昵称 - /// - UpdateNick = 16, - - /// - /// 更新头像 - /// - UpdateIcon = 32, -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentStateEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentStateEnum.cs deleted file mode 100644 index 05418cde..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentStateEnum.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Enums; - -public enum AssignmentStateEnum -{ - /// - /// 正在进行 - /// - Progress, - - /// - /// 已完成 - /// - Completed, - - /// - /// 已过期 - /// - Expired, - - /// - /// 已结束 - /// - End -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentTypeEnum.cs deleted file mode 100644 index 1846716f..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/AssignmentTypeEnum.cs +++ /dev/null @@ -1,73 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Enums; - -public enum AssignmentTypeEnum -{ - /// - /// 新手任务 - /// - Novice, - - /// - /// 每日任务 - /// - Daily, - - /// - /// 每周任务 - /// - Weekly -} - -public static class AssignmentTypeExtension -{ - public static DateTime? GetExpireTime(this AssignmentTypeEnum assignmentType) - { - switch (assignmentType) - { - case AssignmentTypeEnum.Novice: - return null; - case AssignmentTypeEnum.Daily: - return DateTime.Now.Date.AddDays(1); - case AssignmentTypeEnum.Weekly: - DateTime currentDate = DateTime.Now; // 获取当前日期和时间 - // 计算今天是周几 - int daysUntilNextMonday = ((int)DayOfWeek.Monday - (int)currentDate.DayOfWeek + 7) % 7; - // 如果今天是周一,则获取下下周一 - if (daysUntilNextMonday == 0) - { - daysUntilNextMonday = 7; - } - // 计算下个周一的日期 - DateTime nextMonday = currentDate.AddDays(daysUntilNextMonday); - // 返回下个周一的凌晨 0 点时间 - return nextMonday.Date; - default: - throw new ArgumentOutOfRangeException(nameof(assignmentType), assignmentType, null); - } - } - - public static bool IsExpire(this AssignmentTypeEnum assignmentType,DateTime time) - { - switch (assignmentType) - { - case AssignmentTypeEnum.Novice: - return false; - case AssignmentTypeEnum.Daily: - //昨天之前发的,算过期 - return time.Date < DateTime.Now.Date; - case AssignmentTypeEnum.Weekly: - // 获取当前日期 - DateTime now = DateTime.Now; - // 计算本周一的日期 - int daysToSubtract = (int)now.DayOfWeek - (int)DayOfWeek.Monday; - if (daysToSubtract < 0) daysToSubtract += 7; // 如果今天是周日,则需要调整 - DateTime startOfWeek = now.AddDays(-daysToSubtract).Date; - // 获取本周一的凌晨 00:00 - DateTime mondayMidnight = startOfWeek; // .Date 默认为 00:00 - //本周一之前发的 - return time - /// 默认:公开 - /// - Public = 0, - - /// - /// 角色要求可见 - /// - Role=1 - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/DiscussTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/DiscussTypeEnum.cs deleted file mode 100644 index 5d9bfbe3..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/DiscussTypeEnum.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Enums; - -/// -/// 主题类型 -/// -public enum DiscussTypeEnum -{ - /// - /// 文章 - /// - Article = 0, - - /// - /// 悬赏 - /// - Reward=1 -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/GoodsTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/GoodsTypeEnum.cs deleted file mode 100644 index f765af01..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/GoodsTypeEnum.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Enums; - -public enum GoodsTypeEnum -{ - /// - /// 申请类型 - /// - Apply -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/NoticeTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/NoticeTypeEnum.cs deleted file mode 100644 index 2178ea56..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/NoticeTypeEnum.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Enums -{ - /// - /// 消息类型 - /// - public enum NoticeTypeEnum - { - /// - /// 个人 - /// - Personal, - /// - /// 广播 - /// - Broadcast, - - /// - /// 钱钱 - /// - Money - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/QueryDiscussTypeEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/QueryDiscussTypeEnum.cs deleted file mode 100644 index d0b6ae43..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/QueryDiscussTypeEnum.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Enums -{ - public enum QueryDiscussTypeEnum - { - New, - Suggest, - Host - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/UserLimitEnum.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/UserLimitEnum.cs deleted file mode 100644 index adc5e927..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Enums/UserLimitEnum.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Enums -{ - - public enum UserLimitEnum - { - /// - /// 正常 - /// - Normal, - - /// - /// 危险 - /// - Dangerous, - - /// - /// 已禁止 - /// - Ban - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/AccessLogResetArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/AccessLogResetArgs.cs deleted file mode 100644 index 8e46aa1b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/AccessLogResetArgs.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Etos; - -public class AccessLogResetArgs -{ - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/AssignmentEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/AssignmentEventArgs.cs deleted file mode 100644 index 240e7e50..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/AssignmentEventArgs.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Shared.Etos; - -public class AssignmentEventArgs -{ - public AssignmentEventArgs(AssignmentRequirementTypeEnum requirementType, Guid currentUserId,object? args=null) - { - RequirementType = requirementType; - Args = args; - CurrentUserId = currentUserId; - } - - /// - /// 任务需求类型 - /// - public AssignmentRequirementTypeEnum RequirementType { get; set; } - - - /// - /// 任务参数,可空,只需要一个触发点即可 - /// - public object? Args { get; set; } - - - /// - /// 当前用户id - /// - public Guid CurrentUserId { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BbsNoticeEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BbsNoticeEventArgs.cs deleted file mode 100644 index 4b7cd979..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BbsNoticeEventArgs.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Shared.Etos -{ - public class BbsNoticeEventArgs - { - /// - /// 发送个人消息 - /// - /// - /// - public BbsNoticeEventArgs(Guid acceptUserId, string message) - { - NoticeType = NoticeTypeEnum.Personal; - AcceptUserId = acceptUserId; - Message = message; - } - - public BbsNoticeEventArgs( NoticeTypeEnum noticeType, Guid acceptUserId, string message) - { - NoticeType = noticeType; - AcceptUserId = acceptUserId; - Message = message; - } - - /// - /// 发送广播 - /// - /// - public BbsNoticeEventArgs(string message) - { - NoticeType = NoticeTypeEnum.Broadcast; - Message = message; - } - public NoticeTypeEnum NoticeType { get; private set; } - - public string Message { get; private set; } - - public Guid? AcceptUserId { get; private set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BindAccountEto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BindAccountEto.cs deleted file mode 100644 index 0ab6ad5b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/BindAccountEto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Etos; - -/// -/// 临时用户绑定到正式用户 -/// -public class BindAccountEto -{ - public Guid NewUserId { get; set; } - public Guid OldUserId { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/ExperienceChangeEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/ExperienceChangeEventArgs.cs deleted file mode 100644 index 1cebd2c7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/ExperienceChangeEventArgs.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Etos -{ - public class ExperienceChangeEventArgs - { - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 变化经验,可负 - /// - public decimal Number { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/MoneyChangeEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/MoneyChangeEventArgs.cs deleted file mode 100644 index 4130ae63..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/MoneyChangeEventArgs.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using static System.Runtime.InteropServices.JavaScript.JSType; - -namespace Yi.Framework.Bbs.Domain.Shared.Etos -{ - public class MoneyChangeEventArgs - { - public MoneyChangeEventArgs() { } - public MoneyChangeEventArgs(Guid userId, decimal changeNumber) { UserId = userId; - - Number = Math.Round(changeNumber, 2); } - - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 变化金额,可负 - /// - public decimal Number { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/SeeDiscussEventArgs.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/SeeDiscussEventArgs.cs deleted file mode 100644 index 7273428f..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/SeeDiscussEventArgs.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Etos -{ - public class SeeDiscussEventArgs - { - public Guid DiscussId { get; set; } - public int OldSeeNum { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/SetAccountInfoEto.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/SetAccountInfoEto.cs deleted file mode 100644 index ab09799c..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Etos/SetAccountInfoEto.cs +++ /dev/null @@ -1,27 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Shared.Etos; - -public class SetAccountInfoEto -{ - public SetAccountInfoEto(Guid userId) - { - UserId = userId; - } - - public Guid UserId { get; set; } - - - /// - /// 钱钱 - /// - public decimal Money { get; set; } - - /// - /// 积分 - /// - public int Points { get; set; } - - /// - /// 价值 - /// - public decimal Value { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Model/FileObject.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Model/FileObject.cs deleted file mode 100644 index c0cd5580..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Model/FileObject.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Model -{ - public class FileObject - { - public string Content { get; set; } - public string FileName { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Model/HubUserModel.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Model/HubUserModel.cs deleted file mode 100644 index d23a6d9d..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Model/HubUserModel.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Shared.Model -{ - /// - /// 消息通知存储用户信息 - /// - public class HubUserModel - { - public HubUserModel(string connnectionId,Guid userId) - { - ConnnectionId = connnectionId; - UserId = userId; - } - - /// - /// 客户端连接Id - /// - public string? ConnnectionId { get; } - /// - /// 用户id - /// - public Guid? UserId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Yi.Framework.Bbs.Domain.Shared.csproj b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Yi.Framework.Bbs.Domain.Shared.csproj deleted file mode 100644 index 131d2ecb..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/Yi.Framework.Bbs.Domain.Shared.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/YiFrameworkBbsDomainSharedModule.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/YiFrameworkBbsDomainSharedModule.cs deleted file mode 100644 index 3851fc70..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain.Shared/YiFrameworkBbsDomainSharedModule.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Volo.Abp.Modularity; -using Yi.Framework.Rbac.Domain.Shared; - -namespace Yi.Framework.Bbs.Domain.Shared -{ - [DependsOn( - typeof(YiFrameworkRbacDomainSharedModule))] - public class YiFrameworkBbsDomainSharedModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/AccessLogAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/AccessLogAggregateRoot.cs deleted file mode 100644 index b0a0c0ee..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/AccessLogAggregateRoot.cs +++ /dev/null @@ -1,19 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Entities -{ - [SugarTable("AccessLog")] - public class AccessLogAggregateRoot : AggregateRoot, IHasCreationTime,IHasModificationTime - { - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public long Number { get; set; } - - public AccessLogTypeEnum AccessLogType { get; set; } - public DateTime CreationTime { get; set; } - public DateTime? LastModificationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Assignment/AssignmentAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Assignment/AssignmentAggregateRoot.cs deleted file mode 100644 index da02345e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Assignment/AssignmentAggregateRoot.cs +++ /dev/null @@ -1,88 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Core.Data; - -namespace Yi.Framework.Bbs.Domain.Entities.Assignment; - -/// -/// 任务实例表 -/// -[SugarTable("Assignment")] -public class AssignmentAggregateRoot : AggregateRoot, IHasCreationTime, IOrderNum, IHasModificationTime -{ - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - /// - /// 任务定义ID - /// - public Guid AssignmentDefineId { get; set; } - - /// - /// 任务接收者用户id - /// - public Guid UserId { get; set; } - - /// - /// 当前步骤数 - /// - public int CurrentStepNumber { get; set; } - - /// - /// 总共步骤数 - /// - public int TotalStepNumber { get; set; } - - /// - /// 任务状态 - /// - public AssignmentStateEnum AssignmentState { get; set; } - - /// - /// 任务奖励的钱钱数量 - /// - public decimal RewardsMoneyNumber { get; set; } - - /// - /// 任务过期时间 - /// - public DateTime? ExpireTime { get; set; } - - /// - /// 任务需求类型 - /// - public AssignmentRequirementTypeEnum AssignmentRequirementType { get; set; } - - public DateTime? EndTime { get; set; } - - - public DateTime CreationTime { get; set; } - public int OrderNum { get; set; } - public DateTime? LastModificationTime { get; set; } - - - public bool IsAllowCompleted() - { - return AssignmentState == AssignmentStateEnum.Completed && this.CurrentStepNumber == this.TotalStepNumber; - } - - public bool TrySetExpire() - { - if (ExpireTime <= DateTime.Now) - { - //现在时间已经大于过期时间 - AssignmentState = AssignmentStateEnum.Expired; - return true; - } - - return false; - } - - public void SetEnd() - { - this.AssignmentState = AssignmentStateEnum.End; - this.EndTime = DateTime.Now; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Assignment/AssignmentDefineAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Assignment/AssignmentDefineAggregateRoot.cs deleted file mode 100644 index 52d6aa9e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Assignment/AssignmentDefineAggregateRoot.cs +++ /dev/null @@ -1,56 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Core.Data; - -namespace Yi.Framework.Bbs.Domain.Entities.Assignment; - -/// -/// 任务定义表 -/// -[SugarTable("AssignmentDefine")] - -public class AssignmentDefineAggregateRoot: AggregateRoot, IHasCreationTime,IOrderNum -{ - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - /// - /// 任务名称 - /// - public string Name { get; set; } - - /// - /// 备注 - /// - public string Remarks { get; set; } - - /// - /// 任务类型 - /// - public AssignmentTypeEnum AssignmentType{ get; set; } - - /// - /// 任务需求类型 - /// - public AssignmentRequirementTypeEnum AssignmentRequirementType{ get; set; } - - /// - /// 总共步骤数 - /// - public int TotalStepNumber { get; set; } - - /// - /// 前置任务id - /// - public Guid? PreAssignmentId { get; set; } - - /// - /// 任务奖励的钱钱数量 - /// - public decimal RewardsMoneyNumber { get; set; } - - public DateTime CreationTime{ get; set; } - public int OrderNum { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/BankCardAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/BankCardAggregateRoot.cs deleted file mode 100644 index 5b2e99a2..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/BankCardAggregateRoot.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Entities.Bank -{ - /// - /// 银行卡 - /// - [SugarTable("BankCard")] - public class BankCardAggregateRoot : AggregateRoot, IHasCreationTime - { - public BankCardAggregateRoot() - { - } - - public BankCardAggregateRoot(Guid userId) - { - this.UserId = userId; - } - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public DateTime CreationTime { get; set; } - - /// - /// 上一次存款日期 - /// - public DateTime? LastDepositTime { get; set; } - - /// - /// 上一次取款日期 - /// - public DateTime? LastDrawTime { get; set; } - - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 当前存储的钱 - /// - public decimal StorageMoney { get; set; } = 0; - - - /// - /// 最大可存储的钱钱 - /// - public decimal MaxStorageMoney { get; set; } = 100; - - - /// - /// 满期限时间,可空 - /// - public DateTime? FulltermTime { get; set; } - - - - - /// - /// 银行卡状态 - /// - public BankCardStateEnum BankCardState { get; set; } = BankCardStateEnum.Unused; - - public bool IsStorageFull() - { - if (FulltermTime is null) - { - return false; - } - return DateTime.Now >= FulltermTime; - } - public void SetDrawMoney() - { - this.BankCardState = BankCardStateEnum.Unused; - - LastDrawTime = DateTime.Now; - this.FulltermTime = null; - this.StorageMoney = 0; - } - public void SetStorageMoney(decimal storageMoney) - { - if (storageMoney > MaxStorageMoney) - { - throw new UserFriendlyException($"存款数不能大于该卡的上限-【{MaxStorageMoney}】钱钱"); - } - - StorageMoney = storageMoney; - - LastDepositTime = DateTime.Now; - FulltermTime = LastDepositTime + TimeSpan.FromDays(3); - this.BankCardState = BankCardStateEnum.Wait; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/InterestRecordsAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/InterestRecordsAggregateRoot.cs deleted file mode 100644 index 1ce5d5e4..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Bank/InterestRecordsAggregateRoot.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Bank -{ - /// - /// 利息记录 - /// - [SugarTable("InterestRecords")] - public class InterestRecordsAggregateRoot : AggregateRoot, IHasCreationTime - { - public InterestRecordsAggregateRoot() - { } - public InterestRecordsAggregateRoot(decimal comparisonValue, decimal inputValue, bool isFluctuate = false) - { - ComparisonValue = comparisonValue; - Value = inputValue; - IsFluctuate = isFluctuate; - } - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public DateTime CreationTime { get; set; } - - /// - /// 第三方的比较值 - /// - public decimal ComparisonValue { get; set; } - - /// - /// 当前汇率值 - /// - public decimal Value { get; set; } - - /// - /// 是否波动期 - /// - public bool IsFluctuate { get; set; } - - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs deleted file mode 100644 index 707187ea..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsNoticeAggregateRoot.cs +++ /dev/null @@ -1,59 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Entities -{ - [SugarTable("BbsNotice")] - public class BbsNoticeAggregateRoot : AggregateRoot, IHasCreationTime - { - public BbsNoticeAggregateRoot() - { - - } - public BbsNoticeAggregateRoot(NoticeTypeEnum noticeType, string message, Guid? acceptUserId = null) - { - this.NoticeType = noticeType; - this.Message = message; - this.AcceptUserId = acceptUserId; - - } - /// - /// 设置已读 - /// - public void SetRead() - { - IsRead = true; - this.ReadTime = DateTime.Now; - } - - - public Guid? AcceptUserId { get; } - - /// - /// 消息,支持html - /// - [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)] - public string Message { get; set; } - - /// - /// 消息类型 - /// - public NoticeTypeEnum NoticeType { get; } - - /// - /// 是否已读 - /// - public bool IsRead { get; private set; } - - /// - /// 已读时间 - /// - public DateTime? ReadTime { get; private set; } - - public DateTime CreationTime { get; set; } - } - - -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsUserExtraInfoEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsUserExtraInfoEntity.cs deleted file mode 100644 index a8e59386..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/BbsUserExtraInfoEntity.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Entities -{ - /// - /// bbs用户表 - /// - [SugarTable("BbsUserExtraInfo")] - [SugarIndex($"index_{nameof(UserId)}", nameof(UserId), OrderByType.Asc)] - public class BbsUserExtraInfoEntity : Entity - { - public BbsUserExtraInfoEntity() { } - - public BbsUserExtraInfoEntity(Guid userId) { this.UserId = userId; } - - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 用户限制 - /// - public UserLimitEnum UserLimit { get; set; } = UserLimitEnum.Normal; - - - /// - /// 用户等级 - /// - public int Level { get; set; } = 1; - - /// - /// 钱钱 - /// - public decimal Money { get; set; } = 0m; - - - /// - /// 经验 - /// - public long Experience { get; set; } = 0; - - /// - /// 发表主题数 - /// - public int DiscussNumber { get; set; } - - /// - /// 发表主题数 - /// - public int CommentNumber { get; set; } - - - /// - /// 被点赞数 - /// - public int AgreeNumber { get; set; } - } - -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/AgreeEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/AgreeEntity.cs deleted file mode 100644 index 2ddaf620..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/AgreeEntity.cs +++ /dev/null @@ -1,36 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - [SugarTable("Agree")] - [SugarIndex($"index_{nameof(CreatorId)}_{nameof(DiscussId)}", nameof(CreatorId), OrderByType.Asc, - nameof(DiscussId), OrderByType.Asc)] - public class AgreeEntity : Entity, ICreationAuditedObject - { - public AgreeEntity() - { - } - - public AgreeEntity(Guid discussId) - { - DiscussId = discussId; - } - - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public DateTime CreationTime { get; set; } - - /// - /// 主题id - /// - public Guid DiscussId { get; set; } - - /// - /// 创建者 - /// - public Guid? CreatorId { get; set; } - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/ArticleAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/ArticleAggregateRoot.cs deleted file mode 100644 index ea3483f7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/ArticleAggregateRoot.cs +++ /dev/null @@ -1,74 +0,0 @@ -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - [SugarTable("Article")] - [SugarIndex($"index_{nameof(Name)}", nameof(Name), OrderByType.Asc)] - [SugarIndex($"index_{nameof(ParentId)}", nameof(ParentId), OrderByType.Asc)] - [SugarIndex($"index_{nameof(DiscussId)}", nameof(DiscussId), OrderByType.Asc)] - public class ArticleAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject - { - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public bool IsDeleted { get; set; } - - [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)] - public string Content { get; set; } - public string Name { get; set; } - - - public Guid DiscussId { get; set; } - - public Guid ParentId { get; set; } - - [SugarColumn(IsIgnore = true)] - - public List? Children { get; set; } - - - public DateTime CreationTime { get; set; } - - public Guid? CreatorId { get; set; } - - public Guid? LastModifierId { get; set; } - - public DateTime? LastModificationTime { get; set; } - - /// - /// 排序 - /// - public int OrderNum { get; set; } = 0; - } - - public static class ArticleEntityExtensions - { - /// - /// 平铺自己 - /// - /// - /// - public static List Tile(this List entities) - { - if (entities is null) return new List(); - var result = new List(); - return StartRecursion(entities, result); - } - - private static List StartRecursion(List entities, List result) - { - foreach (var entity in entities) - { - result.Add(entity); - if (entity.Children is not null && entity.Children.Where(x => x.IsDeleted == false).Count() > 0) - { - StartRecursion(entity.Children, result); - } - } - return result; - } - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/BannerAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/BannerAggregateRoot.cs deleted file mode 100644 index 89359502..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/BannerAggregateRoot.cs +++ /dev/null @@ -1,25 +0,0 @@ -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - [SugarTable("Banner")] - public class BannerAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject - { - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public string Name { get; set; } - public string? Logo { get; set; } - public string? Color { get; set; } - public bool IsDeleted { get; set; } - public DateTime CreationTime { get; set; } - - public Guid? CreatorId { get; set; } - - public Guid? LastModifierId { get; set; } - - public DateTime? LastModificationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/CommentAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/CommentAggregateRoot.cs deleted file mode 100644 index a1f572a0..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/CommentAggregateRoot.cs +++ /dev/null @@ -1,69 +0,0 @@ -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Rbac.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - - /// - /// 评论表 - /// - [SugarTable("Comment")] - [SugarIndex($"index_{nameof(DiscussId)}", nameof(DiscussId), OrderByType.Asc)] - [SugarIndex($"index_{nameof(ParentId)}", nameof(ParentId), OrderByType.Asc)] - public class CommentAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject - { - /// - /// 采用二维数组方式,不使用树形方式 - /// - public CommentAggregateRoot() - { - } - - public CommentAggregateRoot(Guid discussId) - { - DiscussId = discussId; - } - - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public bool IsDeleted { get; set; } - - [SugarColumn(Length = 2000)] - public string Content { get; set; } - - public Guid DiscussId { get; set; } - - /// - /// 被回复的CommentId - /// - public Guid ParentId { get; set; } - public DateTime CreationTime { get; set; } - - public Guid RootId { get; set; } - - [SugarColumn(IsIgnore = true)] - public List Children { get; set; } = new(); - - - /// - /// 用户,评论人用户信息 - /// - [Navigate(NavigateType.OneToOne, nameof(CreatorId))] - public UserAggregateRoot CreateUser { get; set; } - - /// - /// 被评论的用户信息 - /// - [SugarColumn(IsIgnore = true)] - public UserAggregateRoot CommentedUser { get; set; } - - public Guid? CreatorId { get; set; } - - public Guid? LastModifierId { get; set; } - - public DateTime? LastModificationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussAggregateRoot.cs deleted file mode 100644 index b363161b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussAggregateRoot.cs +++ /dev/null @@ -1,91 +0,0 @@ -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - [SugarTable("Discuss")] - [SugarIndex($"index_{nameof(Title)}", nameof(Title), OrderByType.Asc)] - [SugarIndex($"index_{nameof(CreationTime)}", nameof(CreationTime), OrderByType.Desc)] - [SugarIndex($"index_{nameof(IsDeleted)}_{nameof(PlateId)}_{nameof(CreatorId)}", - nameof(IsDeleted), OrderByType.Asc, - nameof(PlateId), OrderByType.Asc, - nameof(CreatorId), OrderByType.Asc - )] - public class DiscussAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject - { - public DiscussAggregateRoot() - { - } - public DiscussAggregateRoot(Guid plateId) - { - PlateId = plateId; - } - - public void AddSeeNumber() - { - this.SeeNum += 1; - //设置最小值,不更新 - this.LastModificationTime = DateTime.MinValue; - //设置空值,不更新 - this.LastModifierId = Guid.Empty; - } - - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - public string? Title { get; set; } - public string? Introduction { get; set; } - public int AgreeNum { get; set; } - public int SeeNum { get; set; } - - /// - /// 主题类型 - /// - public DiscussTypeEnum DiscussType { get; set; } - /// - /// 封面 - /// - public string? Cover { get; set; } - - [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)] - public string Content { get; set; } - - public string? Color { get; set; } - - public bool IsDeleted { get; set; } - - //是否置顶,默认false - public bool IsTop { get; set; } - - public int OrderNum { get; set; } = 0; - - - public DiscussPermissionTypeEnum PermissionType { get; set; } - - public Guid PlateId { get; set; } - public DateTime CreationTime { get; set; } - - public Guid? CreatorId { get; set; } - - public Guid? LastModifierId { get; set; } - - public DateTime? LastModificationTime { get; set; } - - - /// - /// 当PermissionType为角色时候,以下列表中的角色+创建者 代表拥有权限 - /// - [SugarColumn(IsJson = true)] //使用json处理 - public List? PermissionRoleCodes { get; set; } = new List(); - - [SugarColumn(IsJson = true)]//使用json处理 - public List? DiscussLableIds{ get; set; } - - /// - /// 是否禁止评论创建功能 - /// - public bool IsDisableCreateComment { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussLableAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussLableAggregateRoot.cs deleted file mode 100644 index 7fd6362a..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussLableAggregateRoot.cs +++ /dev/null @@ -1,16 +0,0 @@ -using SqlSugar; -using Volo.Abp; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - [SugarTable("DiscussLable")] - public class DiscussLableAggregateRoot : AggregateRoot, ISoftDelete - { - public bool IsDeleted { get; set; } - - public string Name { get; set; } - public string? Color { get; set; } - public string? BackgroundColor { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussRewardAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussRewardAggregateRoot.cs deleted file mode 100644 index c0a222f7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussRewardAggregateRoot.cs +++ /dev/null @@ -1,38 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Domain.Entities.Auditing; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum; - -[SugarTable("DiscussReward")] -[SugarIndex($"index_{nameof(DiscussId)}", nameof(DiscussId), OrderByType.Asc)] -public class DiscussRewardAggregateRoot : FullAuditedAggregateRoot -{ - public Guid DiscussId { get; set; } - - /// - /// 是否已解决 - /// - public bool IsResolved{ get; set; } - - /// - /// 悬赏最小价值 - /// - public decimal? MinValue { get; set; } - - /// - /// 悬赏最大价值 - /// - public decimal? MaxValue { get; set; } - - /// - /// 作者联系方式 - /// - public string Contact { get; set; } - - public void SetResolved() - { - IsResolved = true; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussTopEntity.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussTopEntity.cs deleted file mode 100644 index 4ce74c77..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/DiscussTopEntity.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - /// - /// 首页置顶主题 - /// - [SugarTable("DiscussTop")] - public class DiscussTopEntity : Entity, IHasModificationTime - { - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - public int OrderNum { get; set; } - - public Guid DiscussId { get; set; } - - public DateTime? LastModificationTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/PlateAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/PlateAggregateRoot.cs deleted file mode 100644 index a0cbf353..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Forum/PlateAggregateRoot.cs +++ /dev/null @@ -1,38 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities; -using Volo.Abp; -using Volo.Abp.Auditing; - -namespace Yi.Framework.Bbs.Domain.Entities.Forum -{ - [SugarTable("Plate")] - public class PlateAggregateRoot : AggregateRoot, ISoftDelete, IAuditedObject - { - - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - public string Code { get; set; } - public string Name { get; set; } - public string? Logo { get; set; } - public string? Introduction { get; set; } - public bool IsDeleted { get; set; } - - - - public DateTime CreationTime { get; set; } - - public Guid? CreatorId { get; set; } - - public Guid? LastModifierId { get; set; } - - public DateTime? LastModificationTime { get; set; } - - public int OrderNum { get; set; } - - /// - /// 是否禁用创建主题,禁用后,只有管理员或者权限者能够发送 - /// - public bool IsDisableCreateDiscuss { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/LevelAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/LevelAggregateRoot.cs deleted file mode 100644 index e755a701..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/LevelAggregateRoot.cs +++ /dev/null @@ -1,52 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Integral -{ - /// - /// 等级表 - /// - [SugarTable("Level")] - public class LevelAggregateRoot : AggregateRoot - { - public LevelAggregateRoot() { } - - public LevelAggregateRoot(int currentLevel, string name, decimal minExperience) - { - this.CurrentLevel = currentLevel; - this.Name = name; - this.MinExperience = minExperience; - } - - [SugarColumn(IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - - /// - /// 当前等级 - /// - public int CurrentLevel { get; set; } - - /// - /// 最小所需经验值 - /// - public decimal MinExperience { get; set; } - - /// - /// 等级名称 - /// - public string Name { get; set; } - - /// - /// 等级称号 - /// - public string? Nick { get; set; } - - /// - /// 等候logo - /// - public string? Logo { get; set; } - - } - -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/SignInAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/SignInAggregateRoot.cs deleted file mode 100644 index ed4bf396..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Integral/SignInAggregateRoot.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Integral -{ - /// - /// 签到表 - /// - [SugarTable("SignIn")] - - [SugarIndex($"index_{nameof(CreatorId)}", nameof(CreatorId), OrderByType.Asc)] - public class SignInAggregateRoot : AggregateRoot, ICreationAuditedObject - { - - [SugarColumn(IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - /// - /// 签到时间 - /// - public DateTime CreationTime { get; set; } - - //签到用户 - public Guid? CreatorId { get; set; } - - /// - /// 连续签到次数 - /// - public int ContinuousNumber { get; set; } = 1; - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/BbsGoodsAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/BbsGoodsAggregateRoot.cs deleted file mode 100644 index 8b2e99b6..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/BbsGoodsAggregateRoot.cs +++ /dev/null @@ -1,76 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Core.Data; - -namespace Yi.Framework.Bbs.Domain.Entities.Shop; - -/// -/// 商品定义表 -/// -[SugarTable("BbsGoods")] -public class BbsGoodsAggregateRoot: AggregateRoot, IHasCreationTime,IOrderNum -{ - /// - /// 上架时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 商品类型 - /// - public GoodsTypeEnum GoodsType{ get; set; } - - /// - /// 下架时间 - /// - public DateTime? EndTime { get; set; } - - /// - /// 商品名称 - /// - public string Name { get; set; } - - /// - /// 每人限购数量 - /// - public int LimitNumber { get; set; } - - /// - /// 当前库存数量 - /// - public int StockNumber { get; set; } - - /// - /// 商品图片url - /// - public string ImageUrl { get; set; } - - /// - /// 描述 - /// - public string Describe { get; set; } - - /// - /// 编号 - /// - public string Code { get; set; } - - /// - /// 所需钱钱 - /// - public decimal NeedMoney { get; set; } - - /// - /// 所需价值 - /// - public decimal NeedValue { get; set; } - - /// - /// 所需积分 - /// - public decimal NeedPoints { get; set; } - - public int OrderNum { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/BbsGoodsApplyAggregateRoot.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/BbsGoodsApplyAggregateRoot.cs deleted file mode 100644 index c09430a8..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/BbsGoodsApplyAggregateRoot.cs +++ /dev/null @@ -1,32 +0,0 @@ -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.Bbs.Domain.Entities.Shop; - -/// -/// 商品申请记录表 -/// -[SugarTable("BbsGoodsApply")] -public class BbsGoodsApplyAggregateRoot: AggregateRoot, IHasCreationTime -{ - /// - /// 商品id - /// - public Guid GoodsId { get; set; } - - /// - /// 申请时间 - /// - public DateTime CreationTime { get; set; } - - /// - /// 申请人用户id - /// - public Guid UserId { get; set; } - - /// - /// 联系方式 - /// - public string ContactInformation { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/ValueObjects/ShippingAddress.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/ValueObjects/ShippingAddress.cs deleted file mode 100644 index 4aa44f3b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Entities/Shop/ValueObjects/ShippingAddress.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Yi.Framework.Bbs.Domain.Entities.Shop.ValueObjects; - -public class ShippingAddress -{ - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangeEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangeEventHandler.cs deleted file mode 100644 index 7cbeb58d..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AgreeChangeEventHandler.cs +++ /dev/null @@ -1,106 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers -{ - /// - /// 被点赞 - /// - public class AgreeChangeEventHandler : ILocalEventHandler>, - ITransientDependency - { - private ISqlSugarRepository _userRepository; - private ISqlSugarRepository _userInfoRepository; - private ISqlSugarRepository _agreeRepository; - private ILocalEventBus _localEventBus; - - public AgreeChangeEventHandler(ISqlSugarRepository userInfoRepository, - ISqlSugarRepository agreeRepository, ILocalEventBus localEventBus, - ISqlSugarRepository userRepository) - { - _userInfoRepository = userInfoRepository; - _agreeRepository = agreeRepository; - _localEventBus = localEventBus; - _userRepository = userRepository; - } - - public async Task HandleEventAsync(EntityCreatedEventData eventData) - { - var agreeEntity = eventData.Entity; - - //查询主题的信息 - var discussAndAgreeDto = await _agreeRepository._DbQueryable - .Where(agree=>agree.Id==agreeEntity.Id) - .LeftJoin((agree, discuss) => agree.DiscussId == discuss.Id) - .Select((agree, discuss) => - new - { - DiscussId = discuss.Id, - DiscussTitle = discuss.Title, - DiscussCreatorId = discuss.CreatorId, - }) - .FirstAsync(); - - //查询点赞者用户 - var agreeUser = await _userRepository.GetFirstAsync(x => x.Id == agreeEntity.CreatorId); - - //给创建者点赞数量+1 - await _userInfoRepository._Db.Updateable() - .SetColumns(it => it.AgreeNumber == it.AgreeNumber + 1) - .Where(it => it.UserId == discussAndAgreeDto.DiscussCreatorId) - .ExecuteCommandAsync(); - - //通知主题作者,有人点赞 - await _localEventBus.PublishAsync( - new BbsNoticeEventArgs(discussAndAgreeDto.DiscussCreatorId!.Value, - string.Format(DiscussConst.AgreeNotice, discussAndAgreeDto.DiscussTitle, agreeUser.UserName, - discussAndAgreeDto.DiscussId)), false); - - //最后发布任务触发事件 - await _localEventBus.PublishAsync( - new AssignmentEventArgs(AssignmentRequirementTypeEnum.Agree, agreeUser.Id),false); - } - } - - /// - /// 取消点赞 - /// - public class AgreeDeletedEventHandler : ILocalEventHandler>, - ITransientDependency - { - private ISqlSugarRepository _userRepository; - private ISqlSugarRepository _agreeRepository; - private ILocalEventBus _localEventBus; - - public AgreeDeletedEventHandler(ISqlSugarRepository userRepository, - ISqlSugarRepository agreeRepository, ILocalEventBus localEventBus) - { - _userRepository = userRepository; - _agreeRepository = agreeRepository; - _localEventBus = localEventBus; - } - - public async Task HandleEventAsync(EntityDeletedEventData eventData) - { - var agreeEntity = eventData.Entity; - var userId = await _agreeRepository._DbQueryable - .LeftJoin((agree, discuss) => agree.DiscussId == discuss.Id) - .Select((agree, discuss) => discuss.CreatorId).FirstAsync(); - - //给创建者点赞数量-1 - await _userRepository._Db.Updateable() - .SetColumns(it => it.AgreeNumber == it.AgreeNumber - 1) - .Where(it => it.UserId == userId) - .ExecuteCommandAsync(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AssignmentEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AssignmentEventHandler.cs deleted file mode 100644 index e7cd3f07..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/AssignmentEventHandler.cs +++ /dev/null @@ -1,88 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Entities.Assignment; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers; - -/// -/// 任务系统的领域事件,处理不同任务触发变化 -/// -public class AssignmentEventHandler : ILocalEventHandler, ITransientDependency -{ - private readonly ISqlSugarRepository _repository; - - public AssignmentEventHandler(ISqlSugarRepository repository) - { - _repository = repository; - } - - public async Task HandleEventAsync(AssignmentEventArgs eventData) - { - var currentAssignmentList = await _repository.GetListAsync(x => - x.AssignmentState == AssignmentStateEnum.Progress && x.UserId == eventData.CurrentUserId); - - //如果有接收的任务 - if (currentAssignmentList.Count > 0) - { - switch (eventData.RequirementType) - { - //发表主题 - case AssignmentRequirementTypeEnum.Discuss: - SetCurrentStepNumber(AssignmentRequirementTypeEnum.Discuss, currentAssignmentList); - break; - - //发表评论 - case AssignmentRequirementTypeEnum.Comment: - SetCurrentStepNumber(AssignmentRequirementTypeEnum.Comment, currentAssignmentList); - break; - - //点赞 - case AssignmentRequirementTypeEnum.Agree: - SetCurrentStepNumber(AssignmentRequirementTypeEnum.Agree, currentAssignmentList); - break; - - //更新昵称 - case AssignmentRequirementTypeEnum.UpdateNick: - SetCurrentStepNumber(AssignmentRequirementTypeEnum.UpdateNick, currentAssignmentList); - break; - - //更新头像 - case AssignmentRequirementTypeEnum.UpdateIcon: - SetCurrentStepNumber(AssignmentRequirementTypeEnum.UpdateIcon, currentAssignmentList); - break; - - default: - throw new ArgumentOutOfRangeException(); - } - - - //更新 - await _repository.UpdateRangeAsync(currentAssignmentList); - } - } - - /// - /// 设置当前进度 - /// - /// - /// - private void SetCurrentStepNumber(AssignmentRequirementTypeEnum requirementType, - List currentAssignmentList) - { - currentAssignmentList.ForEach(x => - { - if (x.AssignmentRequirementType == requirementType && - x.CurrentStepNumber < x.TotalStepNumber) - { - x.CurrentStepNumber += 1; - if (x.CurrentStepNumber == x.TotalStepNumber) - { - x.AssignmentState = AssignmentStateEnum.Completed; - } - } - }); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs deleted file mode 100644 index dc3043c6..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BbsNoticeSendEventHandler.cs +++ /dev/null @@ -1,64 +0,0 @@ -using Microsoft.AspNetCore.SignalR; -using SqlSugar; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Bbs.Domain.SignalRHubs; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers -{ - /// - /// bbs消息推送处理 - /// - public class BbsNoticeSendEventHandler : ILocalEventHandler, - ITransientDependency - { - private IHubContext _hubContext; - private ISqlSugarRepository _repository; - public BbsNoticeSendEventHandler(IHubContext hubContext, ISqlSugarRepository sugarRepository) - { - _hubContext = hubContext; - _repository = sugarRepository; - } - public async Task HandleEventAsync(BbsNoticeEventArgs eventData) - { - - - //是否需要离线存储 - bool isStore = true; - var now = DateTime.Now; - switch (eventData.NoticeType) - { - case Shared.Enums.NoticeTypeEnum.Personal: - if (BbsNoticeHub.HubUserModels.TryGetValue(eventData.AcceptUserId.ToString(), out var hubUserModel)) - { - _hubContext.Clients.Client(hubUserModel.ConnnectionId).SendAsync(NoticeTypeEnum.Personal.ToString(), eventData.Message,now); - } - break; - case Shared.Enums.NoticeTypeEnum.Broadcast: - _hubContext.Clients.All.SendAsync(NoticeTypeEnum.Broadcast.ToString(), eventData.Message); - break; - - case Shared.Enums.NoticeTypeEnum.Money: - if (BbsNoticeHub.HubUserModels.TryGetValue(eventData.AcceptUserId.ToString(), out var hubUserModel2)) - { - _hubContext.Clients.Client(hubUserModel2.ConnnectionId).SendAsync(NoticeTypeEnum.Money.ToString(), eventData.Message,now); - } - - isStore = false; - break; - default: - break; - } - - if (isStore) - { //离线存储 - var entity= await _repository.InsertReturnEntityAsync(new BbsNoticeAggregateRoot(eventData.NoticeType, eventData.Message, eventData.AcceptUserId){CreationTime = now}); - } - - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BindAccountForBbsEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BindAccountForBbsEventHandler.cs deleted file mode 100644 index e6fc1257..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/BindAccountForBbsEventHandler.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers; - -/// -/// 临时账号绑定到正式账号,钱钱 (累加),禁用临时账号(修改) -/// -public class BindAccountForBbsEventHandler : ILocalEventHandler, ITransientDependency -{ - private readonly ISqlSugarRepository _bbsUserRepository; - private readonly ISqlSugarRepository _userRepository; - - public BindAccountForBbsEventHandler(ISqlSugarRepository bbsUserRepository, - ISqlSugarRepository userRepository) - { - _bbsUserRepository = bbsUserRepository; - _userRepository = userRepository; - } - - public async Task HandleEventAsync(BindAccountEto eventData) - { - //禁用临时用户 - var oldUser = await _userRepository.GetFirstAsync(x => x.Id == eventData.OldUserId); - if (oldUser is null || oldUser.State == false) - { - throw new UserFriendlyException("无法将无效用户进行绑定"); - } - - oldUser.State = false; - await _userRepository.UpdateAsync(oldUser); - - - //账户钱转移 - var bbsOldUser = await _bbsUserRepository.GetFirstAsync(x => x.UserId == eventData.OldUserId); - var bbsNewUser = await _bbsUserRepository.GetFirstAsync(x => x.UserId == eventData.NewUserId); - if (bbsNewUser is not null) - { - bbsNewUser.Money += bbsOldUser?.Money ?? 0; - await _bbsUserRepository.UpdateAsync(bbsNewUser); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs deleted file mode 100644 index 42b6917b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/CommentCreatedEventHandler.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers -{ - /// - /// 评论创建的领域事件 - /// - public class CommentCreatedEventHandler : ILocalEventHandler>, - ITransientDependency - { - private ILocalEventBus _localEventBus; - private ISqlSugarRepository _discussRepository; - private ISqlSugarRepository _userRepository; - public CommentCreatedEventHandler(ILocalEventBus localEventBus, ISqlSugarRepository discussRepository, ISqlSugarRepository userRepository) - { - _userRepository = userRepository; - _localEventBus = localEventBus; - _discussRepository = discussRepository; - } - public async Task HandleEventAsync(EntityCreatedEventData eventData) - { - var commentEntity = eventData.Entity; - - //给创建者发布数量+1 - await _userRepository._Db.Updateable() - .SetColumns(it => it.CommentNumber == it.CommentNumber + 1) - .Where(it => it.UserId == commentEntity.CreatorId) - .ExecuteCommandAsync(); - var disucssDto = await _discussRepository._DbQueryable - .Where(x => x.Id == commentEntity.DiscussId) - .LeftJoin((dicuss, user) => dicuss.CreatorId == user.Id) - .Select((dicuss, user) => - new - { - DiscussUserId = user.Id, - DiscussTitle = dicuss.Title, - - }) - .FirstAsync(); - - var commentUser = await _userRepository.GetFirstAsync(x => x.Id == commentEntity.CreatorId); - - //截取30个长度 - var content = commentEntity.Content.Length >= 30 ? commentEntity.Content.Substring(0, 30)+"..." : commentEntity.Content; - //通知主题作者,有人评论 - await _localEventBus.PublishAsync(new BbsNoticeEventArgs(disucssDto.DiscussUserId, string.Format(DiscussConst.CommentNotice, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false); - - //如果为空,表示根路径,没有回复者 - if (commentEntity.ParentId != Guid.Empty) - { - //通知回复者,有人评论 - await _localEventBus.PublishAsync(new BbsNoticeEventArgs(commentEntity.ParentId, string.Format(DiscussConst.CommentNoticeToReply, disucssDto.DiscussTitle, commentUser.UserName, content,commentEntity.DiscussId)), false); - - } - - //最后发布任务触发事件 - await _localEventBus.PublishAsync( - new AssignmentEventArgs(AssignmentRequirementTypeEnum.Comment, commentUser.Id),false); - - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/DiscussCreatedEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/DiscussCreatedEventHandler.cs deleted file mode 100644 index 9714eaed..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/DiscussCreatedEventHandler.cs +++ /dev/null @@ -1,44 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.EventBus; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers -{ - /// - /// 主题创建的领域事件 - /// - public class DiscussCreatedEventHandler : ILocalEventHandler>, - ITransientDependency - { - private ISqlSugarRepository _userRepository; - private ILocalEventBus _localEventBus; - - public DiscussCreatedEventHandler(ISqlSugarRepository userRepository, - ILocalEventBus localEventBus) - { - _userRepository = userRepository; - _localEventBus = localEventBus; - } - - public async Task HandleEventAsync(EntityCreatedEventData eventData) - { - var disucussEntity = eventData.Entity; - - //给创建者发布数量+1 - await _userRepository._Db.Updateable() - .SetColumns(it => it.DiscussNumber == it.DiscussNumber + 1) - .Where(it => it.UserId == disucussEntity.CreatorId) - .ExecuteCommandAsync(); - - //最后发布任务触发事件 - await _localEventBus.PublishAsync( - new AssignmentEventArgs(AssignmentRequirementTypeEnum.Discuss, disucussEntity.CreatorId!.Value), false); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/MoneyChangeEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/MoneyChangeEventHandler.cs deleted file mode 100644 index 805178c5..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/MoneyChangeEventHandler.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Volo.Abp; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers -{ - public class MoneyChangeEventHandler : ILocalEventHandler, ITransientDependency - { - private ISqlSugarRepository _userInfoRepository; - private ILocalEventBus _localEventBus; - public MoneyChangeEventHandler(ISqlSugarRepository userInfoRepository, ILocalEventBus localEventBus) - { - _userInfoRepository = userInfoRepository; - _localEventBus = localEventBus; - } - public async Task HandleEventAsync(MoneyChangeEventArgs eventData) - { - var userIfno = await _userInfoRepository.GetFirstAsync(x => x.UserId == eventData.UserId); - - //如果变化后的钱钱少于0,直接丢出去 - if ((userIfno.Money + eventData.Number)<0) - { - throw new UserFriendlyException(MoneyConst.Money_Low_Zero); - } - //原子性sql - await _userInfoRepository._Db.Updateable() - .SetColumns(it => it.Money == it.Money + eventData.Number) - .Where(x => x.UserId == eventData.UserId).ExecuteCommandAsync(); - - - await _localEventBus.PublishAsync(new BbsNoticeEventArgs(NoticeTypeEnum.Money, eventData.UserId,eventData.Number.ToString()), false); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/SeeDiscussEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/SeeDiscussEventHandler.cs deleted file mode 100644 index 39df4ece..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/SeeDiscussEventHandler.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.EventHandlers -{ - public class SeeDiscussEventHandler : ILocalEventHandler, ITransientDependency - { - private ISqlSugarRepository _repository; - - public SeeDiscussEventHandler(ISqlSugarRepository repository) - { - _repository = repository; - } - - public async Task HandleEventAsync(SeeDiscussEventArgs eventData) - { - await _repository._Db.Updateable() - .SetColumns(x => new DiscussAggregateRoot { SeeNum = x.SeeNum + 1 }) - .Where(x => x.Id == eventData.DiscussId).ExecuteCommandAsync(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/UserCreateEventHandler.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/UserCreateEventHandler.cs deleted file mode 100644 index c2684072..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/EventHandlers/UserCreateEventHandler.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Rbac.Domain.Shared.Etos; - -namespace Yi.Framework.Bbs.Domain.EventHandlers -{ - public class UserCreateEventHandler : ILocalEventHandler, ITransientDependency - { - private IRepository _repository; - public UserCreateEventHandler(IRepository repository) - { - _repository = repository; - } - public async Task HandleEventAsync(UserCreateEventArgs eventData) - { - //创建主表 - var bbsUser = new BbsUserExtraInfoEntity(eventData.UserId) - { - - }; - await _repository.InsertAsync(bbsUser); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/AbstractArticleImport.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/AbstractArticleImport.cs deleted file mode 100644 index 3f3a66e5..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/AbstractArticleImport.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Model; -using Yi.Framework.Core.Data; - -namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport -{ - public abstract class AbstractArticleImport - { - public void SetLogger(ILoggerFactory loggerFactory) - { - LoggerFactory = loggerFactory; - } - protected ILoggerFactory LoggerFactory { get; set; } - public virtual List Import(Guid discussId, Guid articleParentId, List fileObjs) - { - var articles = Convert(fileObjs); - var orderNum = 0; - articles.ForEach(article => - { - article.DiscussId = discussId; - article.ParentId = articleParentId; - article.OrderNum = ++orderNum; - }); - return articles; - } - public abstract List Convert(List fileObjs); - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/DefaultArticleImport.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/DefaultArticleImport.cs deleted file mode 100644 index 5428dbef..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/DefaultArticleImport.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Model; - -namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport -{ - internal class DefaultArticleImport : AbstractArticleImport - { - public override List Convert(List fileObjs) - { - return fileObjs.OrderBy(x => x.FileName).Select(x => new ArticleAggregateRoot { Name = x.FileName, Content = x.Content }).ToList(); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/VuePressArticleImport.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/VuePressArticleImport.cs deleted file mode 100644 index d8437f37..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ArticleImport/VuePressArticleImport.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.Logging; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Model; - -namespace Yi.Framework.Bbs.Domain.Managers.ArticleImport -{ - internal class VuePressArticleImport : AbstractArticleImport - { - public override List Convert(List fileObjs) - { - var logger = LoggerFactory.CreateLogger(); - - //排序及处理目录名称 - var fileNameHandler = fileObjs.OrderBy(x => x.FileName).Select(x => - { - var f = new FileObject { Content = x.Content }; - - //除去数字 - f.FileName = x.FileName.Split('.')[1]; - return f; - }); - - - //处理内容 - var fileContentHandler = fileNameHandler.Select(x => - { - logger.LogError($"老的值:{x.Content}"); - var f = new FileObject { FileName = x.FileName }; - var lines = x.Content.SplitToLines(); - - var num = 0; - var startIndex = 0; - for (int i = 0; i < lines.Length; i++) - { - //编码问题 - if (lines[i] == "---") - { - num++; - if (num == 2) - { - startIndex = i; - break; - } - - } - - } - var linesRef = lines.ToList(); - - if (startIndex != 0) - { - linesRef.RemoveRange(0, startIndex + 1); - } - else - { - //去除头部 - linesRef.RemoveRange(0,6); - } - var result = string.Join(Environment.NewLine, linesRef); - f.Content = result; - return f; - }); - var output = fileContentHandler.Select(x => new ArticleAggregateRoot() { Content = x.Content, Name = x.FileName }).ToList(); - - return output; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentManager.cs deleted file mode 100644 index 4ee4ad64..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentManager.cs +++ /dev/null @@ -1,146 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Domain.Entities.Assignment; -using Yi.Framework.Bbs.Domain.Managers.AssignmentProviders; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Managers; - -/// -/// 任务领域,任务相关核心逻辑 -/// -public class AssignmentManager : DomainService -{ - private readonly IEnumerable _assignmentProviders; - public readonly ISqlSugarRepository _assignmentRepository; - public readonly ISqlSugarRepository _assignmentDefineRepository; - private readonly ILocalEventBus _localEventBus; - - public AssignmentManager(IEnumerable assignmentProviders, - ISqlSugarRepository assignmentRepository, - ISqlSugarRepository assignmentDefineRepository, ILocalEventBus localEventBus) - { - this._assignmentProviders = assignmentProviders; - _assignmentRepository = assignmentRepository; - _assignmentDefineRepository = assignmentDefineRepository; - _localEventBus = localEventBus; - } - - /// - /// 接受任务 - /// - /// 领取用户 - /// 任务定义id - /// - public async Task AcceptAsync(Guid userId, Guid asignmentDefineId) - { - var canReceiveList = await GetCanReceiveListAsync(userId); - - //如果要接收的任务id在可领取的任务列表中,就可以接收任务 - if (canReceiveList.Select(x => x.Id).Contains(asignmentDefineId)) - { - var assignmentDefine = await _assignmentDefineRepository.GetByIdAsync(asignmentDefineId); - - var entity = new AssignmentAggregateRoot(); - entity.AssignmentDefineId = asignmentDefineId; - entity.UserId = userId; - entity.AssignmentState = AssignmentStateEnum.Progress; - entity.CurrentStepNumber = 0; - entity.TotalStepNumber = assignmentDefine.TotalStepNumber; - entity.RewardsMoneyNumber = assignmentDefine.RewardsMoneyNumber; - entity.AssignmentRequirementType = assignmentDefine.AssignmentRequirementType; - entity.ExpireTime = assignmentDefine.AssignmentType.GetExpireTime(); - await _assignmentRepository.InsertAsync(entity); - } - } - - /// - /// 领取任务奖励 - /// - /// 任务id - /// - /// - public async Task ReceiveRewardsAsync(Guid asignmentId) - { - var assignment = await _assignmentRepository.GetByIdAsync(asignmentId); - if (assignment.IsAllowCompleted()) - { - //加钱加钱 - await _localEventBus.PublishAsync( - new MoneyChangeEventArgs { UserId = assignment.UserId, Number = assignment.RewardsMoneyNumber }, false); - - //设置已完成,并领取奖励,钱钱 - assignment.SetEnd(); - await _assignmentRepository.UpdateAsync(assignment); - } - else - { - //不能领取 - throw new UserFriendlyException("该任务没有满足领取条件,请检查任务详情"); - } - } - - - /// - /// 根据用户id获取能够领取的任务列表 - /// - /// 用户id - /// - public async Task> GetCanReceiveListAsync(Guid userId) - { - var context = await GetAssignmentContext(userId); - var output = new List(); - foreach (var assignmentProvider in _assignmentProviders) - { - output.AddRange(await assignmentProvider.GetCanReceiveListAsync(context)); - } - - output = output.DistinctBy(x => x.Id).OrderBy(x => x.OrderNum).ToList(); - return output; - } - - - /// - /// 获取任务的上下文 - /// - /// - /// - private async Task GetAssignmentContext(Guid userId) - { - var allAssignmentDefine = await _assignmentDefineRepository.GetListAsync(); - - var currentUserAssignment = await _assignmentRepository.GetListAsync(x => x.UserId == userId); - - var context = new AssignmentContext(userId, allAssignmentDefine, currentUserAssignment); - return context; - } - - - /// - /// 过期超时的任务,定时任务去处理即可 - /// - public async Task ExpireTimeoutAsync() - { - var progressEntities = await _assignmentRepository._DbQueryable - .Where(x => x.AssignmentState == AssignmentStateEnum.Progress) - .ToListAsync(); - - var needUpdateEntities = new List(); - foreach (var progressEntity in progressEntities) - { - if (progressEntity.TrySetExpire()) - { - needUpdateEntities.Add(progressEntity); - } - } - - if (needUpdateEntities.Any()) - { - await _assignmentRepository._Db.Updateable(needUpdateEntities).ExecuteCommandAsync(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/AssignmentContext.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/AssignmentContext.cs deleted file mode 100644 index 5ed79e80..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/AssignmentContext.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Yi.Framework.Bbs.Domain.Entities.Assignment; - -namespace Yi.Framework.Bbs.Domain.Managers.AssignmentProviders; - -public class AssignmentContext -{ - public AssignmentContext( Guid currentUserId,List allAssignmentDefine, List currentUserAssignments) - { - AllAssignmentDefine = allAssignmentDefine; - CurrentUserAssignments = currentUserAssignments; - CurrentUserId = currentUserId; - } - - /// - /// 全部的任务定义 - /// - public List AllAssignmentDefine { get; } - - /// - /// 当前用户的全部任务数据 - /// - public List CurrentUserAssignments { get; } - - /// - /// 当前用户id - /// - public Guid CurrentUserId { get; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/IAssignmentProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/IAssignmentProvider.cs deleted file mode 100644 index 0cffaff7..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/IAssignmentProvider.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Entities.Assignment; - -namespace Yi.Framework.Bbs.Domain.Managers.AssignmentProviders; - -/// -/// 任务提供者接口 -/// -public interface IAssignmentProvider : ITransientDependency -{ - /// - /// 获取可领取的任务定义,该方法需全部AssignmentProvider去重 - /// - /// - /// - Task> GetCanReceiveListAsync(AssignmentContext context); -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/DailyProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/DailyProvider.cs deleted file mode 100644 index e5f7d33b..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/DailyProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Managers.AssignmentProviders; - -/// -/// 每日任务提供者 -/// -[ExposeServices(typeof(IAssignmentProvider))] -public class DailyProvider : TimerProvider -{ - protected override AssignmentTypeEnum AssignmentType => AssignmentTypeEnum.Daily; -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/NoviceProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/NoviceProvider.cs deleted file mode 100644 index a99411cc..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/NoviceProvider.cs +++ /dev/null @@ -1,70 +0,0 @@ -using SqlSugar; -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Entities.Assignment; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Managers.AssignmentProviders; - -/// -/// 新手任务提供者 -/// -[ExposeServices(typeof(IAssignmentProvider))] -public class NoviceProvider : IAssignmentProvider -{ - public async Task> GetCanReceiveListAsync(AssignmentContext context) - { - List output = new List(); - //新手任务是要有前置依赖关系的,链表类型依赖 - //先获取到对应任务定义列表,新手任务 - var assignmentDefines = context.AllAssignmentDefine.Where(x => x.AssignmentType == AssignmentTypeEnum.Novice) - .ToList(); - var assignmentDefineIds = assignmentDefines.Select(x => x.Id).ToList(); - - //根路径 - var rootAssignmentDefine = assignmentDefines.Where(x => x.PreAssignmentId == null).OrderBy(x=>x.OrderNum).FirstOrDefault(); - //代表没有定义新手任务 - if (rootAssignmentDefine is null) - { - return output; - } - - //1:查询该用户有正在进行的新手任务,如果有跳过 - if (context.CurrentUserAssignments - .Where(x => assignmentDefineIds.Contains(x.AssignmentDefineId)) - .Any(x => x.AssignmentState == AssignmentStateEnum.Progress)) - { - return output; - } - - //2: 查询该用户是否有完成的新手任务,如果没有,直接返回根节点,如果有,则根据链表选择最后的节点 - var assignmentFilterIds = context.CurrentUserAssignments - .Where(x => assignmentDefineIds.Contains(x.AssignmentDefineId)) - .Where(x => - //已经完成的 - x.AssignmentState == AssignmentStateEnum.End|| - x.AssignmentState==AssignmentStateEnum.Completed - ) - .Select(x => x.AssignmentDefineId) - .ToList(); - - if (assignmentFilterIds.Count == 0) - { - output.Add(rootAssignmentDefine); - return output; - } - - - //该用户接受的最后一个新手任务 - var lastAssignment = assignmentDefines.Where(x => assignmentFilterIds.Contains(x.Id)) - .OrderByDescending(x => x.OrderNum).First(); - - //包含比该用户还要大的任务 - if (assignmentDefines.Any(x => x.OrderNum > lastAssignment.OrderNum)) - { - output.Add(assignmentDefines.FirstOrDefault(x => x.OrderNum == lastAssignment.OrderNum + 1)); - return output; - } - - return output; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/WeeklyProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/WeeklyProvider.cs deleted file mode 100644 index 7ae3d6be..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/Impl/WeeklyProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Managers.AssignmentProviders; - -/// -/// 每周任务提供者 -/// -[ExposeServices(typeof(IAssignmentProvider))] -public class WeeklyProvider : TimerProvider -{ - protected override AssignmentTypeEnum AssignmentType => AssignmentTypeEnum.Weekly; -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/TimerAbstractProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/TimerAbstractProvider.cs deleted file mode 100644 index 8a286fa9..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/AssignmentProviders/TimerAbstractProvider.cs +++ /dev/null @@ -1,42 +0,0 @@ -using SqlSugar; -using Yi.Framework.Bbs.Domain.Entities.Assignment; -using Yi.Framework.Bbs.Domain.Shared.Enums; - -namespace Yi.Framework.Bbs.Domain.Managers.AssignmentProviders; - -/// -/// 循环任务提供者 -/// -public abstract class TimerProvider : IAssignmentProvider -{ - /// - /// 任务类型 - /// - protected abstract AssignmentTypeEnum AssignmentType { get; } - - public Task> GetCanReceiveListAsync(AssignmentContext context) - { - //先获取到对应任务定义列表 - var assignmentDefines = context.AllAssignmentDefine.Where(x => x.AssignmentType == AssignmentType).ToList(); - - //满足以下1个条件 - //1:没有正在运行的 - //2: 存在已完成,但是完成时间是过期的 - var assignmentFilterIds = context.CurrentUserAssignments - .Where(x => - //正在进行的,已经完成,要去掉 - x.AssignmentState == AssignmentStateEnum.Progress|| - x.AssignmentState==AssignmentStateEnum.Completed|| - //已结束,但是还没过期,要去掉 - (x.AssignmentState == AssignmentStateEnum.End&&!AssignmentType.IsExpire(x.EndTime!.Value))) - .Select(x => x.AssignmentDefineId) - .ToList(); - - - - //出去不可接收的任务,就是可接收任务 - var output = assignmentDefines.Where(x => !assignmentFilterIds.Contains(x.Id)).ToList(); - return Task.FromResult(output); - } - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs deleted file mode 100644 index 800b828a..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankManager.cs +++ /dev/null @@ -1,190 +0,0 @@ -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Entities.Bank; -using Yi.Framework.Bbs.Domain.Managers.BankValue; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.Rbac.Domain.Shared.Dtos; -using Yi.Framework.SqlSugarCore.Abstractions; -using static System.Runtime.InteropServices.JavaScript.JSType; - -namespace Yi.Framework.Bbs.Domain.Managers -{ - /// - /// 银行领域,进阶了哦~ - /// - public class BankManager : DomainService - { - private const decimal DefalutRate = 1.2m; - private ISqlSugarRepository _repository; - private ILocalEventBus _localEventBus; - private ISqlSugarRepository _interestRepository; - private IBankValueProvider _bankValueProvider; - public BankManager(ISqlSugarRepository repository, ILocalEventBus localEventBus, ISqlSugarRepository interestRepository, IBankValueProvider bankValueProvider) - { - _repository = repository; - _localEventBus = localEventBus; - _interestRepository = interestRepository; - _bankValueProvider = bankValueProvider; - } - - /// - /// 获取当前银行汇率 - /// - public BankInterestRecordDto CurrentRate => GetCurrentInterestRate().GetAwaiter().GetResult(); - - /// - /// 用于存储当前汇率数据 - /// - private static BankInterestRecordDto? _currentRateStore; - - /// - /// 获取当前的银行汇率,如果为空会从数据库拿最新一条 - /// - /// - public async Task GetCurrentInterestRate() - { - var output = new BankInterestRecordDto(); - //先判断时间是否与当前时间差1小时,小于1小时直接返回即可,可以由一个单例类提供 - if (_currentRateStore is null || _currentRateStore.IsExpire()) - { - var currentInterestRecords =await CreateInterestRecordsAsync(); - output.ComparisonValue = currentInterestRecords.ComparisonValue; - output.CreationTime = currentInterestRecords.CreationTime; - output.Value = currentInterestRecords.Value; - - _currentRateStore = new BankInterestRecordDto() - { - ComparisonValue = currentInterestRecords.ComparisonValue, - CreationTime = currentInterestRecords.CreationTime, - Value = currentInterestRecords.Value - }; - - } - else - { - output = _currentRateStore; - - } - - return output; - } - - /// - /// 强制创建一个记录,不管时间到没到 - /// - /// - private async Task CreateInterestRecordsAsync() - { - decimal oldValue = DefalutRate; - - var thirdPartyValue = await _bankValueProvider.GetValueAsync(); - //获取实际值的变化率 - decimal changeRate = (thirdPartyValue - _bankValueProvider.StandardValue) / (thirdPartyValue); - - //判断市场是否波动 - bool isFluctuate = IsMarketVolatility(); - //市场波动 - if (isFluctuate) - { - changeRate = 2 * changeRate; - } - - //根据上一次的老值进行变化率比较 - var currentValue = oldValue + (oldValue * changeRate); - - var entity = new InterestRecordsAggregateRoot(thirdPartyValue, currentValue, isFluctuate); - var output = await _interestRepository.InsertReturnEntityAsync(entity); - - return output; - } - - /// - /// 判断是否为波动市场,市场波动,变化率翻倍 - /// - /// - private static bool IsMarketVolatility() - { - double probability = 0.1; - Random random = new Random(); - return random.NextDouble() < probability; - } - - /// - /// 给用户申请银行卡 - /// - /// - public async Task ApplyingBankCardAsync(Guid userId, int cardNumber) - { - var entities = Enumerable.Range(1, cardNumber).Select(x => new BankCardAggregateRoot(userId)).ToList(); - await _repository.InsertManyAsync(entities); - } - - /// - /// 进行银行卡提款 - /// - /// - /// - public async Task DrawMoneyAsync(Guid cardId) - { - var entity = await _repository.GetByIdAsync(cardId); - if (entity.BankCardState == BankCardStateEnum.Unused) - { - throw new UserFriendlyException("当前银行卡状态不能提款"); - } - - //这里其实不存在这个状态,只有等待状态,不需要去主动触发,前端判断即可 - if (entity.BankCardState == BankCardStateEnum.Full) - { - throw new UserFriendlyException("当前银行卡状态不能存款"); - } - - //可以提款 - if (entity.BankCardState == BankCardStateEnum.Wait) - { - decimal changeMoney = 0; - //判断是否存满时间 - if (entity.IsStorageFull()) - { - changeMoney = this.CurrentRate.Value * entity.StorageMoney; - } - else - { - changeMoney = entity.StorageMoney; - } - - //提款 - entity.SetDrawMoney(); - await _repository.UpdateAsync(entity); - - //打钱,该卡状态钱更新,并提款加到用户钱钱里 - await _localEventBus.PublishAsync(new MoneyChangeEventArgs(entity.UserId, changeMoney),false); - - - - } - } - - /// - /// 给银行卡存款 - /// - /// - /// - /// - public async Task DepositAsync(Guid cardId, decimal moneyNum) - { - var entity = await _repository.GetByIdAsync(cardId); - if (entity.BankCardState != BankCardStateEnum.Unused) - { - throw new UserFriendlyException("当前银行卡状态不能存款"); - } - //存款 - entity.SetStorageMoney(moneyNum); - - await _repository.UpdateAsync(entity); - await _localEventBus.PublishAsync(new MoneyChangeEventArgs(entity.UserId, -moneyNum), false); - - } - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/BiyingBankValueProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/BiyingBankValueProvider.cs deleted file mode 100644 index 39c0cfaf..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/BiyingBankValueProvider.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Volo.Abp.DependencyInjection; - -namespace Yi.Framework.Bbs.Domain.Managers.BankValue -{ - [Dependency(TryRegister = true)] - public class BiyingBankValueProvider : IBankValueProvider, ITransientDependency - { - //官网地址:www.biyingapi.com - private const string Url = "https://api.biyingapi.com/hsrl/ssjy/600519/5579aa4b391945678"; - - public decimal StandardValue => 1700; - - - public async Task GetValueAsync() - { - try - { - using (HttpClient client = new HttpClient()) - { - var reponse = await client.GetAsync(Url); - reponse.EnsureSuccessStatusCode(); - var dataStr = await reponse.Content.ReadAsStringAsync(); - JObject jsonObject = JObject.Parse(dataStr); - return jsonObject["p"].Value(); - } - } - catch (Exception ex) - { - throw new Exception("BiyingBank获取数据异常", ex); - - } - - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/IBankValueProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/IBankValueProvider.cs deleted file mode 100644 index f8a09b2e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/IBankValueProvider.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Bbs.Domain.Managers.BankValue -{ - public interface IBankValueProvider - { - /// - /// 标准值 - /// - decimal StandardValue { get; } - - /// - /// 获取第三方值 - /// - /// - Task GetValueAsync(); - - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/RandownBankValueProvider.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/RandownBankValueProvider.cs deleted file mode 100644 index 093f9047..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BankValue/RandownBankValueProvider.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Volo.Abp.DependencyInjection; - -namespace Yi.Framework.Bbs.Domain.Managers.BankValue -{ - [Dependency(ReplaceServices = true)] - internal class RandownBankValueProvider : IBankValueProvider, ITransientDependency - { - public decimal StandardValue => 1000; - - - public Task GetValueAsync() - { - var currentNumber = new Random().Next(800, 1200); - return Task.FromResult((decimal)currentNumber); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BbsUserManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BbsUserManager.cs deleted file mode 100644 index 975ec127..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/BbsUserManager.cs +++ /dev/null @@ -1,165 +0,0 @@ -using Volo.Abp.Caching; -using Volo.Abp.Domain.Services; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Caches; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.Rbac.Domain.Shared.Enums; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Managers -{ - public class BbsUserManager : DomainService - { - public ISqlSugarRepository _userRepository; - - private readonly LevelManager _levelManager; - public BbsUserManager(ISqlSugarRepository userRepository, - ISqlSugarRepository bbsUserInfoRepository, - LevelManager levelManager - ) - { - _userRepository = userRepository; - _levelManager = levelManager; - } - - /// - /// 校验用户限制 - /// - /// - /// - public async Task VerifyUserLimitAsync(Guid userId) - { - var userInfo = await GetBbsUserInfoAsync(userId); - if (userInfo.UserLimit == UserLimitEnum.Ban) - { - throw new UserFriendlyException("你已被禁用,如存疑虑,请联系管理员进行申诉"); - } - if (userInfo.UserLimit == UserLimitEnum.Dangerous) - { - throw new UserFriendlyException("您的账号被标记为危险状态,请遵规守法,等待后续解除"); - } - } - - /// - /// 获取等级关系 - /// - /// - public async Task> GetLevelCacheMapAsync() - { - return await _levelManager.GetCacheMapAsync(); - } - - /// - /// 获取bbs用户信息 - /// - /// - /// - public async Task GetBbsUserInfoAsync(Guid userId) - { - var userInfo = await _userRepository._DbQueryable - .LeftJoin((user, info) => user.Id == info.UserId) - .Select((user, info) => new BbsUserInfoDto - { - Id = user.Id, - Icon = user.Icon, - Level = info.Level, - UserLimit = info.UserLimit, - Money = info.Money, - Experience = info.Experience, - AgreeNumber = info.AgreeNumber, - CommentNumber = info.CommentNumber, - DiscussNumber = info.DiscussNumber - }, true) - .FirstAsync(user => user.Id == userId); - - var levelCacheDic = await GetLevelCacheMapAsync(); - userInfo.LevelName = levelCacheDic[userInfo.Level].Name; - return userInfo; - } - - public async Task> GetBbsUserInfoAsync(List userIds) - { - var userInfos = await _userRepository._DbQueryable - .Where(user => userIds.Contains(user.Id)) - .LeftJoin((user, info) => user.Id == info.UserId) - .Select((user, info) => new BbsUserInfoDto - { - Id = user.Id, - Icon = user.Icon, - Level = info.Level, - UserLimit = info.UserLimit, - Money = info.Money, - Experience = info.Experience, - AgreeNumber = info.AgreeNumber, - CommentNumber = info.CommentNumber, - DiscussNumber = info.DiscussNumber - }, true) - .ToListAsync(); - var levelCacheDic = await GetLevelCacheMapAsync(); - userInfos?.ForEach(userInfo => userInfo.LevelName = levelCacheDic[userInfo.Level].Name); - - return userInfos ?? new List(); - } - } - - public class BbsUserInfoDto - { - public Guid Id { get; set; } - public string? Name { get; set; } - public int? Age { get; set; } - public string UserName { get; set; } = string.Empty; - public string? Icon { get; set; } - public string? Nick { get; set; } - public string? Email { get; set; } - public string? Ip { get; set; } - public string? Address { get; set; } - public long? Phone { get; set; } - public string? Introduction { get; set; } - public string? Remark { get; set; } - public SexEnum Sex { get; set; } = SexEnum.Unknown; - public bool State { get; set; } - public DateTime CreationTime { get; set; } - - /// - /// 用户等级 - /// - public int Level { get; set; } - - /// - /// 用户等级名称 - /// - public string LevelName { get; set; } - - /// - /// 用户限制 - /// - public UserLimitEnum UserLimit { get; set; } - - - /// - /// 钱钱 - /// - public decimal Money { get; set; } - - - /// - /// 经验 - /// - public long Experience { get; set; } - - public int DiscussNumber { get; set; } - - /// - /// 发表主题数 - /// - public int CommentNumber { get; set; } - - - /// - /// 被点赞数 - /// - public int AgreeNumber { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ForumManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ForumManager.cs deleted file mode 100644 index 13080cae..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/ForumManager.cs +++ /dev/null @@ -1,143 +0,0 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Domain.Services; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Managers.ArticleImport; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Model; -using Yi.Framework.Rbac.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Managers -{ - /// - /// 论坛模块的领域服务 - /// - public class ForumManager : DomainService - { - public readonly ISqlSugarRepository _discussRepository; - public readonly ISqlSugarRepository _plateEntityRepository; - public readonly ISqlSugarRepository _commentRepository; - public readonly ISqlSugarRepository _articleRepository; - public readonly ISqlSugarRepository _discussRewardRepository; - public ForumManager(ISqlSugarRepository discussRepository, ISqlSugarRepository plateEntityRepository, ISqlSugarRepository commentRepository, ISqlSugarRepository articleRepository, ISqlSugarRepository discussRewardRepository) - { - _discussRepository = discussRepository; - _plateEntityRepository = plateEntityRepository; - _commentRepository = commentRepository; - _articleRepository = articleRepository; - _discussRewardRepository = discussRewardRepository; - } - - //主题是不能直接创建的,需要由领域服务统一创建 - public async Task CreateDiscussAsync(DiscussAggregateRoot entity,DiscussRewardAggregateRoot rewardEntity=null) - { - entity.CreationTime = DateTime.Now; - entity.AgreeNum = 0; - entity.SeeNum = 0; - var discuss = await _discussRepository.InsertReturnEntityAsync(entity); - if (discuss.DiscussType==DiscussTypeEnum.Reward) - { - rewardEntity.DiscussId=discuss.Id; - Check.NotNull(rewardEntity,"悬赏类型,悬赏信息不能为空"); - await _discussRewardRepository.InsertAsync(rewardEntity); - } - return discuss; - } - - public async Task CreateCommentAsync(Guid discussId, Guid parentId, Guid rootId, string content) - { - var entity = new CommentAggregateRoot(discussId); - entity.Content = content; - entity.ParentId = parentId; - entity.RootId = rootId; - return await _commentRepository.InsertReturnEntityAsync(entity); - } - - /// - /// 校验主题查询权限 - /// - /// - /// - /// - public async Task VerifyDiscussPermissionAsync(Guid discussId,Guid? userId,string[] roles=null,bool isVerifyLook=true) - { - var discuss = await _discussRepository.GetFirstAsync(x => x.Id == discussId); - if (discuss is null) - { - throw new UserFriendlyException(DiscussConst.No_Exist); - } - //作者是自己,直接有权限 - if (discuss.CreatorId ==userId) - { - return true; - } - //管理员,直接放行 - if (roles is not null&&roles.Contains(UserConst.AdminRolesCode)) - { - return true; - } - - //是否为校验 查看权限, 其他操作权限(增删改) - if (isVerifyLook) - { - //要求角色 - if (discuss.PermissionType == DiscussPermissionTypeEnum.Role) - { - if (roles is null) - { - return false; - } - - List roleList = roles.ToList(); - //所选角色,没有任何交集 - if (!discuss.PermissionRoleCodes.Intersect(roleList).Any()) - { - return false; - } - } - - //通过了上面要求,剩下的都是有权限的,可以直接看 - return true; - } - else - { - //通过了上面的要求,剩下的就是没有权限了,直接拦截 - return false; - } - - } - - /// - /// 导入文章 - /// - /// - /// - /// - /// - /// - public async Task PostImportAsync(Guid discussId,Guid articleParentId, List fileObjs, ArticleImportTypeEnum importType) - { - AbstractArticleImport abstractArticleImport = default; - switch (importType) - { - case ArticleImportTypeEnum.Default: - abstractArticleImport = new DefaultArticleImport(); - - break; - case ArticleImportTypeEnum.VuePress: - abstractArticleImport = new VuePressArticleImport(); - break; - - default: abstractArticleImport = new DefaultArticleImport(); break; - } - abstractArticleImport.SetLogger(LoggerFactory); - var articleHandled = abstractArticleImport.Import(discussId, articleParentId, fileObjs); - - await _articleRepository.InsertManyAsync(articleHandled); - - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/IntegralManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/IntegralManager.cs deleted file mode 100644 index bc359155..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/IntegralManager.cs +++ /dev/null @@ -1,131 +0,0 @@ -using Volo.Abp; -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Uow; -using Yi.Framework.Bbs.Domain.Entities.Integral; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Managers -{ - public class IntegralManager : DomainService - { - public ISqlSugarRepository _levelRepository; - public ISqlSugarRepository _signInRepository; - private readonly ILocalEventBus _localEventBus; - public IntegralManager(ISqlSugarRepository levelRepository, ISqlSugarRepository signInRepository, ILocalEventBus localEventBus) - { - _levelRepository = levelRepository; - _localEventBus = localEventBus; - _signInRepository = signInRepository; - } - - - /// - /// 签到 - /// - /// - [UnitOfWork] - public async Task SignInAsync(Guid userId) - { - //签到,添加用户钱钱 - //发送一个充值的领域事件即可 - - - //签到添加的钱钱,跟连续签到有关系 - //每天随机(3-10),连续签到每次累加多1点,最多一天30 - - //额外 - //如果随机数数字以9结尾,额外再获取乘1倍 - - //这种逻辑,就是属于核心领域业务了 - - - var sigInLast = await _signInRepository._DbQueryable.Where(x => x.CreatorId == userId).OrderByDescending(x => x.CreationTime).FirstAsync(); - - //verify 校验是否允许签到了 - if (sigInLast is not null) - { - VerifySignInTime(sigInLast.CreationTime); - } - - //连续签到次数 - var continuousNumber = GetContinuousNumber(sigInLast); - //签到奖励值 - var value = GetSignInValue(continuousNumber); - - - //插入记录 - var entity = new SignInAggregateRoot() { ContinuousNumber = continuousNumber }; - await _signInRepository.InsertAsync(entity); - - //发布一个其他领域的事件 - await _localEventBus.PublishAsync(new MoneyChangeEventArgs() { UserId = userId, Number = value },false); - return value; - } - - /// - /// 校验签到时间 - /// - /// - /// - private void VerifySignInTime(DateTime dataTime) - { - if (dataTime.Date == DateTime.Now.Date) - { - throw new UserFriendlyException("今日你已经签到过了~"); - } - - } - - /// - /// 获取签到值 - /// - /// - /// - private decimal GetSignInValue(int continuousNumber) - { - //基础数值 - var baseValue = new Random().Next(300, 1100) / 100m; - - - //累加额外的奖励 - var extraValue = 0m; - if (baseValue.ToString().EndsWith("9")) - { - extraValue = 1 * baseValue; - } - - //累加连续签到的奖励 - var signInValue = continuousNumber * 1m; - - - //获取添加的值 - var value = baseValue + extraValue + signInValue; - if (value >= 30) - { - value = 30; - } - return value; - } - - /// - /// 获取连续次数 - /// - private int GetContinuousNumber(SignInAggregateRoot sigInLast) - { - var continuousNumber = 1; - - //已签到过 - if (sigInLast is not null) - { - //签到过,且昨天已签到过,直接使用昨天的连续次数+1 - if (sigInLast.CreationTime.Day == DateTime.Now.AddDays(-1).Day) - { - continuousNumber = sigInLast.ContinuousNumber + 1; - } - } - return continuousNumber; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/LevelManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/LevelManager.cs deleted file mode 100644 index 7cbafd32..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/LevelManager.cs +++ /dev/null @@ -1,87 +0,0 @@ -using Mapster; -using Microsoft.Extensions.Caching.Distributed; -using Volo.Abp.Caching; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Entities.Integral; -using Yi.Framework.Bbs.Domain.Shared.Caches; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Managers -{ - public class LevelManager : DomainService - { - private ILocalEventBus _localEventBus; - private IDistributedCache> _levelCache; - private IRepository _repository; - private ISqlSugarRepository _bbsUserRepository; - - public LevelManager(ILocalEventBus localEventBus, - IDistributedCache> levelCache, IRepository repository, - ISqlSugarRepository bbsUserRepository) - { - _localEventBus = localEventBus; - _repository = repository; - _bbsUserRepository = bbsUserRepository; - _levelCache = levelCache; - } - - - /// - /// 获取等级映射,所有获取等级操作通过这里操作 - /// - /// - public async Task> GetCacheMapAsync() - { - var items =await _levelCache.GetOrAddAsync(LevelConst.LevelCacheKey,async () => - { - var cacheItem = ((await _repository.GetListAsync()) - .OrderByDescending(x => x.CurrentLevel)) - .Adapt>(); - return cacheItem; - }); - return items.ToDictionary(x => x.CurrentLevel); - } - - /// - /// 使用钱钱投喂等级 - /// - /// - public async Task ChangeLevelByMoneyAsync(Guid userId, int moneyNumber) - { - //通过用户id获取用户信息的经验和等级 - var userInfo = await _bbsUserRepository.GetAsync(x => x.UserId == userId); - - //钱钱和经验的比例为1:1 - //根据钱钱修改经验 - var currentNewExperience = userInfo.Experience + moneyNumber * 1; - - //修改钱钱,如果钱钱不足,直接会丢出去 - await _localEventBus.PublishAsync(new MoneyChangeEventArgs { UserId = userId, Number = -moneyNumber }, - false); - - //更改最终的经验再变化等级 - var levelList = (await GetCacheMapAsync()).Values.OrderByDescending(x => x.CurrentLevel); - var currentNewLevel = 1; - foreach (var level in levelList) - { - if (currentNewExperience >= level.MinExperience) - { - currentNewLevel = level.CurrentLevel; - break; - } - } - - //这里注意,只更新等级 - userInfo.Level = currentNewLevel; - userInfo.Experience = currentNewExperience; - await _bbsUserRepository._Db.Updateable(userInfo) - .UpdateColumns(it => new { it.Level, it.Experience }) - .ExecuteCommandAsync(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/Shop/BbsShopManager.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/Shop/BbsShopManager.cs deleted file mode 100644 index 6dbd5e70..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Managers/Shop/BbsShopManager.cs +++ /dev/null @@ -1,55 +0,0 @@ -using Volo.Abp.Domain.Services; -using Yi.Framework.Bbs.Domain.Entities.Shop; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Managers.Shop; - -/// -/// bbs商城领域服务 -/// -public class BbsShopManager : DomainService -{ - private readonly ISqlSugarRepository _repository; - private readonly ISqlSugarRepository _applyRepository; - - public BbsShopManager(ISqlSugarRepository repository, - ISqlSugarRepository applyRepository) - { - _repository = repository; - _applyRepository = applyRepository; - } - - /// - /// 申请购买商品 - /// - /// - /// - /// - /// - public async Task BuyAsync(Guid userId, Guid goodsId,string contactInformation) - { - var goods = await _repository.GetFirstAsync(x => x.Id == goodsId); - - if (goods.GoodsType==GoodsTypeEnum.Apply) - { - var count= await _applyRepository.CountAsync(x => x.UserId == userId); - if (count>=goods.LimitNumber) - { - throw new UserFriendlyException("你已经达该商品最大限购次数"); - } - - await _applyRepository.InsertAsync(new BbsGoodsApplyAggregateRoot - { - GoodsId = goodsId, - UserId = userId, - ContactInformation = contactInformation - }); - - //更新库存 - goods.StockNumber -= 1; - await _repository.UpdateAsync(goods); - } - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IArticleRepository.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IArticleRepository.cs deleted file mode 100644 index 3aa6123a..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IArticleRepository.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Repositories -{ - public interface IArticleRepository: ISqlSugarRepository - { - Task> GetTreeAsync(Expression> where); - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IDiscussLableRepository.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IDiscussLableRepository.cs deleted file mode 100644 index 47ba8a5d..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Repositories/IDiscussLableRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Shared.Caches; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.Domain.Repositories; - -public interface IDiscussLableRepository: ISqlSugarRepository -{ - /// - /// 获取所有分类的字典 - /// - /// - Task> GetDiscussLableCacheMapAsync(); -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/SignalRHubs/BbsNoticeHub.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/SignalRHubs/BbsNoticeHub.cs deleted file mode 100644 index 57d78288..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/SignalRHubs/BbsNoticeHub.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Volo.Abp.AspNetCore.SignalR; -using Yi.Framework.Bbs.Domain.Shared.Model; - -namespace Yi.Framework.Bbs.Domain.SignalRHubs -{ - [HubRoute("/hub/bbs-notice")] - [Authorize] - public class BbsNoticeHub : AbpHub - { - /// - /// hub连接与用户id的映射关系存储 - /// - public static ConcurrentDictionary HubUserModels = new ConcurrentDictionary(); - - /// - /// 连接添加用户信息 - /// - /// - public override Task OnConnectedAsync() - { - var hubUser = new HubUserModel(Context.ConnectionId, CurrentUser.Id!.Value); - HubUserModels.TryAdd(CurrentUser.Id.Value.ToString(), hubUser); - return Task.CompletedTask; - } - - /// - /// 断开连接,去除用户连接信息 - /// - /// - /// - public override Task OnDisconnectedAsync(Exception exception) - { - HubUserModels.TryRemove(CurrentUser.Id.Value.ToString(), out _); - return Task.CompletedTask; - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Yi.Framework.Bbs.Domain.csproj b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Yi.Framework.Bbs.Domain.csproj deleted file mode 100644 index 90e35283..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/Yi.Framework.Bbs.Domain.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/YiFrameworkBbsDomainModule.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/YiFrameworkBbsDomainModule.cs deleted file mode 100644 index f3628a43..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.Domain/YiFrameworkBbsDomainModule.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using Mapster; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Volo.Abp; -using Volo.Abp.Caching; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Modularity; -using Yi.Framework.Bbs.Domain.Entities.Integral; -using Yi.Framework.Bbs.Domain.Shared; -using Yi.Framework.Bbs.Domain.Shared.Caches; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.Rbac.Domain; - -namespace Yi.Framework.Bbs.Domain -{ - [DependsOn( - typeof(YiFrameworkBbsDomainSharedModule), - - typeof(YiFrameworkRbacDomainModule) - )] - public class YiFrameworkBbsDomainModule : AbpModule - { - public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context) - { - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BannerDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BannerDataSeed.cs deleted file mode 100644 index ffb4a100..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BannerDataSeed.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds -{ - public class BannerDataSeed : IDataSeedContributor, ITransientDependency - { - private ISqlSugarRepository _repository; - public BannerDataSeed(ISqlSugarRepository repository) - { - _repository = repository; - } - public async Task SeedAsync(DataSeedContext context) - { - if (!await _repository.IsAnyAsync(x => true)) - { - await _repository.InsertManyAsync(GetSeedData()); - } - } - public List GetSeedData() - { - //这里临时使用了图床,图床地址:https://mjj.today/ - List entities = new List() - { - new BannerAggregateRoot{ - Name="欢迎", - Logo="https://i.miji.bid/2023/12/15/e6478d5d15a4b941077e336790c414f6.png", - Color="" - - }, - new BannerAggregateRoot{ - Name="前端", - Logo="https://i.miji.bid/2023/12/15/07e9291c9311889a31a2b433d4decca0.jpeg", - Color="" - - }, - }; - - - - return entities; - } - } - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsDictionaryDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsDictionaryDataSeed.cs deleted file mode 100644 index 3c7c6dbf..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsDictionaryDataSeed.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds -{ - public class BbsDictionaryDataSeed : IDataSeedContributor, ITransientDependency - { - private ISqlSugarRepository _repository; - private ISqlSugarRepository _typeRepository; - public BbsDictionaryDataSeed(ISqlSugarRepository repository, ISqlSugarRepository typeRepository) { - _repository=repository; - _typeRepository=typeRepository; - - } - public async Task SeedAsync(DataSeedContext context) - { - if (!await _typeRepository.IsAnyAsync(x => x.DictType== "bbs_type_lable")) - { - await _typeRepository.InsertManyAsync(GetSeedDictionaryTypeData()); - await _repository.InsertManyAsync(GetSeedDictionaryData()); - } - } - public List GetSeedDictionaryData() - { - List entities = new List(); - DictionaryEntity dictInfo1 = new DictionaryEntity() - { - - DictLabel = "前端", - DictValue = "0", - DictType = "bbs_type_lable", - OrderNum = 100, - Remark = "", - IsDeleted = false, - State = true - - }; - entities.Add(dictInfo1); - - DictionaryEntity dictInfo2 = new DictionaryEntity() - { - - DictLabel = "后端", - DictValue = "1", - DictType = "bbs_type_lable", - OrderNum = 99, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo2); - - DictionaryEntity dictInfo3 = new DictionaryEntity() - { - - DictLabel = "运维", - DictValue = "2", - DictType = "bbs_type_lable", - OrderNum = 98, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo3); - DictionaryEntity dictInfo4 = new DictionaryEntity() - { - - DictLabel = "测试", - DictValue = "3", - DictType = "bbs_type_lable", - OrderNum = 97, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo4); - - DictionaryEntity dictInfo5 = new DictionaryEntity() - { - - DictLabel = "UI", - DictValue = "4", - DictType = "bbs_type_lable", - OrderNum = 96, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo5); - - - DictionaryEntity dictInfo6 = new DictionaryEntity() - { - - DictLabel = "产品", - DictValue = "5", - DictType = "bbs_type_lable", - OrderNum = 95, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo6); - - DictionaryEntity dictInfo7 = new DictionaryEntity() - { - - DictLabel = "项目", - DictValue = "6", - DictType = "bbs_type_lable", - OrderNum = 94, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo7); - - DictionaryEntity dictInfo8 = new DictionaryEntity() - { - - DictLabel = "C#", - DictValue = "7", - DictType = "bbs_type_lable", - OrderNum = 93, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo8); - - DictionaryEntity dictInfo9 = new DictionaryEntity() - { - - DictLabel = ".Net", - DictValue = "8", - DictType = "bbs_type_lable", - OrderNum = 92, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo9); - - - DictionaryEntity dictInfo10 = new DictionaryEntity() - { - - DictLabel = ".NetCore", - DictValue = "9", - DictType = "bbs_type_lable", - OrderNum = 91, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo10); - - - DictionaryEntity dictInfo11 = new DictionaryEntity() - { - - DictLabel = "Asp.NetCore", - DictValue = "10", - DictType = "bbs_type_lable", - OrderNum = 90, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo11); - - DictionaryEntity dictInfo12 = new DictionaryEntity() - { - - DictLabel = "Abp.vNext", - DictValue = "11", - DictType = "bbs_type_lable", - OrderNum = 89, - Remark = "", - IsDeleted = false, - State = true - }; - entities.Add(dictInfo12); - - return entities; - } - - public List GetSeedDictionaryTypeData() - { - List entities = new List(); - DictionaryTypeAggregateRoot dict1 = new DictionaryTypeAggregateRoot() - { - - DictName = "BBS类型标签", - DictType = "bbs_type_lable", - OrderNum = 200, - Remark = "BBS类型标签", - IsDeleted = false, - State = true - }; - entities.Add(dict1); - return entities; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsMenuDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsMenuDataSeed.cs deleted file mode 100644 index 36b5b83e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsMenuDataSeed.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar.DistributedSystem.Snowflake; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Guids; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.Rbac.Domain.Shared.Enums; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds -{ - public class BbsMenuDataSeed : IDataSeedContributor, ITransientDependency - { - private IGuidGenerator _guidGenerator; - private ISqlSugarRepository _repository; - public BbsMenuDataSeed(ISqlSugarRepository repository, IGuidGenerator guidGenerator) - { - _repository=repository; - _guidGenerator=guidGenerator; - } - public async Task SeedAsync(DataSeedContext context) - { - if (!await _repository.IsAnyAsync(x => x.MenuName == "BBS")) - { - await _repository.InsertManyAsync(GetSeedData()); - } - } - - public List GetSeedData() - { - List entities = new List(); - //BBS - MenuAggregateRoot bbs = new MenuAggregateRoot(_guidGenerator.Create()) - { - MenuName = "BBS", - MenuType = MenuTypeEnum.Catalogue, - Router = "/bbs", - IsShow = true, - IsLink = false, - MenuIcon = "monitor", - OrderNum = 91, - IsDeleted = false - }; - entities.Add(bbs); - - - - //板块管理 - MenuAggregateRoot plate = new MenuAggregateRoot(_guidGenerator.Create()) - { - - MenuName = "板块管理", - PermissionCode = "bbs:plate:list", - MenuType = MenuTypeEnum.Menu, - Router = "plate", - IsShow = true, - IsLink = false, - IsCache = true, - Component = "bbs/plate/index", - MenuIcon = "component", - OrderNum = 100, - ParentId = bbs.Id, - IsDeleted = false - }; - entities.Add(plate); - - //文章管理 - MenuAggregateRoot article = new MenuAggregateRoot(_guidGenerator.Create()) - { - - MenuName = "文章管理", - PermissionCode = "bbs:article:list", - MenuType = MenuTypeEnum.Menu, - Router = "article", - IsShow = true, - IsLink = false, - IsCache = true, - Component = "bbs/article/index", - MenuIcon = "documentation", - OrderNum = 99, - ParentId = bbs.Id, - IsDeleted = false - }; - entities.Add(article); - - - return entities; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsUserInfoDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsUserInfoDataSeed.cs deleted file mode 100644 index 70238117..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/BbsUserInfoDataSeed.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds -{ - public class BbsUserInfoDataSeed : IDataSeedContributor, ITransientDependency - { - private ISqlSugarRepository _repository; - private ISqlSugarRepository _userRepository; - public BbsUserInfoDataSeed(ISqlSugarRepository repository, ISqlSugarRepository userReponse) - { - _repository = repository; - _userRepository = userReponse; - } - public async Task SeedAsync(DataSeedContext context) - { - //如果没有bbs的用户额外数据,自动插入 - if (!await _repository.IsAnyAsync(x => true)) - { - var userList = await _userRepository.GetListAsync(x => true); - var userInfoList = userList.Select(x => new BbsUserExtraInfoEntity(x.Id)).ToList(); - await _repository.InsertManyAsync(userInfoList); - } - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/ConfigDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/ConfigDataSeed.cs deleted file mode 100644 index 428e0764..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/ConfigDataSeed.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Guids; -using Yi.Framework.Rbac.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds -{ - public class ConfigDataSeed : IDataSeedContributor, ITransientDependency - { - private ISqlSugarRepository _repository; - public ConfigDataSeed(ISqlSugarRepository repository) - { - _repository = repository; - } - public async Task SeedAsync(DataSeedContext context) - { - if (!await _repository.IsAnyAsync(x => true)) - { - await _repository.InsertManyAsync(GetSeedData()); - } - } - public List GetSeedData() - { - List entities = new List(); - ConfigAggregateRoot config1 = new ConfigAggregateRoot() - { - ConfigKey = "bbs.site.name", - ConfigName = "站点名称", - ConfigValue = "意社区" - }; - entities.Add(config1); - - ConfigAggregateRoot config2 = new ConfigAggregateRoot() - { - ConfigKey = "bbs.site.author", - ConfigName = "站点作者", - ConfigValue = "橙子" - }; - entities.Add(config2); - - ConfigAggregateRoot config3 = new ConfigAggregateRoot() - { - ConfigKey = "bbs.site.icp", - ConfigName = "站点Icp备案", - ConfigValue = "赣ICP备20008025号" - }; - entities.Add(config3); - - - ConfigAggregateRoot config4 = new ConfigAggregateRoot() - { - ConfigKey = "bbs.site.bottom", - ConfigName = "站点底部信息", - ConfigValue = "你好世界" - }; - entities.Add(config4); - return entities; - } - } - - -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/LevelDataSeed.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/LevelDataSeed.cs deleted file mode 100644 index acf9f460..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/DataSeeds/LevelDataSeed.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Entities.Integral; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.Bbs.SqlSugarCore.DataSeeds -{ - public class LevelDataSeed : IDataSeedContributor, ITransientDependency - { - private ISqlSugarRepository _repository; - public LevelDataSeed(ISqlSugarRepository repository) - { - _repository = repository; - } - public async Task SeedAsync(DataSeedContext context) - { - if (!await _repository.IsAnyAsync(x => true)) - { - await _repository.InsertManyAsync(GetSeedData()); - } - } - public List GetSeedData() - { - List entities = new List() - { - new LevelAggregateRoot(1,"小白",10), - new LevelAggregateRoot(2,"中白",30), - new LevelAggregateRoot(3,"大白",100), - new LevelAggregateRoot(4,"精英",300), - new LevelAggregateRoot(5,"熟练",600), - new LevelAggregateRoot(6,"高手",1000), - new LevelAggregateRoot(7,"老手",1500), - new LevelAggregateRoot(8,"大佬",2000), - new LevelAggregateRoot(9,"巨佬",2500), - new LevelAggregateRoot(10,"大神",3000), - }; - - return entities; - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/ArticleRepository.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/ArticleRepository.cs deleted file mode 100644 index a820e194..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/ArticleRepository.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Linq.Expressions; -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Repositories; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.SqlSugarCore.Repositories; - -namespace Yi.Framework.Bbs.SqlSugarCore.Repositories -{ - public class ArticleRepository : SqlSugarRepository, IArticleRepository,ITransientDependency - { - public ArticleRepository(ISugarDbContextProvider sugarDbContextProvider) : base(sugarDbContextProvider) - { - } - - public async Task> GetTreeAsync(Expression> where) - { - return await _DbQueryable.Where(where).OrderBy(x=>x.OrderNum).OrderBy(x=>x.CreationTime).ToTreeAsync(x => x.Children, x => x.ParentId, Guid.Empty); - } - } -} diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/DiscussLableRepository.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/DiscussLableRepository.cs deleted file mode 100644 index 12490aec..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Repositories/DiscussLableRepository.cs +++ /dev/null @@ -1,41 +0,0 @@ -using Mapster; -using Microsoft.Extensions.Caching.Distributed; -using Volo.Abp.Caching; -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Entities.Forum; -using Yi.Framework.Bbs.Domain.Repositories; -using Yi.Framework.Bbs.Domain.Shared.Caches; -using Yi.Framework.Bbs.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.SqlSugarCore.Repositories; - -namespace Yi.Framework.Bbs.SqlSugarCore.Repositories; - -public class DiscussLableRepository : SqlSugarRepository, IDiscussLableRepository, - ITransientDependency -{ - private readonly IDistributedCache> _lableCache; - - public DiscussLableRepository(ISugarDbContextProvider sugarDbContextProvider, - IDistributedCache> lableCache) : base(sugarDbContextProvider) - { - _lableCache = lableCache; - } - - /// - /// 获取所有分类的字典 - /// - /// - public async Task> GetDiscussLableCacheMapAsync() - { - var cahce = await _lableCache.GetOrAddAsync(DiscussLableConst.DiscussLableCacheKey, async () => - { - var entities = await _DbQueryable.ToListAsync(); - return entities.Adapt>(); - }, () => - new DistributedCacheEntryOptions() - { AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(2) },hideErrors:true - ); - return cahce.ToDictionary(x => x.Id); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Yi.Framework.Bbs.SqlSugarCore.csproj b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Yi.Framework.Bbs.SqlSugarCore.csproj deleted file mode 100644 index c3997986..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/Yi.Framework.Bbs.SqlSugarCore.csproj +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/YiFrameworkBbsSqlSugarCoreModule.cs b/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/YiFrameworkBbsSqlSugarCoreModule.cs deleted file mode 100644 index 1c67372e..00000000 --- a/Yi.Abp.Net8/module/bbs/Yi.Framework.Bbs.SqlSugarCore/YiFrameworkBbsSqlSugarCoreModule.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Volo.Abp.Modularity; -using Yi.Framework.Bbs.Domain; -using Yi.Framework.Rbac.SqlSugarCore; - -namespace Yi.Framework.Bbs.SqlSugarCore -{ - [DependsOn( - typeof(YiFrameworkBbsDomainModule), - - typeof(YiFrameworkRbacSqlSugarCoreModule))] - public class YiFrameworkBbsSqlSugarCoreModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/ChatMessageGetListInput.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/ChatMessageGetListInput.cs deleted file mode 100644 index 78dbd87c..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/ChatMessageGetListInput.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.ChatHub.Domain.Shared.Enums; - -namespace Yi.Framework.ChatHub.Application.Contracts.Dtos -{ - public class ChatMessageGetListInput - { - public MessageTypeEnum? MessageType { get; set; } - - /// - /// 接收者(用户id、群组id) - /// - public Guid? ReceiveId { get; set; } - - /// - /// 发送者的用户id - /// - public Guid? SendUserId { get; set; } - - /// - /// 开始时间 - /// - public DateTime? StartTime { get; set; } - - /// - /// 结束时间 - /// - public DateTime? EndTime { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/GroupMessageInputDto.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/GroupMessageInputDto.cs deleted file mode 100644 index 3231d7bb..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/GroupMessageInputDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.ChatHub.Application.Contracts.Dtos -{ - public class GroupMessageInputDto - { - /// - /// 消息内容 - /// - public string Content { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/PersonalMessageInputDto.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/PersonalMessageInputDto.cs deleted file mode 100644 index 860faccc..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Dtos/PersonalMessageInputDto.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.ChatHub.Application.Contracts.Dtos -{ - public class PersonalMessageInputDto - { - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 消息内容 - /// - public string Content { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Yi.Framework.ChatHub.Application.Contracts.csproj b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Yi.Framework.ChatHub.Application.Contracts.csproj deleted file mode 100644 index 0e4dce4a..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/Yi.Framework.ChatHub.Application.Contracts.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/YiFrameworkChatHubApplicationContractsModule.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/YiFrameworkChatHubApplicationContractsModule.cs deleted file mode 100644 index 01fb4fba..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application.Contracts/YiFrameworkChatHubApplicationContractsModule.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Yi.Framework.ChatHub.Domain.Shared; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.ChatHub.Application.Contracts -{ - [DependsOn(typeof(YiFrameworkChatHubDomainSharedModule), - - typeof(YiFrameworkDddApplicationContractsModule) - )] - public class YiFrameworkChatHubApplicationContractsModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/AiChatService.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/AiChatService.cs deleted file mode 100644 index c085b43a..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/AiChatService.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections.Generic; -using System.Text; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using NUglify.Helpers; -using Volo.Abp.Application.Services; -using Yi.Framework.ChatHub.Domain.Managers; -using Yi.Framework.ChatHub.Domain.Shared.Dtos; -using Yi.Framework.ChatHub.Domain.Shared.Model; - -namespace Yi.Framework.ChatHub.Application.Services -{ - public class AiChatService : ApplicationService - { - private readonly AiManager _aiManager; - private readonly UserMessageManager _userMessageManager; - public AiChatService(AiManager aiManager, UserMessageManager userMessageManager) { _aiManager = aiManager; _userMessageManager = userMessageManager; } - - - /// - /// ai聊天 - /// - /// - /// - [Authorize] - [HttpPost("ai-chat/chat/{*model}")] - public async Task ChatAsync([FromRoute]string model, [FromBody] List chatContext) - { - const int maxChar = 10; - var contextId = Guid.NewGuid(); - Queue stringQueue = new Queue(); - await foreach (var aiResult in _aiManager.ChatAsStreamAsync(model,chatContext)) - { - stringQueue.Enqueue(aiResult); - - if (stringQueue.Count >= maxChar) - { - StringBuilder currentStr=new StringBuilder(); - while (stringQueue.Count > 0) - { - var str = stringQueue.Dequeue(); - currentStr.Append(str); - } - await _userMessageManager.SendMessageAsync(MessageContext.CreateAi(currentStr.ToString(), CurrentUser.Id!.Value, contextId),model); - } - } - - StringBuilder currentEndStr = new StringBuilder(); - while (stringQueue.Count > 0) - { - var str = stringQueue.Dequeue(); - currentEndStr.Append(str); - } - await _userMessageManager.SendMessageAsync(MessageContext.CreateAi(currentEndStr.ToString(), CurrentUser.Id!.Value, contextId),model); - } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/ChatMessageService.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/ChatMessageService.cs deleted file mode 100644 index 530b670f..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/ChatMessageService.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.ChatHub.Application.Contracts.Dtos; -using Yi.Framework.ChatHub.Domain.Managers; -using Yi.Framework.ChatHub.Domain.Shared.Enums; -using Yi.Framework.ChatHub.Domain.Shared.Model; -using Yi.Framework.Rbac.Domain.Shared.Etos; - -namespace Yi.Framework.ChatHub.Application.Services -{ - public class ChatMessageService : ApplicationService - { - private UserMessageManager _userMessageManager; - private ILocalEventBus _localEventBus; - public ChatMessageService(UserMessageManager userMessageManager, ILocalEventBus localEventBus) { _userMessageManager = userMessageManager; _localEventBus = localEventBus; } - /// - /// 发送个人消息 - /// - /// - [HttpPost("chat-message/personal")] - [Authorize] - public async Task SendPersonalMessageAsync(PersonalMessageInputDto input) - { - var mesageContext = MessageContext.CreatePersonal(input.Content, input.UserId, CurrentUser.Id!.Value); - var userRoleMenuQuery = new UserRoleMenuQueryEventArgs(CurrentUser.Id!.Value, input.UserId); - - //调用用户领域事件,获取用户信息,第一个发送者用户信息,第二个为接收者用户信息 - await _localEventBus.PublishAsync(userRoleMenuQuery, false); - mesageContext.SetUserInfo(userRoleMenuQuery.Result.First(), userRoleMenuQuery.Result.Last()); - - - await _userMessageManager.SendMessageAsync(mesageContext); - await _userMessageManager.CreateMessageStoreAsync(mesageContext); - } - - - /// - /// 发送群组消息 - /// - /// - [HttpPost("chat-message/group")] - [Authorize] - public async Task SendGroupMessageAsync(GroupMessageInputDto input) - { - //领域调用,群主消息调用bbs领域 - - //如果钱钱不足,将自动断言 - await _localEventBus.PublishAsync(new MoneyChangeEventArgs { UserId = CurrentUser.Id.Value, Number = -1 }, false); - - var mesageContext = MessageContext.CreateAll(input.Content, CurrentUser.Id!.Value); - UserRoleMenuQueryEventArgs userRoleMenuQuery = new UserRoleMenuQueryEventArgs(CurrentUser.Id!.Value); - - //调用用户领域事件,获取用户信息,第一个发送者用户信息,第二个为接收者用户信息 - await _localEventBus.PublishAsync(userRoleMenuQuery, false); - mesageContext.SetUserInfo(userRoleMenuQuery.Result.First(), null); - - await _userMessageManager.SendMessageAsync(mesageContext); - await _userMessageManager.CreateMessageStoreAsync(mesageContext); - } - - /// - /// 查询消息 - /// - /// - /// - [Authorize] - [RemoteService(IsEnabled = false)] - public async Task> GetListAsync(ChatMessageGetListInput input) - { - //需要关联用户信息 - - var entities = await _userMessageManager._repository._DbQueryable - .WhereIF(input.MessageType is not null, x => x.MessageType == input.MessageType) - .WhereIF(input.ReceiveId is not null, x => x.ReceiveId == input.ReceiveId) - .WhereIF(input.SendUserId is not null, x => x.SendUserId == input.SendUserId) - .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) - .OrderBy(x => x.CreationTime) - .ToListAsync(); - var output = entities.Adapt>(); - return output; - } - - /// - /// 获取用户自己的消息 - /// - /// - [Authorize] - [HttpGet("chat-message/account")] - public async Task> GetAccountMessageListAsync() - { - //需要关联用户信息 - - //默认显示1个月的个人数据 - var userId = CurrentUser.Id!.Value; - //3个类型数据 - var entities = await _userMessageManager._repository._DbQueryable - .Where(x => x.MessageType == MessageTypeEnum.All - || x.ReceiveId == userId - || x.SendUserId == userId - ) - .Where(x => x.CreationTime >= DateTime.Now.AddDays(-30)) - .OrderBy(x => x.CreationTime) - .ToListAsync(); - - - var output = entities.Adapt>(); - var userIds = output.GetUserIds(); - - UserRoleMenuQueryEventArgs userRoleMenuQuery = new UserRoleMenuQueryEventArgs(userIds.ToArray()); - - //调用用户领域事件,获取用户信息,第一个发送者用户信息,第二个为接收者用户信息 - await _localEventBus.PublishAsync(userRoleMenuQuery, false); - - - - //映射用户信息 - output.MapperUserInfo(userRoleMenuQuery.Result); - - return output; - } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/ChatUserService.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/ChatUserService.cs deleted file mode 100644 index a4f474bf..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Services/ChatUserService.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Mapster; -using Volo.Abp.Application.Services; -using Volo.Abp.EventBus.Local; -using Yi.Framework.ChatHub.Domain.Managers; -using Yi.Framework.ChatHub.Domain.Shared.Model; -using Yi.Framework.Rbac.Domain.Shared.Etos; - -namespace Yi.Framework.ChatHub.Application.Services -{ - public class ChatUserService : ApplicationService - { - private UserMessageManager _messageManager; - private ILocalEventBus _localEventBus; - public ChatUserService(UserMessageManager messageManager, ILocalEventBus localEventBus) - { _messageManager = messageManager; _localEventBus = localEventBus; } - - public async Task> GetListAsync() - { - //映射用户信息 - var userList = await _messageManager.GetAllUserAsync(); - - var userIds = userList.Select(x => x.UserId).Distinct().ToList(); - UserRoleMenuQueryEventArgs userRoleMenuQuery = new UserRoleMenuQueryEventArgs(userIds.ToArray()); - - //调用用户领域事件,获取用户信息,第一个发送者用户信息,第二个为接收者用户信息 - await _localEventBus.PublishAsync(userRoleMenuQuery, false); - - var userInfoDic = userRoleMenuQuery.Result.ToDictionary(x => x.User.Id); - var output = userList.Adapt>(); - - foreach (var chatUser in output) - { - var currentUserInfo = userInfoDic[chatUser.UserId]; - chatUser.UserName= currentUserInfo.User.UserName; - chatUser.UserIcon = currentUserInfo.User.Icon; - } - return output; - } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Yi.Framework.ChatHub.Application.csproj b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Yi.Framework.ChatHub.Application.csproj deleted file mode 100644 index 4df813a8..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/Yi.Framework.ChatHub.Application.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/YiFrameworkChatHubApplicationModule.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/YiFrameworkChatHubApplicationModule.cs deleted file mode 100644 index 543185d6..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Application/YiFrameworkChatHubApplicationModule.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Yi.Framework.ChatHub.Domain; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.ChatHub.Application -{ - [DependsOn(typeof(YiFrameworkChatHubDomainModule), - - typeof(YiFrameworkDddApplicationContractsModule) - )] - public class YiFrameworkChatHubApplicationModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Caches/ChatOnlineUserCacheItem.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Caches/ChatOnlineUserCacheItem.cs deleted file mode 100644 index e130c1c4..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Caches/ChatOnlineUserCacheItem.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.ChatHub.Domain.Shared.Caches -{ - public class ChatOnlineUserCacheItem - { - public ChatOnlineUserCacheItem() - { - - - } - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 用户名称 - /// - public string UserName { get; set; } - - /// - /// 用户头像 - /// - public string UserIcon { get; set; } - - /// - /// 客户端id - /// - public string ClientId { get; set; } - - /// - /// 连接时间 - /// - public DateTime CreationTime { get; }=DateTime.Now; - - public override string ToString() - { - return System.Text.Json.JsonSerializer.Serialize(this); - } - } - - public class ChatOnlineUserCacheKey - { - public string CacheKeyPrefix; - public ChatOnlineUserCacheKey(string cacheKeyPrefix ) - { - CacheKeyPrefix=cacheKeyPrefix; - } - - public string GetKey() - { - return $"{CacheKeyPrefix}ChatOnline"; - } - - public string GetField(Guid userId) - { - return $"{userId}"; - } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Consts/ChatConst.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Consts/ChatConst.cs deleted file mode 100644 index 9fbcc413..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Consts/ChatConst.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.ChatHub.Domain.Shared.Consts -{ - public class ChatConst - { - public const string AllGroupName = "all"; - - public const string ClientActionReceiveMsg = "receiveMsg"; - public const string ClientActionUserStatus = "userStatus"; - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Dtos/AiChatContextDto.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Dtos/AiChatContextDto.cs deleted file mode 100644 index fcb58373..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Dtos/AiChatContextDto.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.ChatHub.Domain.Shared.Dtos -{ - public class AiChatContextDto - { - public AnswererTypeEnum AnswererType { get; set; } - - public string Message { get; set; } - - - public int Number { get; set; } - } - - - - public enum AnswererTypeEnum - { - Ai, - User - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Enums/MessageTypeEnum.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Enums/MessageTypeEnum.cs deleted file mode 100644 index ef07ef46..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Enums/MessageTypeEnum.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.ChatHub.Domain.Shared.Enums -{ - public enum MessageTypeEnum - { - - - Personal, - Group, - All, - Ai - - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Model/ChatUserModel.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Model/ChatUserModel.cs deleted file mode 100644 index 626c6dc3..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Model/ChatUserModel.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.ChatHub.Domain.Shared.Model -{ - public class ChatUserModel - { - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 用户名称 - /// - public string UserName { get; set; } - - /// - /// 用户头像 - /// - public string? UserIcon { get; set; } - - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Model/MessageContext.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Model/MessageContext.cs deleted file mode 100644 index aace06f6..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Model/MessageContext.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json.Serialization; -using System.Threading.Tasks; -using Yi.Framework.ChatHub.Domain.Shared.Enums; -using Yi.Framework.Rbac.Domain.Shared.Dtos; - -namespace Yi.Framework.ChatHub.Domain.Shared.Model -{ - - public static class MessageContextExtensions - { - public static List GetUserIds(this List context) - { - return context.Where(x => x.ReceiveId is not null).Select(x => x.ReceiveId!.Value).Union(context.Select(x => x.SendUserId)).ToList(); - } - public static List MapperUserInfo(this List messageContexts, List userRoleMenuDtos) - { - var userInfoDic = userRoleMenuDtos.Select(x => new UserRoleMenuDto { User = x.User }).ToDictionary(x => x.User.Id); - foreach (var context in messageContexts) - { - if (context.ReceiveId is not null) - { - context.ReceiveInfo = userInfoDic[context.ReceiveId.Value]; - } - context.SendUserInfo = userInfoDic[context.SendUserId]; - } - return messageContexts; - } - } - public class MessageContext - { - /// - /// 映射用户信息 - /// - - public static MessageContext CreatePersonal(string content, Guid userId, Guid sendUserId) - { - return new MessageContext() { MessageType = MessageTypeEnum.Personal, Content = content, ReceiveId = userId, SendUserId = sendUserId }; - } - - - public static MessageContext CreateAi(string? content, Guid receiveId, Guid id ) - { - return new MessageContext() { MessageType = MessageTypeEnum.Ai, Content = content??string.Empty, ReceiveId = receiveId, Id = id }; - } - - public static MessageContext CreateAll(string content, Guid sendUserId) - { - return new MessageContext() { MessageType = MessageTypeEnum.All, Content = content, SendUserId = sendUserId }; - } - - public void SetUserInfo(UserRoleMenuDto sendUserInfo, UserRoleMenuDto? receiveInfo) - { - this.SendUserInfo = sendUserInfo; - this.ReceiveInfo = receiveInfo; - - } - /// - /// 消息类型 - /// - [JsonConverter(typeof(JsonStringEnumConverter))] - public MessageTypeEnum MessageType { get; set; } - /// - /// 接收者(用户id、群组id) - /// - public Guid? ReceiveId { get; set; } - - /// - /// 接收者用户信息 - /// - public UserRoleMenuDto? ReceiveInfo { get; set; } - - /// - /// 发送者的用户id - /// - public Guid SendUserId { get; set; } - - /// - /// 发送者用户信息 - /// - public UserRoleMenuDto SendUserInfo { get; set; } - /// - /// 消息内容 - /// - public string Content { get; set; } - - /// - /// 上下文Id,主要用于ai流式传输 - /// - public Guid Id { get; set; } - public DateTime CreationTime { get; protected set; } = DateTime.Now; - } - - -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Options/AiOptions.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Options/AiOptions.cs deleted file mode 100644 index 46affbaa..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Options/AiOptions.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Yi.Framework.ChatHub.Domain.Shared.Options -{ - public class AiOptions - { - public string ApiKey { get; set; } - public string BaseDomain { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Yi.Framework.ChatHub.Domain.Shared.csproj b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Yi.Framework.ChatHub.Domain.Shared.csproj deleted file mode 100644 index ebe5b3d6..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/Yi.Framework.ChatHub.Domain.Shared.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/YiFrameworkChatHubDomainSharedModule.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/YiFrameworkChatHubDomainSharedModule.cs deleted file mode 100644 index 231f5e42..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain.Shared/YiFrameworkChatHubDomainSharedModule.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Domain; -using Yi.Framework.Bbs.Domain.Shared; -using Yi.Framework.ChatHub.Domain.Shared.Options; - -namespace Yi.Framework.ChatHub.Domain.Shared -{ - [DependsOn( - typeof(AbpDddDomainSharedModule), - - typeof(YiFrameworkBbsDomainSharedModule))] - public class YiFrameworkChatHubDomainSharedModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - Configure(configuration.GetSection("AiOptions")); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Entities/MessageAggregateRoot.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Entities/MessageAggregateRoot.cs deleted file mode 100644 index dc0d1843..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Entities/MessageAggregateRoot.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Volo.Abp.Auditing; -using Volo.Abp.Domain.Entities; -using Yi.Framework.ChatHub.Domain.Shared.Enums; -using Yi.Framework.ChatHub.Domain.Shared.Model; - -namespace Yi.Framework.ChatHub.Domain.Entities -{ - [SugarTable("YiMessage")] - [SugarIndex($"index_{nameof(MessageAggregateRoot)}", - nameof(ReceiveId), OrderByType.Asc, - nameof(SendUserId), OrderByType.Asc, - nameof(CreationTime), OrderByType.Asc)] - public class MessageAggregateRoot : AggregateRoot, IHasCreationTime - { - public static MessageContext CreatePersonal(string content, Guid userId, Guid sendUserId) - { - return new MessageContext() { MessageType = MessageTypeEnum.Personal, Content = content, ReceiveId = userId, SendUserId = sendUserId }; - } - - public static MessageContext CreateAll(string content, Guid sendUserId) - { - return new MessageContext() { MessageType = MessageTypeEnum.All, Content = content, SendUserId = sendUserId }; - } - - - public string Content { get; set; } - public MessageTypeEnum MessageType { get; set; } - /// - /// 接收者(用户id、群组id) - /// - public Guid? ReceiveId { get; set; } - - /// - /// 发送者的用户id - /// - public Guid SendUserId { get; set; } - - /// - /// 创建时间 - /// - public DateTime CreationTime { get; protected set; } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Managers/AiManager.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Managers/AiManager.cs deleted file mode 100644 index 5a73d8ac..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Managers/AiManager.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System.Collections.Generic; -using System.Net; -using Microsoft.Extensions.Options; -using Microsoft.SemanticKernel; -using Microsoft.SemanticKernel.ChatCompletion; -using Microsoft.SemanticKernel.Connectors.OpenAI; -// using OpenAI; -// using OpenAI.Managers; -// using OpenAI.ObjectModels; -// using OpenAI.ObjectModels.RequestModels; -// using OpenAI.ObjectModels.ResponseModels; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Services; -using Yi.Framework.ChatHub.Domain.Shared.Dtos; -using Yi.Framework.ChatHub.Domain.Shared.Options; -namespace Yi.Framework.ChatHub.Domain.Managers -{ - public class AiManager : ISingletonDependency - { - private readonly Kernel _kernel; - public AiManager(Kernel kernel) - { - _kernel = kernel; - } - - public async IAsyncEnumerable ChatAsStreamAsync(string model, List aiChatContextDtos) - { - if (aiChatContextDtos.Count == 0) - { - yield return null; - } - var openSettings = new OpenAIPromptExecutionSettings() - { - MaxTokens =1000 - }; - - var chatCompletionService = this._kernel.GetRequiredService(model); - - var history =new ChatHistory(); - foreach (var aiChatContextDto in aiChatContextDtos) - { - if (aiChatContextDto.AnswererType==AnswererTypeEnum.Ai) - { - history.AddSystemMessage(aiChatContextDto.Message); - } - else if(aiChatContextDto.AnswererType==AnswererTypeEnum.User) - { - history.AddUserMessage(aiChatContextDto.Message); - } - } - - var results = chatCompletionService.GetStreamingChatMessageContentsAsync( - chatHistory: history, - executionSettings: openSettings, - kernel: _kernel); - if (results is null) - { - yield return null; - } - await foreach (var result in results) - { - yield return result.Content; - } - } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Managers/UserMessageManager.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Managers/UserMessageManager.cs deleted file mode 100644 index 6810e9f4..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Managers/UserMessageManager.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Security.AccessControl; -using FreeRedis; -using Mapster; -using Microsoft.AspNetCore.SignalR; -using Microsoft.Extensions.Options; -using Volo.Abp.Caching; -using Volo.Abp.Domain.Repositories; -using Volo.Abp.Domain.Services; -using Yi.Framework.ChatHub.Domain.Entities; -using Yi.Framework.ChatHub.Domain.Shared.Caches; -using Yi.Framework.ChatHub.Domain.Shared.Consts; -using Yi.Framework.ChatHub.Domain.Shared.Enums; -using Yi.Framework.ChatHub.Domain.Shared.Model; -using Yi.Framework.ChatHub.Domain.SignalRHubs; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.ChatHub.Domain.Managers -{ - public class UserMessageManager : DomainService - { - private IHubContext _hubContext; - public ISqlSugarRepository _repository; - public UserMessageManager(IHubContext hubContext, ISqlSugarRepository repository) - { - _hubContext = hubContext; - _repository = repository; - } - /// - /// 使用懒加载防止报错 - /// - private IRedisClient RedisClient => LazyServiceProvider.LazyGetRequiredService(); - private string CacheKeyPrefix => LazyServiceProvider.LazyGetRequiredService>().Value.KeyPrefix; - - - /// - /// 发送消息 - /// - /// 消息内容 - /// 关联字符 - /// - public async Task SendMessageAsync(MessageContext context,string relStr=null) - { - switch (context.MessageType) - { - case MessageTypeEnum.Personal: - var userModel = await GetUserAsync(context.ReceiveId.Value); - if (userModel is not null) - { - await _hubContext.Clients.Client(userModel.ClientId).SendAsync(ChatConst.ClientActionReceiveMsg, context.MessageType,relStr, context); - } - break; - case MessageTypeEnum.Group: - throw new NotImplementedException(); - break; - case MessageTypeEnum.All: - await _hubContext.Clients.All.SendAsync(ChatConst.ClientActionReceiveMsg, context.MessageType,relStr, context); - break; - case MessageTypeEnum.Ai: - var userModel2 = await GetUserAsync(context.ReceiveId.Value); - if (userModel2 is not null) - { - await _hubContext.Clients.Client(userModel2.ClientId).SendAsync(ChatConst.ClientActionReceiveMsg, context.MessageType,relStr, context); - } - break; - - default: - break; - } - - } - - - public async Task CreateMessageStoreAsync(MessageContext context) - { - await _repository.InsertAsync(context.Adapt()); - } - - public async Task> GetAllUserAsync() - { - var key = new ChatOnlineUserCacheKey(CacheKeyPrefix); - var cacheUsers = (await RedisClient.HGetAllAsync(key.GetKey())).Select(x => System.Text.Json.JsonSerializer.Deserialize(x.Value)).ToList(); - return cacheUsers; - } - - public async Task GetUserAsync(Guid userId) - { - var key = new ChatOnlineUserCacheKey(CacheKeyPrefix); - var cacheUserOrNull= await RedisClient.HGetAsync(key.GetKey(), key.GetField(userId)); - if (cacheUserOrNull is null) - { - return null; - } - var cacheUser = System.Text.Json.JsonSerializer.Deserialize(cacheUserOrNull); - return cacheUser; - } - } - - -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/SignalRHubs/ChatCenterHub.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/SignalRHubs/ChatCenterHub.cs deleted file mode 100644 index c216cad4..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/SignalRHubs/ChatCenterHub.cs +++ /dev/null @@ -1,68 +0,0 @@ -using FreeRedis; -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.SignalR; -using Microsoft.Extensions.Options; -using Volo.Abp.AspNetCore.SignalR; -using Volo.Abp.Caching; -using Yi.Framework.ChatHub.Domain.Shared.Caches; -using Yi.Framework.ChatHub.Domain.Shared.Consts; -using Yi.Framework.ChatHub.Domain.Shared.Model; - -namespace Yi.Framework.ChatHub.Domain.SignalRHubs -{ - [HubRoute("/hub/chat")] - [Authorize] - public class ChatCenterHub : AbpHub - { - /// - /// 使用懒加载防止报错 - /// - private IRedisClient RedisClient => LazyServiceProvider.LazyGetRequiredService(); - /// - /// 缓存前缀 - /// - private string CacheKeyPrefix => LazyServiceProvider.LazyGetRequiredService>().Value.KeyPrefix; - public ChatCenterHub() - { - } - - /// - /// 用户进入聊天室 - /// - /// - public override async Task OnConnectedAsync() - { - var key = new ChatOnlineUserCacheKey(CacheKeyPrefix); - var item = new ChatOnlineUserCacheItem() - { - UserId = CurrentUser.Id!.Value, - ClientId = Context.ConnectionId, - UserName = CurrentUser.UserName! - }; - - - await RedisClient.HSetAsync(key.GetKey(), key.GetField(CurrentUser.Id!.Value), item); - - - //连接时,还需要去查询用户包含在的群组,将群主全部加入.Todo - await Groups.AddToGroupAsync(Context.ConnectionId, ChatConst.AllGroupName); - await Clients.All.SendAsync("liveUser", item.Adapt()); - - - } - - /// - /// 用户退出聊天室 - /// - /// - /// - public async override Task OnDisconnectedAsync(Exception? exception) - { - var key = new ChatOnlineUserCacheKey(CacheKeyPrefix); - await RedisClient.HDelAsync(key.GetKey(), key.GetField(CurrentUser.Id!.Value)); - await Groups.RemoveFromGroupAsync(Context.ConnectionId, ChatConst.AllGroupName); - await Clients.All.SendAsync("offlineUser", CurrentUser.Id!.Value); - } - } -} diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Yi.Framework.ChatHub.Domain.csproj b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Yi.Framework.ChatHub.Domain.csproj deleted file mode 100644 index b158ec5e..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/Yi.Framework.ChatHub.Domain.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/YiFrameworkChatHubDomainModule.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/YiFrameworkChatHubDomainModule.cs deleted file mode 100644 index 02a4b90e..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.Domain/YiFrameworkChatHubDomainModule.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.SemanticKernel; -using Volo.Abp.Domain; -using Yi.Framework.Caching.FreeRedis; -using Yi.Framework.ChatHub.Domain.Shared; -using Yi.Framework.Core.Options; - - -namespace Yi.Framework.ChatHub.Domain -{ - [DependsOn( - typeof(YiFrameworkChatHubDomainSharedModule), - typeof(YiFrameworkCachingFreeRedisModule), - - typeof(AbpDddDomainModule) - )] - public class YiFrameworkChatHubDomainModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - var services = context.Services; - - // 配置绑定 - var semanticKernelSection = configuration.GetSection("SemanticKernel"); - services.Configure(configuration.GetSection("SemanticKernel")); -#pragma warning disable SKEXP0010 - // 从配置中获取值 - var options = semanticKernelSection.Get(); - foreach (var optionsModelId in options.ModelIds) - { - services.AddKernel() - .AddOpenAIChatCompletion( - serviceId: optionsModelId, - modelId: optionsModelId, - endpoint: new Uri(options.Endpoint), - apiKey: options.ApiKey); - } -#pragma warning restore SKEXP0010 - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.SqlSugarCore/Yi.Framework.ChatHub.SqlSugarCore.csproj b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.SqlSugarCore/Yi.Framework.ChatHub.SqlSugarCore.csproj deleted file mode 100644 index 0eeee7bb..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.SqlSugarCore/Yi.Framework.ChatHub.SqlSugarCore.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.SqlSugarCore/YiFrameworkChatHubSqlSugarCoreModule.cs b/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.SqlSugarCore/YiFrameworkChatHubSqlSugarCoreModule.cs deleted file mode 100644 index 710c4500..00000000 --- a/Yi.Abp.Net8/module/chat-hub/Yi.Framework.ChatHub.SqlSugarCore/YiFrameworkChatHubSqlSugarCoreModule.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Yi.Framework.ChatHub.Domain; -using Yi.Framework.SqlSugarCore; - -namespace Yi.Framework.ChatHub.SqlSugarCore -{ - [DependsOn( - typeof(YiFrameworkChatHubDomainModule), - - typeof(YiFrameworkSqlSugarCoreModule))] - public class YiFrameworkChatHubSqlSugarCoreModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Field/FieldDto.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Field/FieldDto.cs deleted file mode 100644 index 0ca35e1a..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Field/FieldDto.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.CodeGen.Domain.Shared.Enums; - -namespace Yi.Framework.CodeGen.Application.Contracts.Dtos.Field -{ - public class FieldDto : EntityDto - { - /// - /// 字段名称 - /// - public string Name { get; set; } - public string? Description { get; set; } - - public int OrderNum { get; set; } - public int Length { get; set; } - - public FieldTypeEnum FieldType { get; set; } - - public Guid TableId { get; set; } - - /// - /// 是否必填 - /// - public bool IsRequired { get; set; } - - /// - /// 是否主键 - /// - public bool IsKey { get; set; } - - /// - /// 是否自增 - /// - public bool IsAutoAdd { get; set; } - - /// - /// 是否公共 - /// - public bool IsPublic { get; set; } - public Guid Id { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Field/FieldGetListInput.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Field/FieldGetListInput.cs deleted file mode 100644 index 16bdbac0..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Field/FieldGetListInput.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.CodeGen.Application.Contracts.Dtos.Field -{ - public class FieldGetListInput : PagedAndSortedResultRequestDto - { - /// - /// 字段名称 - /// - public string? Name { get; set; } - - public Guid? TableId { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Table/TableDto.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Table/TableDto.cs deleted file mode 100644 index 696cd49b..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Table/TableDto.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.CodeGen.Application.Contracts.Dtos.Field; - -namespace Yi.Framework.CodeGen.Application.Contracts.Dtos.Table -{ - public class TableDto : EntityDto - { - public Guid Id { get; set; } - /// - /// 表名 - /// - public string Name { get; set; } - - /// - /// 备注 - /// - public string? Description { get; set; } - - /// - /// 一表多字段 - /// - public List? Fields { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Table/TableGetListInput.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Table/TableGetListInput.cs deleted file mode 100644 index aa213339..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Table/TableGetListInput.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.CodeGen.Application.Contracts.Dtos.Table -{ - public class TableGetListInput : PagedAndSortedResultRequestDto - { - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Template/TemplateDto.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Template/TemplateDto.cs deleted file mode 100644 index fed21cbe..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Template/TemplateDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.CodeGen.Application.Contracts.Dtos.Template -{ - public class TemplateDto : EntityDto - { - public Guid Id { get; set; } - - /// - /// 模板字符串 - /// - public string TemplateStr { get; set; } = string.Empty; - - /// - /// 生成路径 - /// - public string BuildPath { get; set; } - - - /// - /// 模板名称 - /// - public string Name { get; set; } - - /// - /// 备注 - /// - public string? Remarks { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Template/TemplateGetListInput.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Template/TemplateGetListInput.cs deleted file mode 100644 index d8fc5e9f..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Dtos/Template/TemplateGetListInput.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.CodeGen.Application.Contracts.Dtos.Template -{ - public class TemplateGetListInput : PagedAndSortedResultRequestDto - { - - /// - /// 模板名称 - /// - public string? Name { get; set; } - - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ICodeGenService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ICodeGenService.cs deleted file mode 100644 index 1b76b825..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ICodeGenService.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Volo.Abp.Application.Services; - -namespace Yi.Framework.CodeGen.Application.Contracts.IServices -{ - public interface ICodeGenService : IApplicationService - { - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/IFieldService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/IFieldService.cs deleted file mode 100644 index 0095944d..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/IFieldService.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Yi.Framework.CodeGen.Application.Contracts.Dtos.Field; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.CodeGen.Application.Contracts.IServices -{ - public interface IFieldService : IYiCrudAppService - { - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ITableService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ITableService.cs deleted file mode 100644 index 8b1ebd3f..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ITableService.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Yi.Framework.CodeGen.Application.Contracts.Dtos.Table; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.CodeGen.Application.Contracts.IServices -{ - public interface ITableService : IYiCrudAppService - { - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ITemplateService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ITemplateService.cs deleted file mode 100644 index de5e99cd..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/IServices/ITemplateService.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Yi.Framework.CodeGen.Application.Contracts.Dtos.Template; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.CodeGen.Application.Contracts.IServices -{ - public interface ITemplateService : IYiCrudAppService - { - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Yi.Framework.CodeGen.Application.Contracts.csproj b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Yi.Framework.CodeGen.Application.Contracts.csproj deleted file mode 100644 index 18088e9e..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/Yi.Framework.CodeGen.Application.Contracts.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/YiFrameworkCodeGenApplicationContractsModule.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/YiFrameworkCodeGenApplicationContractsModule.cs deleted file mode 100644 index 30727036..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application.Contracts/YiFrameworkCodeGenApplicationContractsModule.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Yi.Framework.CodeGen.Domain.Shared; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.CodeGen.Application.Contracts -{ - [DependsOn(typeof(YiFrameworkCodeGenDomainSharedModule), - typeof(YiFrameworkDddApplicationContractsModule))] - public class YiFrameworkCodeGenApplicationContractsModule : AbpModule - { - - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/CodeGenService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/CodeGenService.cs deleted file mode 100644 index cf9091aa..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/CodeGenService.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Diagnostics; -using System.Runtime.InteropServices; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.Uow; -using Yi.Framework.CodeGen.Application.Contracts.IServices; -using Yi.Framework.CodeGen.Domain.Entities; -using Yi.Framework.CodeGen.Domain.Managers; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.CodeGen.Application.Services -{ - /// - /// CodeGen - /// - public class CodeGenService : ApplicationService, ICodeGenService - { - private ISqlSugarRepository _tableRepository; - private CodeFileManager _codeFileManager; - private WebTemplateManager _webTemplateManager; - public CodeGenService(ISqlSugarRepository tableRepository, CodeFileManager codeFileManager, WebTemplateManager webTemplateManager) - { - _tableRepository = tableRepository; - _codeFileManager = codeFileManager; - _webTemplateManager = webTemplateManager; - } - - /// - /// Web To Code - /// - /// - public async Task PostWebBuildCodeAsync(List ids) - { - //获取全部表 - var tables = await _tableRepository._DbQueryable.Where(x => ids.Contains(x.Id)).Includes(x => x.Fields).ToListAsync(); - foreach (var table in tables) - { - await _codeFileManager.BuildWebToCodeAsync(table); - } - - } - - - /// - /// Web To Db - /// - /// - public async Task PostWebBuildDbAsync() - { - throw new NotImplementedException(); - } - - /// - /// Code To Web - /// - /// - [UnitOfWork] - public async Task PostCodeBuildWebAsync() - { - var tableAggregateRoots = await _webTemplateManager.BuildCodeToWebAsync(); - //覆盖数据库,将聚合根保存到数据库 - _tableRepository._Db.DbMaintenance.TruncateTable(); - _tableRepository._Db.DbMaintenance.TruncateTable(); - - //导航插入即可 - await _tableRepository._Db.InsertNav(tableAggregateRoots).Include(x => x.Fields).ExecuteCommandAsync(); - } - - - /// - /// Code To Db - /// - /// - public async Task PostCodeBuildDbAsync() - { - throw new NotImplementedException(); - } - - /// - /// 打开目录 - /// - /// - [HttpPost("code-gen/dir/{**path}")] - public async Task PostDir([FromRoute] string path) - { - if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) - { - path = Uri.UnescapeDataString(path); - //去除包含@的目录 - path = string.Join("\\", path.Split("\\").Where(x => !x.Contains("@")).ToList()); - Process.Start("explorer.exe", path); - } - else - { - throw new UserFriendlyException("当前操作系统不支持打开目录"); - } - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/FieldService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/FieldService.cs deleted file mode 100644 index b936b36f..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/FieldService.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Reflection; -using System.Xml.Linq; -using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json.Linq; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.CodeGen.Application.Contracts.Dtos.Field; -using Yi.Framework.CodeGen.Application.Contracts.IServices; -using Yi.Framework.CodeGen.Domain.Entities; -using Yi.Framework.CodeGen.Domain.Shared.Enums; -using Yi.Framework.Ddd.Application; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.CodeGen.Application.Services -{ - /// - /// 字段管理 - /// - public class FieldService : YiCrudAppService, IFieldService - { - private ISqlSugarRepository _repository; - public FieldService(ISqlSugarRepository repository) : base(repository) - { - _repository = repository; - } - - public async override Task> GetListAsync([FromQuery] FieldGetListInput input) - { - RefAsync total = 0; - var entities = await _repository._DbQueryable.WhereIF(input.TableId is not null, x => x.TableId.Equals(input.TableId!)) - .WhereIF(input.Name is not null, x => x.Name!.Contains(input.Name!)) - - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto - { - TotalCount = total, - Items = await MapToGetListOutputDtosAsync(entities) - }; - } - - /// - /// 获取类型枚举 - /// - /// - [Route("field/type")] - public object GetFieldTypeEnum() - { - return typeof(FieldTypeEnum).GetFields(BindingFlags.Static | BindingFlags.Public).Select(x => new { lable = x.Name, value = (int)Enum.Parse(typeof(FieldTypeEnum), x.Name) }).ToList(); - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/TableService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/TableService.cs deleted file mode 100644 index 5286d04e..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/TableService.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Volo.Abp.Domain.Repositories; -using Yi.Framework.CodeGen.Application.Contracts.Dtos.Table; -using Yi.Framework.CodeGen.Application.Contracts.IServices; -using Yi.Framework.CodeGen.Domain.Entities; -using Yi.Framework.Ddd.Application; - -namespace Yi.Framework.CodeGen.Application.Services -{ - public class TableService : YiCrudAppService, ITableService - { - public TableService(IRepository repository) : base(repository) - { - } - - public override Task> GetListAsync(TableGetListInput input) - { - return base.GetListAsync(input); - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/TemplateService.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/TemplateService.cs deleted file mode 100644 index a5684b4e..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Services/TemplateService.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Yi.Framework.CodeGen.Application.Contracts.Dtos.Template; -using Yi.Framework.CodeGen.Application.Contracts.IServices; -using Yi.Framework.CodeGen.Domain.Entities; -using Yi.Framework.Ddd.Application; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.CodeGen.Application.Services; - -public class TemplateService : YiCrudAppService, ITemplateService -{ - private ISqlSugarRepository _repository; - public TemplateService(ISqlSugarRepository repository) : base(repository) - { - _repository = repository; - } - - public async override Task> GetListAsync([FromQuery] TemplateGetListInput input) - { - RefAsync total = 0; - var entities = await _repository._DbQueryable.WhereIF(input.Name is not null, x => x.Name.Equals(input.Name!)) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto - { - TotalCount = total, - Items = await MapToGetListOutputDtosAsync(entities) - }; - } -} - diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Yi.Framework.CodeGen.Application.csproj b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Yi.Framework.CodeGen.Application.csproj deleted file mode 100644 index 152fd158..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/Yi.Framework.CodeGen.Application.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/YiFrameworkCodeGenApplicationModule.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/YiFrameworkCodeGenApplicationModule.cs deleted file mode 100644 index 0df0ea36..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Application/YiFrameworkCodeGenApplicationModule.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Yi.Framework.CodeGen.Application.Contracts; -using Yi.Framework.CodeGen.Domain; -using Yi.Framework.Ddd.Application; - -namespace Yi.Framework.CodeGen.Application -{ - [DependsOn(typeof(YiFrameworkCodeGenApplicationContractsModule), - typeof(YiFrameworkCodeGenDomainModule), - typeof(YiFrameworkDddApplicationModule))] - public class YiFrameworkCodeGenApplicationModule : AbpModule - { - - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Enums/FieldTypeEnum.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Enums/FieldTypeEnum.cs deleted file mode 100644 index 8a08cca9..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Enums/FieldTypeEnum.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.CodeGen.Domain.Shared.Enums -{ - public enum FieldTypeEnum - { - [Display(Name = "string", Description = "String")] - String, - - [Display(Name = "int", Description = "Int32")] - Int, - - [Display(Name = "long", Description = "Int64")] - Long, - - [Display(Name = "bool", Description = "Boolean")] - Bool, - - [Display(Name = "decimal", Description = "Decimal")] - Decimal, - - [Display(Name = "DateTime", Description = "DateTime")] - DateTime, - - [Display(Name = "Guid", Description = "Guid")] - Guid - } - -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Yi.Framework.CodeGen.Domain.Shared.csproj b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Yi.Framework.CodeGen.Domain.Shared.csproj deleted file mode 100644 index f0bf166b..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/Yi.Framework.CodeGen.Domain.Shared.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/YiFrameworkCodeGenDomainSharedModule.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/YiFrameworkCodeGenDomainSharedModule.cs deleted file mode 100644 index 8bd1cc2b..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain.Shared/YiFrameworkCodeGenDomainSharedModule.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Domain; -using Volo.Abp.Modularity; - -namespace Yi.Framework.CodeGen.Domain.Shared -{ - [DependsOn(typeof(AbpDddDomainSharedModule))] - public class YiFrameworkCodeGenDomainSharedModule : AbpModule - { - - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/FieldEntity.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/FieldEntity.cs deleted file mode 100644 index 23fa0a0f..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/FieldEntity.cs +++ /dev/null @@ -1,45 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities; -using Yi.Framework.CodeGen.Domain.Shared.Enums; - -namespace Yi.Framework.CodeGen.Domain.Entities -{ - [SugarTable("YiField")] - public class FieldEntity : Entity - { - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - /// - /// 字段名称 - /// - public string Name { get; set; } - public string? Description { get; set; } - - public int OrderNum { get; set; } - public int Length { get; set; } - - public FieldTypeEnum FieldType { get; set; } - - public Guid TableId { get; set; } - - /// - /// 是否必填 - /// - public bool IsRequired { get; set; } - - /// - /// 是否主键 - /// - public bool IsKey { get; set; } - - /// - /// 是否自增 - /// - public bool IsAutoAdd { get; set; } - - /// - /// 是否公共 - /// - public bool IsPublic { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/TableAggregateRoot.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/TableAggregateRoot.cs deleted file mode 100644 index 48ba4165..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/TableAggregateRoot.cs +++ /dev/null @@ -1,32 +0,0 @@ -using SqlSugar; -using Volo.Abp.Data; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.CodeGen.Domain.Entities -{ - [SugarTable("YiTable")] - public class TableAggregateRoot : AggregateRoot - { - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - /// - /// 表名 - /// - public string Name { get; set; } - - /// - /// 备注 - /// - - public string? Description { get; set; } - - /// - /// 一表多字段 - /// - [Navigate(NavigateType.OneToMany, nameof(FieldEntity.TableId))] - public List Fields { get; set; } - - [SugarColumn(IsIgnore =true)] - public override ExtraPropertyDictionary ExtraProperties { get; protected set; } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/TemplateAggregateRoot.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/TemplateAggregateRoot.cs deleted file mode 100644 index 477c0d07..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Entities/TemplateAggregateRoot.cs +++ /dev/null @@ -1,34 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities; - -namespace Yi.Framework.CodeGen.Domain.Entities -{ - [SugarTable("YiTemplate")] - public class TemplateAggregateRoot : AggregateRoot - { - - [SugarColumn(ColumnName = "Id", IsPrimaryKey = true)] - public override Guid Id { get; protected set; } - - /// - /// 模板字符串 - /// - [SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)] - public string TemplateStr { get; set; } = string.Empty; - - /// - /// 生成路径 - /// - public string BuildPath { get; set; } - - /// - /// 模板名称 - /// - public string Name { get; set; } - - /// - /// 备注 - /// - public string? Remarks { get; set; } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/FieldTemplateHandler.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/FieldTemplateHandler.cs deleted file mode 100644 index 895ae1a2..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/FieldTemplateHandler.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Reflection; -using System.Text; -using Yi.Framework.CodeGen.Domain.Shared.Enums; - -namespace Yi.Framework.CodeGen.Domain.Handlers -{ - public class FieldTemplateHandler : TemplateHandlerBase, ITemplateHandler - { - public HandledTemplate Invoker(string str, string path) - { - var output = new HandledTemplate(); - output.TemplateStr = str.Replace("@field", BuildFields()); - output.BuildPath = path; - return output; - } - - - /// - /// 生成Fields - /// - /// - public string BuildFields() - { - StringBuilder fieldStrs = new StringBuilder(); - - - foreach (var field in Table.Fields) - { - var typeStr = typeof(FieldTypeEnum).GetFields().Where(x => x.Name == field.FieldType.ToString())?.FirstOrDefault().GetCustomAttribute().Name; - - if (typeStr is null) - { - continue; - } - var nameStr = field.Name; - - //添加备注 - if (!string.IsNullOrEmpty(field.Description)) - { - var desStr = "/// \n" + - $"///{field.Description}\n" + - "/// \n"; - fieldStrs.AppendLine(desStr); - } - - //添加长度 - if (field.Length != 0) - { - var lengthStr = $"[SugarColumn(Length ={field.Length})]"; - fieldStrs.AppendLine(lengthStr); - } - - //添加可空类型 - string nullStr = ""; - if (field.IsRequired == false) - { - nullStr = "?"; - } - - //添加字段 - var fieldStr = $"public {typeStr}{nullStr} {nameStr} {{ get; set; }}"; - - fieldStrs.AppendLine(fieldStr); - } - - return fieldStrs.ToString(); - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/HandledTemplate.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/HandledTemplate.cs deleted file mode 100644 index 61025012..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/HandledTemplate.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.CodeGen.Domain.Handlers -{ - public class HandledTemplate - { - public string TemplateStr { get; set; } - - public string BuildPath { get; set; } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/ITemplateHandler.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/ITemplateHandler.cs deleted file mode 100644 index 5d65d566..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/ITemplateHandler.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Yi.Framework.CodeGen.Domain.Entities; - -namespace Yi.Framework.CodeGen.Domain.Handlers -{ - public interface ITemplateHandler : ISingletonDependency - { - void SetTable(TableAggregateRoot table); - HandledTemplate Invoker(string str, string path); - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/ModelTemplateHandler.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/ModelTemplateHandler.cs deleted file mode 100644 index 100f8bbb..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/ModelTemplateHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Yi.Framework.CodeGen.Domain.Handlers -{ - public class ModelTemplateHandler : TemplateHandlerBase, ITemplateHandler - { - public HandledTemplate Invoker(string str, string path) - { - var output = new HandledTemplate(); - output.TemplateStr = str.Replace("@model", char.ToLowerInvariant(Table.Name[0]) + Table.Name.Substring(1)).Replace("@Model", char.ToUpperInvariant(Table.Name[0]) + Table.Name.Substring(1)); - output.BuildPath = path.Replace("@model", char.ToLowerInvariant(Table.Name[0]) + Table.Name.Substring(1)).Replace("@Model", char.ToUpperInvariant(Table.Name[0]) + Table.Name.Substring(1)); - return output; - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/NameSpaceTemplateHandler.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/NameSpaceTemplateHandler.cs deleted file mode 100644 index 42729941..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/NameSpaceTemplateHandler.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Yi.Framework.CodeGen.Domain.Handlers -{ - public class NameSpaceTemplateHandler : TemplateHandlerBase, ITemplateHandler - { - public HandledTemplate Invoker(string str, string path) - { - var output = new HandledTemplate(); - output.TemplateStr = str.Replace("@namespace", ""); - output.BuildPath = path; - return output; - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/TemplateHandlerBase.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/TemplateHandlerBase.cs deleted file mode 100644 index 96162955..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Handlers/TemplateHandlerBase.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Yi.Framework.CodeGen.Domain.Entities; - -namespace Yi.Framework.CodeGen.Domain.Handlers -{ - public class TemplateHandlerBase - { - protected TableAggregateRoot Table { get; set; } - - public void SetTable(TableAggregateRoot table) - { - Table = table; - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/CodeFileManager.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/CodeFileManager.cs deleted file mode 100644 index 043b9691..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/CodeFileManager.cs +++ /dev/null @@ -1,53 +0,0 @@ -using Volo.Abp.Domain.Services; -using Yi.Framework.CodeGen.Domain.Entities; -using Yi.Framework.CodeGen.Domain.Handlers; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.CodeGen.Domain.Managers -{ - /// - /// 代码文件领域服务,与代码文件生成相关,web to code - /// - public class CodeFileManager : DomainService - { - private IEnumerable _templateHandlers; - private ISqlSugarRepository _repository; - private ISqlSugarRepository _fieldRepository; - public CodeFileManager(IEnumerable templateHandlers, ISqlSugarRepository fieldRepository, ISqlSugarRepository repository) - { - _templateHandlers = templateHandlers; - _repository = repository; - _fieldRepository = fieldRepository; - } - public async Task BuildWebToCodeAsync(TableAggregateRoot tableEntity) - { - var templates = await _repository.GetListAsync(); - foreach (var template in templates) - { - var handledTempalte = new HandledTemplate(); - handledTempalte.TemplateStr = template.TemplateStr; - handledTempalte.BuildPath = template.BuildPath; - foreach (var templateHandler in _templateHandlers) - { - templateHandler.SetTable(tableEntity); - handledTempalte = templateHandler.Invoker(handledTempalte.TemplateStr, handledTempalte.BuildPath); - } - await BuildToFileAsync(handledTempalte); - - } - } - - - private async Task BuildToFileAsync(HandledTemplate handledTemplate) - { - if (!Directory.Exists(Path.GetDirectoryName(handledTemplate.BuildPath))) - { - Directory.CreateDirectory(Path.GetDirectoryName(handledTemplate.BuildPath)); - } - await File.WriteAllTextAsync(handledTemplate.BuildPath, handledTemplate.TemplateStr); - } - - - } - -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/DataBaseManger.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/DataBaseManger.cs deleted file mode 100644 index 0120b541..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/DataBaseManger.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Volo.Abp.Domain.Services; - -namespace Yi.Framework.CodeGen.Domain.Managers -{ - /// - /// 数据库领域服务,与数据库相关,同步到数据库,web to db ,code to db - /// - public class DataBaseManger : DomainService - { - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/WebTemplateManager.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/WebTemplateManager.cs deleted file mode 100644 index 0209499d..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Managers/WebTemplateManager.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Reflection; -using SqlSugar; -using Volo.Abp.Domain.Services; -using Yi.Framework.CodeGen.Domain.Entities; -using Yi.Framework.CodeGen.Domain.Shared.Enums; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.CodeGen.Domain.Managers -{ - /// - /// 与webfrist相关,同步到web,code to web - /// - public class WebTemplateManager : DomainService - { - private ISqlSugarRepository _repository; - private IModuleContainer _moduleContainer; - public WebTemplateManager(ISqlSugarRepository repository, IModuleContainer moduleContainer) - { - _repository = repository; - _moduleContainer = moduleContainer; - } - /// - /// 通过当前的实体代码获取表存储 - /// - /// - - public Task> BuildCodeToWebAsync() - { - List entityTypes = new List(); - foreach (var module in _moduleContainer.Modules) - { - entityTypes.AddRange(module.Assembly.GetTypes() - .Where(x => x.GetCustomAttribute() == null) - .Where(x => x.GetCustomAttribute() != null) - .Where(x => x.GetCustomAttribute() is null)); - } - - var tableAggregateRoots = new List(); - foreach (var entityType in entityTypes) - { - tableAggregateRoots.Add(EntityTypeMapperToTable(entityType)); - } - - return Task.FromResult(tableAggregateRoots); - } - - private TableAggregateRoot EntityTypeMapperToTable(Type entityType) - { - var tableAggregateRoot = new TableAggregateRoot(); - tableAggregateRoot.Fields = new List(); - var table = entityType.GetCustomAttribute(); - - tableAggregateRoot.Name = table.TableName; - - foreach (var p in entityType.GetProperties()) - { - tableAggregateRoot.Fields.Add(PropertyMapperToFiled(p)); - } - tableAggregateRoot.Fields.ForEach(x => x.TableId = tableAggregateRoot.Id); - return tableAggregateRoot; - } - - - private FieldEntity PropertyMapperToFiled(PropertyInfo propertyInfo) - { - var fieldEntity = new FieldEntity(); - fieldEntity.Name = propertyInfo.Name; - - - //获取数据类型,包括可空类型 - Type? fieldType = null; - // 如果字段类型是 Nullable 泛型类型 - if (propertyInfo.PropertyType.IsGenericType && propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)) - { - Type nullableType = Nullable.GetUnderlyingType(propertyInfo.PropertyType)!; - fieldType = nullableType; - } - else - { - fieldType = propertyInfo.PropertyType; - } - - //判断类型 - var enumName = typeof(FieldTypeEnum).GetFields(BindingFlags.Static | BindingFlags.Public).Where(x => x.GetCustomAttribute()?.Description == fieldType.Name).FirstOrDefault()?.Name; - if (enumName is null) - { - fieldEntity.FieldType = FieldTypeEnum.String; - // App.GetRequiredService>().LogError($"字段类型:{propertyInfo.PropertyType.Name},未定义"); - } - else - { - fieldEntity.FieldType = (FieldTypeEnum)Enum.Parse(typeof(FieldTypeEnum), enumName); - } - - //判断是否可空 - if (propertyInfo.PropertyType.IsGenericType && propertyInfo.PropertyType.GetGenericTypeDefinition() == typeof(Nullable<>)) - { - fieldEntity.IsRequired = false; - } - else - { - fieldEntity.IsRequired = true; - } - - - - //判断是否主键 - if (propertyInfo.GetCustomAttribute()?.IsPrimaryKey == true) - { - fieldEntity.IsKey = true; - } - - //判断长度 - var colum = propertyInfo.GetCustomAttribute(); - if (colum is not null && colum.Length != 0) - { - fieldEntity.Length = colum.Length; - } - return fieldEntity; - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Yi.Framework.CodeGen.Domain.csproj b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Yi.Framework.CodeGen.Domain.csproj deleted file mode 100644 index 50e58bea..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/Yi.Framework.CodeGen.Domain.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/YiFrameworkCodeGenDomainModule.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/YiFrameworkCodeGenDomainModule.cs deleted file mode 100644 index ac6f7780..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.Domain/YiFrameworkCodeGenDomainModule.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Volo.Abp.Domain; -using Volo.Abp.Modularity; -using Yi.Framework.CodeGen.Domain.Shared; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.CodeGen.Domain -{ - [DependsOn(typeof(YiFrameworkCodeGenDomainSharedModule), - typeof(AbpDddDomainModule), - typeof(YiFrameworkSqlSugarCoreAbstractionsModule))] - public class YiFrameworkCodeGenDomainModule : AbpModule - { - - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/TemplateDataSeed.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/TemplateDataSeed.cs deleted file mode 100644 index 53ae4f3f..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/TemplateDataSeed.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Volo.Abp.Data; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Guids; -using Yi.Framework.CodeGen.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.CodeGen.SqlSugarCore -{ - public class TemplateDataSeed : IDataSeedContributor, ITransientDependency - { - private ISqlSugarRepository _repository; - public TemplateDataSeed(ISqlSugarRepository repository) - { - _repository = repository; - } - public async Task SeedAsync(DataSeedContext context) - { - if (!await _repository.IsAnyAsync(x => true)) - { - await _repository.InsertManyAsync(GetSeedData()); - } - } - public List GetSeedData() - { - var entities = new List(); - TemplateAggregateRoot entityTemplate = new TemplateAggregateRoot() - { - Name = "Entity", - BuildPath = "D:\\code\\Entities\\@ModelEntity.cs", - Remarks = "实体", - TemplateStr = "using SqlSugar;\r\nusing lo.Abp;\r\nusing lo.Abp.Auditing;\r\nusing lo.Abp.Domain.Entities;\r\nusing Yi.Framework.Core.Data;\r\n\r\nnamespace Yi.Framework.Rbac.Domain.Entities\r\n{\r\n /// \r\n /// 实体\r\n /// \r\n [SugarTable(\"@Model\")]\r\n public class @ModelEntity : Entity\r\n {\r\n@field\r\n }\r\n}\r\n" - }; - entities.Add(entityTemplate); - - - TemplateAggregateRoot getListInputTemplate = new TemplateAggregateRoot() - { - Name = "GetListInput", - BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListInput.cs", - Remarks = "列表查询参数", - TemplateStr = "using Yi.Framework.Ddd;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n /// \r\n /// 查询参数\r\n /// \r\n public class @ModelGetListInput : PagedAllResultRequestDto\r\n {\r\n@field\r\n }\r\n}\r\n" - }; - entities.Add(getListInputTemplate); - - - TemplateAggregateRoot getListOutputDtoTemplate = new TemplateAggregateRoot() - { - Name = "GetListOutputDto", - BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetListOutputDto.cs", - Remarks = "列表返回dto", - TemplateStr = "using lo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetListOutputDto : EntityDto\r\n {\r\n@field\r\n }\r\n}\r\n" - }; - entities.Add(getListOutputDtoTemplate); - - - TemplateAggregateRoot getOutputDtoTemplate = new TemplateAggregateRoot() - { - Name = "GetOutputDto", - BuildPath = "D:\\code\\Dtos\\@Model\\@ModelGetOutputDto.cs", - Remarks = "单返回dto", - TemplateStr = "using lo.Abp.Application.Dtos;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelGetOutputDto : EntityDto\r\n {\r\n@field\r\n }\r\n}\r\n" - }; - entities.Add(getOutputDtoTemplate); - - TemplateAggregateRoot updateInputTemplate = new TemplateAggregateRoot() - { - Name = "UpdateInput", - BuildPath = "D:\\code\\Dtos\\@Model\\@ModelUpdateInput.cs", - Remarks = "更新输入", - TemplateStr = "namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n public class @ModelUpdateInput\r\n {\r\n@field\r\n }\r\n}\r\n" - }; - entities.Add(updateInputTemplate); - - TemplateAggregateRoot createInputTemplate = new TemplateAggregateRoot() - { - Name = "CreateInput", - BuildPath = "D:\\code\\Dtos\\@Model\\@ModelCreateInput.cs", - Remarks = "创建dto", - TemplateStr = "namespace Yi.Framework.Rbac.Application.Contracts.Dtos.@Model\r\n{\r\n /// \r\n /// @Model输入创建对象\r\n /// \r\n public class @ModelCreateInput\r\n {\r\n@field\r\n }\r\n}\r\n" - }; - entities.Add(createInputTemplate); - - - TemplateAggregateRoot iServicesTemplate = new TemplateAggregateRoot() - { - Name = "IServices", - BuildPath = "D:\\code\\IServices\\I@ModelService.cs", - Remarks = "应用服务抽象", - TemplateStr = "using lo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application.Contracts;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Contracts.IServices\r\n{\r\n /// \r\n /// @Model服务抽象\r\n /// \r\n public interface I@ModelService : IYiCrudAppService<@ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInput, @ModelCreateInput, @ModelUpdateInput>\r\n {\r\n\r\n }\r\n}\r\n" - }; - entities.Add(iServicesTemplate); - - - - TemplateAggregateRoot servicesTemplate = new TemplateAggregateRoot() - { - Name = "Service", - BuildPath = "D:\\code\\Services\\@ModelService.cs", - Remarks = "应用服务", - TemplateStr = "using SqlSugar;\r\nusing lo.Abp.Application.Dtos;\r\nusing lo.Abp.Application.Services;\r\nusing Yi.Framework.Ddd.Application;\r\nusing Yi.Framework.Rbac.Application.Contracts.Dtos.@Model;\r\nusing Yi.Framework.Rbac.Application.Contracts.IServices;\r\nusing Yi.Framework.Rbac.Domain.Entities;\r\nusing Yi.Framework.SqlSugarCore.Abstractions;\r\n\r\nnamespace Yi.Framework.Rbac.Application.Services\r\n{\r\n /// \r\n /// @Model服务实现\r\n /// \r\n public class @ModelService : YiCrudAppService<@ModelEntity, @ModelGetOutputDto, @ModelGetListOutputDto, Guid, @ModelGetListInput, @ModelCreateInput, @ModelUpdateInput>,\r\n I@ModelService\r\n {\r\n private ISqlSugarRepository<@ModelEntity, Guid> _repository;\r\n public @ModelService(ISqlSugarRepository<@ModelEntity, Guid> repository) : base(repository)\r\n {\r\n _repository = repository;\r\n }\r\n\r\n /// \r\n /// 多查\r\n /// \r\n /// \r\n /// \r\n public override async Task> GetListAsync(@ModelGetListInput input)\r\n {\r\n RefAsync total = 0;\r\n\r\n var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.@ModelKey), x => x.@ModelKey.Contains(input.@ModelKey!))\r\n .WhereIF(!string.IsNullOrEmpty(input.@ModelName), x => x.@ModelName!.Contains(input.@ModelName!))\r\n .WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)\r\n .ToPageListAsync(input.SkipCount, input.MaxResultCount, total);\r\n return new PagedResultDto<@ModelGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));\r\n }\r\n }\r\n}\r\n" - }; - entities.Add(servicesTemplate); - - TemplateAggregateRoot apiTemplate = new TemplateAggregateRoot() - { - TemplateStr = "import request from '@/utils/request'\r\n\r\n// 分页查询\r\nexport function listData(query) {\r\n return request({\r\n url: '/@model',\r\n method: 'get',\r\n params: query\r\n })\r\n}\r\n\r\n// id查询\r\nexport function getData(id) {\r\n return request({\r\n url: `/@model/${id}`,\r\n method: 'get'\r\n })\r\n}\r\n\r\n// 新增\r\nexport function addData(data) {\r\n return request({\r\n url: '/@model',\r\n method: 'post',\r\n data: data\r\n })\r\n}\r\n\r\n// 修改\r\nexport function updateData(id,data) {\r\n return request({\r\n url: `/@model/${id}`,\r\n method: 'put',\r\n data: data\r\n })\r\n}\r\n\r\n// 删除\r\nexport function delData(ids) {\r\n return request({\r\n url: `/@model`,\r\n method: 'delete',\r\n params:{id:ids}\r\n })\r\n}\r\n", - Name = "api", - BuildPath = "D:\\code\\Api\\@ModelApi.vue", - Remarks = "前端api" - }; - entities.Add(apiTemplate); - - return entities; - } - } -} diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/Yi.Framework.CodeGen.SqlSugarCore.csproj b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/Yi.Framework.CodeGen.SqlSugarCore.csproj deleted file mode 100644 index 00c88c1d..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/Yi.Framework.CodeGen.SqlSugarCore.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - diff --git a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/YiFrameworkCodeGenSqlSugarCoreModule.cs b/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/YiFrameworkCodeGenSqlSugarCoreModule.cs deleted file mode 100644 index 7e47a1d6..00000000 --- a/Yi.Abp.Net8/module/code-gen/Yi.Framework.CodeGen.SqlSugarCore/YiFrameworkCodeGenSqlSugarCoreModule.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Yi.Framework.SqlSugarCore; - -namespace Yi.Framework.CodeGen.SqlSugarCore -{ - [DependsOn(typeof(YiFrameworkSqlSugarCoreModule))] - public class YiFrameworkCodeGenSqlSugarCoreModule:AbpModule - { - - } -} diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/BindInput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/BindInput.cs deleted file mode 100644 index 6468ab49..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/BindInput.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Account; - -public class BindInput -{ - public string JsCode { get; set; } - - public long Phone { get; set; } - - /// - /// 唯一标识码 - /// - public string? Uuid { get; set; } - - /// - /// 验证码 - /// - public string? Code { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/LoginInput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/LoginInput.cs deleted file mode 100644 index 58cc40a0..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/LoginInput.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Account; - -public class LoginInput -{ - /// - /// 微信小程序jscode - /// - public string JsCode { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/LoginOutput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/LoginOutput.cs deleted file mode 100644 index b99624a6..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/LoginOutput.cs +++ /dev/null @@ -1,11 +0,0 @@ -using Yi.Framework.DigitalCollectibles.Domain.Shared.Enums; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Account; - -public class LoginOutput -{ - /// - /// 后端访问token - /// - public string? Token { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/RegisterInput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/RegisterInput.cs deleted file mode 100644 index 88be3592..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Account/RegisterInput.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Account; - -public class RegisterInput -{ - /// - /// 微信小程序code - /// - public string JsCode { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Analyse/DcPointsTopUserDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Analyse/DcPointsTopUserDto.cs deleted file mode 100644 index 225b407c..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Analyse/DcPointsTopUserDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Analyse; - -public class DcPointsTopUserDto -{ - public Guid UserId { get; set; } - public int Points { get; set; } - - public int Order { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Analyse/DcValueTopUserDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Analyse/DcValueTopUserDto.cs deleted file mode 100644 index 46616744..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Analyse/DcValueTopUserDto.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Analyse; - -public class DcValueTopUserDto -{ - public Guid UserId { get; set; } - public decimal Value { get; set; } - - public int Order { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesAccountInfoDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesAccountInfoDto.cs deleted file mode 100644 index 22085518..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesAccountInfoDto.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; - -public class CollectiblesAccountInfoDto -{ - public decimal TotalValue { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesDto.cs deleted file mode 100644 index 16d0c26b..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesDto.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; - -public class CollectiblesDto : EntityDto -{ - /// - /// 藏品编号 - /// - public string Code { get; set; } - - /// - /// 藏品名称 - /// - public string Name { get; set; } - - /// - /// 藏品描述 - /// - public string? Describe { get; set; } - - /// - /// 价值数 - /// - public decimal ValueNumber { get; set; } - - /// - /// 藏品地址 - /// - public string Url { get; set; } - - /// - /// 稀有度 - /// - public RarityEnum Rarity{ get; set; } - - /// - /// 总共出现次数 - /// - public int FindTotal { get; set; } - - /// - /// 排序 - /// - public int OrderNum { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesUserGetInput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesUserGetInput.cs deleted file mode 100644 index f787108c..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesUserGetInput.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; - -public class CollectiblesUserGetInput:PagedAllResultRequestDto -{ - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesUserGetOutputDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesUserGetOutputDto.cs deleted file mode 100644 index c733ec76..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Collectibles/CollectiblesUserGetOutputDto.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Volo.Abp.Application.Dtos; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; - -public class CollectiblesUserGetOutputDto : EntityDto -{ - /// - /// 藏品 - /// - public CollectiblesDto Collectibles{ get; set; } - - /// - /// 数量 - /// - public int Number { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/InvitationCode/InvitationCodeGetOutputDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/InvitationCode/InvitationCodeGetOutputDto.cs deleted file mode 100644 index ead2e169..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/InvitationCode/InvitationCodeGetOutputDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.InvitationCode; - -public class InvitationCodeGetOutputDto -{ - /// - /// 是否填写了邀请码(是否被邀请) - /// - public bool IsInvited { get; set; } - - - /// - /// 积分-邀请数量 - /// - public int PointsNumber { get; set; } - - /// - /// 邀请码 - /// - public string InvitationCode { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/MarketGetListInput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/MarketGetListInput.cs deleted file mode 100644 index c16ad714..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/MarketGetListInput.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.Ddd.Application.Contracts; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market; - -public class MarketGetListInput:PagedAllResultRequestDto -{ - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/MarketGetListOutputDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/MarketGetListOutputDto.cs deleted file mode 100644 index 92745847..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/MarketGetListOutputDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market; - -public class MarketGetListOutputDto:EntityDto -{ - /// - /// 上架时间 - /// - public DateTime CreationTime{ get; set; } - /// - /// 出售者用户id - /// - public Guid SellUserId { get; set; } - /// - /// 出售数量 - /// - public int SellNumber{ get; set; } - - /// - /// 出售单价 - /// - public decimal UnitPrice{ get; set; } - /// - /// 藏品 - /// - public CollectiblesDto Collectibles{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/PurchaseGoodsDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/PurchaseGoodsDto.cs deleted file mode 100644 index 26b9da54..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/PurchaseGoodsDto.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market; - -public class PurchaseGoodsDto -{ - public Guid MarketGoodsId{ get; set; } - - public int Number{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/ShelvedGoodsDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/ShelvedGoodsDto.cs deleted file mode 100644 index ac78037b..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Market/ShelvedGoodsDto.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market; - -public class ShelvedGoodsDto -{ - - public Guid CollectiblesId { get; set; } - public int Number { get; set; } - - public decimal Money { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/MiningPool/MiningPoolGetOutput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/MiningPool/MiningPoolGetOutput.cs deleted file mode 100644 index 6fe63700..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/MiningPool/MiningPoolGetOutput.cs +++ /dev/null @@ -1,44 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.MiningPool; - -public class MiningPoolGetOutput -{ - /// - /// 普通藏品剩余数量 - /// - public int I0_OrdinaryNumber { get; set; } - - /// - /// 高级藏品剩余数量 - /// - public int I1_SeniorNumber { get; set; } - - /// - /// 稀有藏品剩余数量 - /// - public int I2_RareNumber { get; set; } - - /// - /// 珍品藏品剩余数量 - /// - public int I3_GemNumber { get; set; } - - /// - /// 传说藏品剩余数量 - /// - public int I4_LegendNumber { get; set; } - - /// - /// 开始时间 - /// - public DateTime StartTime{ get; set; } - - /// - /// 结束时间 - /// - public DateTime EndTime{ get; set; } - - /// - /// 总共剩余藏品数量 - /// - public int TotalNumber => I0_OrdinaryNumber + I1_SeniorNumber + I2_RareNumber + I3_GemNumber + I4_LegendNumber; -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/MiningPool/MiningResultOutput.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/MiningPool/MiningResultOutput.cs deleted file mode 100644 index 14bc4cd8..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/MiningPool/MiningResultOutput.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Enums; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.MiningPool; - -public class MiningResultOutput -{ - public CollectiblesDto? Collectibles{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Records/MarketRecordDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Records/MarketRecordDto.cs deleted file mode 100644 index 4ce86b85..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Records/MarketRecordDto.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Records; - -public class MarketRecordDto:EntityDto -{ - /// - /// 当前这条数据是否为购买者,否则为出售者 - /// - public bool IsBuyer { get; set; } - - public DateTime CreationTime { get; set; } - /// - /// 出售数量 - /// - public int SellNumber{ get; set; } - - /// - /// 出售者用户id - /// - public Guid SellUserId { get; set; } - - /// - /// 购买者用户id - /// - public Guid BuyId { get; set; } - - /// - /// 出售单价 - /// - public decimal UnitPrice{ get; set; } - - /// - /// 实际到手价格(扣除税收) - /// - public decimal RealTotalPrice{ get; set; } - /// - /// 交易的藏品 - /// - public CollectiblesDto Collectibles { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Records/MiningPoolRecordDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Records/MiningPoolRecordDto.cs deleted file mode 100644 index 4e90e84e..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Dtos/Records/MiningPoolRecordDto.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Volo.Abp.Application.Dtos; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Records; - -public class MiningPoolRecordDto:EntityDto -{ - /// - /// 用户id - /// - public Guid UserId { get; set; } - - public DateTime CreationTime { get; set; } - - /// - /// 挖到的藏品 - /// - public CollectiblesDto Collectibles { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/IServices/IPointAnalyseService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/IServices/IPointAnalyseService.cs deleted file mode 100644 index d7a1feb2..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/IServices/IPointAnalyseService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Dtos; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Analyse; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.IServices; - -public interface IPointAnalyseService -{ - /// - /// 积分排行榜 - /// - /// - // [HttpGet("analyse/dc-user/points-top/{userId?}")] - Task> GetValueTopAsync([FromQuery] PagedResultRequestDto input, - [FromRoute] Guid? userId); -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/IServices/IValueAnalyseService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/IServices/IValueAnalyseService.cs deleted file mode 100644 index 5ee848e4..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/IServices/IValueAnalyseService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Dtos; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Analyse; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts.IServices; - -public interface IValueAnalyseService -{ - /// - /// 价值排行榜 - /// - /// - // [HttpGet("analyse/dc-user/value-top/{userId?}")] - Task> GetValueTopAsync([FromQuery] PagedResultRequestDto input, - [FromRoute] Guid? userId); -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Yi.Framework.DigitalCollectibles.Application.Contracts.csproj b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Yi.Framework.DigitalCollectibles.Application.Contracts.csproj deleted file mode 100644 index 5d20f5fd..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/Yi.Framework.DigitalCollectibles.Application.Contracts.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/YiFrameworkDigitalCollectiblesApplicationContractsModule.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/YiFrameworkDigitalCollectiblesApplicationContractsModule.cs deleted file mode 100644 index ccacaecc..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application.Contracts/YiFrameworkDigitalCollectiblesApplicationContractsModule.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Yi.Framework.DigitalCollectibles.Domain.Shared; -using Yi.Framework.Ddd.Application.Contracts; -using Yi.Framework.Rbac.Application.Contracts; - -namespace Yi.Framework.DigitalCollectibles.Application.Contracts -{ - [DependsOn( - typeof(YiFrameworkDigitalCollectiblesDomainSharedModule), - - typeof(YiFrameworkRbacApplicationContractsModule), - typeof(YiFrameworkDddApplicationContractsModule))] - public class YiFrameworkDigitalCollectiblesApplicationContractsModule:AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Account/WeChatMiniProgramAccountService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Account/WeChatMiniProgramAccountService.cs deleted file mode 100644 index b7d610eb..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Account/WeChatMiniProgramAccountService.cs +++ /dev/null @@ -1,197 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.Caching; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Users; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Account; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Caches; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Enums; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; -using Yi.Framework.Rbac.Application.Contracts.Dtos.Account; -using Yi.Framework.Rbac.Application.Contracts.IServices; -using Yi.Framework.Rbac.Domain.Shared.Enums; -using Yi.Framework.WeChat.MiniProgram; -using Yi.Framework.WeChat.MiniProgram.HttpModels; - -namespace Yi.Framework.DigitalCollectibles.Application.Services.Account; - -/// -/// 微信小程序账户应用服务 -/// -public class WeChatMiniProgramAccountService : ApplicationService -{ - private readonly IWeChatMiniProgramManager _weChatMiniProgramManager; - private readonly IAuthService _authService; - private readonly IAccountService _accountService; - private readonly ILocalEventBus _localEventBus; - private readonly IDistributedCache _noticeCache; - - public WeChatMiniProgramAccountService(IWeChatMiniProgramManager weChatMiniProgramManager, IAuthService authService, - IAccountService accountService, ILocalEventBus localEventBus, IDistributedCache noticeCache) - { - _weChatMiniProgramManager = weChatMiniProgramManager; - _authService = authService; - _accountService = accountService; - _localEventBus = localEventBus; - _noticeCache = noticeCache; - } - - /// - /// 设置用户一次性订阅状态 - /// - [HttpPut("wechat/mini-program/notice/subscribe")] - [Authorize] - public async Task PutSubscribeNoticeStateAsync() - { - var userId = CurrentUser.GetId(); - await _noticeCache.SetAsync($"MiniProgram:notice:{userId}", new WeChatNoticeCacheItem(true)); - } - - [HttpGet("wechat/mini-program/notice")] - [Authorize] - public async Task GetSubscribeNoticeStateAsync() - { - var userId = CurrentUser.GetId(); - var notice = await _noticeCache.GetAsync($"MiniProgram:notice:{userId}"); - if (notice is not null) - { - return true; - } - - return false; - } - - - /// - /// 使用小程序jsCode登录意社区账号 - /// - /// - [HttpPost("wechat/mini-program/account/login")] - public async Task PostLoginAsync(LoginInput intput) - { - var output = new LoginOutput(); - //根据code去获取wxid - //判断wxid中是否有对应的userid关系 - //果然有,直接根据userid返回该用户token - //如果没有,返回结果即可 - var openId = (await _weChatMiniProgramManager.Code2SessionAsync(new Code2SessionInput(intput.JsCode))) - .openid; - - var authInfo = await _authService.TryGetAuthInfoAsync(openId, AuthTypeConst.WeChatMiniProgram); - if (authInfo is null) - { - throw new UserFriendlyException("该小程序没有绑定任何账号", "2000", "Auth未找到对应关系"); - } - - //根据用户id获取到用户信息 - var result = await _accountService.PostLoginAsync(authInfo.UserId); - output.Token = result.Token; - - return output; - } - - - /// - /// 将小程序第三方授权绑定给意社区账号 - /// - /// - /// - [HttpPost("wechat/mini-program/account/bind")] - // [Authorize] - public async Task PostBindAsync(BindInput input) - { - //验证手机号 - await _accountService.ValidationPhoneCaptchaAsync(ValidationPhoneTypeEnum.Bind, input.Phone, input.Code); - //校验手机号与验证码 - //根据手机号查询用户信息 - //根据code去获取wxid - //将wxid和用户user绑定 - var userInfo = await _accountService.GetAsync(null, input.Phone); - if (userInfo is null) - { - throw new UserFriendlyException("该手机号未被注册,无法绑定微信小程序"); - } - - //验证手机号的验证码 - var openId = (await _weChatMiniProgramManager.Code2SessionAsync(new Code2SessionInput(input.JsCode))).openid; - - //是否已经授权过绑定过auth - bool isAuthed = true; - //如果openId没有绑定过,代表第一次进入,否则就是临时账号进行绑定 - var authInfo = await _authService.TryGetAuthInfoAsync(openId, AuthTypeConst.WeChatMiniProgram); - //从来没绑定过 - if (authInfo is null) - { - isAuthed = false; - } - - //账号绑定,不管什么情况,都将jscode与phone用户建立关系即可 - await PostBindToAuthAsync(userInfo.User.Id, openId, userInfo.User.UserName); - - //发送账号绑定的事件,不同领域对账号数据进行迁移 - //bbs:钱钱 (累加),禁用临时账号(修改) - //dc: 价值、积分 (累加) - - //只有之前授权绑定过,才需要将临时账号进行账号数据转移, - if (isAuthed) - { - await _localEventBus.PublishAsync(new BindAccountEto - { - NewUserId = userInfo.User.Id, - OldUserId = authInfo.UserId - }, false); - } - } - - private async Task PostBindToAuthAsync(Guid userId, string openId, string? name = null) - { - await _authService.CreateAsync(new AuthCreateOrUpdateInputDto - { - UserId = userId, - OpenId = openId, - Name = name ?? "未知", - AuthType = AuthTypeConst.WeChatMiniProgram - }); - } - - /// - /// 使用小程序去注册意社区账号 - /// - /// - [HttpPost("wechat/mini-program/account/register")] - public async Task PostRegisterAsync(RegisterInput input) - { - //先校验code,openId - var openId = (await _weChatMiniProgramManager.Code2SessionAsync(new Code2SessionInput(input.JsCode))).openid; - - //走普通注册流程 - //同时再加一个小程序绑定即可 - var userName = GenerateRandomString(6); - await _accountService.PostTempRegisterAsync(new RegisterDto - { - UserName = $"ls_{userName}", - Password = GenerateRandomString(20), - Nick = $"临时账号-{userName}" - }); - var userInfo = await _accountService.GetAsync($"ls_{userName}", null); - - await PostBindToAuthAsync(userInfo.User.Id, openId, userInfo.User.UserName); - } - - private string GenerateRandomString(int length) - { - const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - Random random = new Random(); - char[] stringChars = new char[length]; - - for (int i = 0; i < length; i++) - { - stringChars[i] = chars[random.Next(chars.Length)]; - } - - return new string(stringChars); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Analyses/PointAnalyseService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Analyses/PointAnalyseService.cs deleted file mode 100644 index 246024e0..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Analyses/PointAnalyseService.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Analyse; -using Yi.Framework.DigitalCollectibles.Application.Contracts.IServices; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - - -namespace Yi.Framework.DigitalCollectibles.Application.Services.Analyses; - -/// -/// 用户积分分析 -/// -public class PointAnalyseService: ApplicationService,IPointAnalyseService -{ - - private readonly ISqlSugarRepository _repository; - - public PointAnalyseService(ISqlSugarRepository repository) - { - _repository = repository; - } - - /// - /// 积分排行榜 - /// - /// - // [HttpGet("analyse/dc-user/points-top/{userId?}")] - [RemoteService(isEnabled:false)] - public async Task> GetValueTopAsync([FromQuery] PagedResultRequestDto input, - [FromRoute] Guid? userId) - { - - var pageIndex = input.SkipCount; - RefAsync total = 0; - var output = await _repository._DbQueryable - .OrderByDescending(x=>x.PointsNumber) - .Select(x => - new DcPointsTopUserDto{ - UserId = x.UserId, - Points = x.PointsNumber, - Order=SqlFunc.RowNumber(SqlFunc.Desc(x.PointsNumber)) - }) - .ToPageListAsync(pageIndex, input.MaxResultCount, total); - return new PagedResultDto - { - Items = output, - TotalCount = total - }; - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Analyses/ValueAnalyseService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Analyses/ValueAnalyseService.cs deleted file mode 100644 index 5a3ab8d1..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Analyses/ValueAnalyseService.cs +++ /dev/null @@ -1,48 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Analyse; -using Yi.Framework.DigitalCollectibles.Application.Contracts.IServices; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Managers; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Application.Services.Analyses; - -public class ValueAnalyseService: ApplicationService,IValueAnalyseService -{ - - private readonly CollectiblesManager _manager; - - public ValueAnalyseService( CollectiblesManager manager) - { - _manager = manager; - } - - /// - /// 价值排行榜 - /// - /// - // [HttpGet("analyse/dc-user/value-top/{userId?}")] - [RemoteService(isEnabled:false)] - public async Task> GetValueTopAsync([FromQuery] PagedResultRequestDto input, - [FromRoute] Guid? userId) - { - //每个人的价值需要进行计算才能获取,这里计算时间较长,放入缓存,绝对过期 - var allValue= await _manager.GetAllAccountValueByCacheAsync(); - var output = allValue.OrderByDescending(x => x.Value).Select((x, index) => new DcValueTopUserDto - { - UserId = x.UserId, - Value = x.Value, - Order = index + 1 - }).Skip((input.SkipCount - 1) * input.MaxResultCount) // 跳过前面(当前页码 - 1)* 每页数量条记录 - .Take(input.MaxResultCount).ToList(); - return new PagedResultDto - { - Items = output, - TotalCount = allValue.Count - }; - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/CollectiblesService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/CollectiblesService.cs deleted file mode 100644 index 3be19b6a..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/CollectiblesService.cs +++ /dev/null @@ -1,100 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Managers; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Application.Services; - -/// -/// 藏品应用服务 -/// -public class CollectiblesService : ApplicationService -{ - private readonly ISqlSugarRepository _collectiblesUserStoreRepository; - private readonly CollectiblesManager _collectiblesManager; - - public CollectiblesService(ISqlSugarRepository collectiblesUserStoreRepository, - CollectiblesManager collectiblesManager) - { - _collectiblesUserStoreRepository = collectiblesUserStoreRepository; - _collectiblesManager = collectiblesManager; - } - - public bool GetEnable() - { - return LazyServiceProvider.LazyGetRequiredService().GetValue("IsEnableCollectibles"); - } - - public bool GetEnable2() - { - return LazyServiceProvider.LazyGetRequiredService().GetValue("IsEnableCollectibles2"); - } - - /// - /// 获取该用户的信息 - /// - [HttpGet("collectibles/account")] - [Authorize] - public async Task GetAccountInfoAsync() - { - var userId = CurrentUser.GetId(); - var value = await _collectiblesManager.GetAccountValueAsync(userId); - return new CollectiblesAccountInfoDto - { - TotalValue = value - }; - } - - /// - /// 获取当前用户的藏品 - /// - /// - /// - /// - [HttpGet("collectibles/user")] - [Authorize] - public async Task> GetForAccountUserAsync( - CollectiblesUserGetInput input) - { - var userId = CurrentUser.GetId(); - RefAsync total = 0; - var output = await _collectiblesUserStoreRepository._DbQueryable - .Where(x => x.UserId == userId) - .WhereIF( - input.StartTime is not null && input.EndTime is not null, - u => u.CreationTime >= input.StartTime && u.CreationTime <= input.EndTime) - .LeftJoin((u, c) => u.CollectiblesId == c.Id) - .OrderBy((u, c) => c.CreationTime) - .GroupBy((u, c) => u.CollectiblesId) - .Select((u, c) => - new CollectiblesUserGetOutputDto - { - Id = c.Id, - Collectibles = new CollectiblesDto - { - Id = c.Id, - Code = c.Code, - Name = c.Name, - Describe = c.Describe, - ValueNumber = c.ValueNumber, - Url = c.Url, - Rarity = c.Rarity, - FindTotal = c.FindTotal, - OrderNum = c.OrderNum - }, - Number = SqlFunc.AggregateCount(u.CollectiblesId) - }) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - return new PagedResultDto(total, output); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/InvitationCodeService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/InvitationCodeService.cs deleted file mode 100644 index f76c927b..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/InvitationCodeService.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.InvitationCode; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Managers; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Application.Services; - -/// -/// 邀请码应用服务 -/// -public class InvitationCodeService : ApplicationService -{ - private readonly InvitationCodeManager _invitationCodeManager; - - public InvitationCodeService(InvitationCodeManager invitationCodeManager) - { - _invitationCodeManager = invitationCodeManager; - } - - /// - /// 查询当前登录用户的邀请码数据 - /// - /// - [Authorize] - public async Task GetAsync() - { - var userId = CurrentUser.GetId(); - var entity = await _invitationCodeManager.TryGetOrAddAsync(userId); - var output = new InvitationCodeGetOutputDto - { - IsInvited = entity.IsInvited, - PointsNumber = entity.PointsNumber, - InvitationCode = entity.InvitationCode - }; - return output; - } - - /// - /// 当前用户填写邀请码 - /// - /// - /// - [Authorize] - [HttpPost("invitation-code/{code}")] - public async Task SetAsync([FromRoute] string code) - { - var userId = CurrentUser.GetId(); - await _invitationCodeManager.SetAsync(userId, code); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/MarketService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/MarketService.cs deleted file mode 100644 index 4eb3a425..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/MarketService.cs +++ /dev/null @@ -1,95 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Market; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Managers; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Application.Services; - -/// -/// 交易市场应用服务 -/// -public class MarketService : ApplicationService -{ - private readonly ISqlSugarRepository _marketGoodsRepository; - - private readonly MarketManager _marketManager; - - public MarketService(ISqlSugarRepository marketGoodsRepository, - MarketManager marketManager) - { - _marketGoodsRepository = marketGoodsRepository; - _marketManager = marketManager; - } - - /// - /// 交易市场查询 - /// - /// - /// - public async Task> GetListAsync(MarketGetListInput input) - { - RefAsync total = 0; - var output = await _marketGoodsRepository._DbQueryable.WhereIF( - input.StartTime is not null && input.EndTime is not null, - m => m.CreationTime >= input.StartTime && m.CreationTime <= input.EndTime) - - .LeftJoin((m, c) => m.CollectiblesId == c.Id) - .OrderByDescending((m, c) => m.CreationTime) - .Select((m, c) => - - new MarketGetListOutputDto - { - Id = m.Id, - CreationTime = m.CreationTime, - SellUserId = m.SellUserId, - SellNumber = m.SellNumber, - UnitPrice=m.UnitPrice, - Collectibles = new CollectiblesDto - { - Id = c.Id, - Code = c.Code, - Name = c.Name, - Describe = c.Describe, - ValueNumber = c.ValueNumber, - Url = c.Url, - Rarity =c.Rarity, - FindTotal = c.FindTotal, - OrderNum = c.OrderNum - } - } - ) - - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - return new PagedResultDto(total, output); - } - - - /// - /// 上架商品 - /// - [HttpPost("market/shelved")] - [Authorize] - public async Task ShelvedGoodsAsync(ShelvedGoodsDto input) - { - await _marketManager.ShelvedGoodsAsync(CurrentUser.GetId(), input.CollectiblesId, input.Number, input.Money); - } - - /// - /// 购买商品 - /// - [HttpPut("market/purchase")] - [Authorize] - public async Task PurchaseGoodsAsync(PurchaseGoodsDto input) - { - await _marketManager.PurchaseGoodsAsync(CurrentUser.GetId(),input.MarketGoodsId, input.Number); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/MiningPoolService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/MiningPoolService.cs deleted file mode 100644 index 39b3e5dc..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/MiningPoolService.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Mapster; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.MiningPool; -using Yi.Framework.DigitalCollectibles.Domain.Managers; - -namespace Yi.Framework.DigitalCollectibles.Application.Services; - -/// -/// 矿池应用服务 -/// -public class MiningPoolService : ApplicationService -{ - private readonly MiningPoolManager _manager; - - public MiningPoolService(MiningPoolManager manager) - { - _manager = manager; - } - - /// - /// 内测-白嫖-获取自动挖矿卡 - /// - [HttpPost("mining-pool/on-hook")] - [Authorize] - public async Task GetOnHookAsync() - { - await _manager.GetOnHookAsync(CurrentUser.GetId()); - } - - /// - /// 获取矿池状态 - /// - /// - [HttpGet("mining-pool")] - public async Task GetMiningPoolContentAsync() - { - var content = await _manager.GetMiningPoolContentAsync(); - var output = content.Adapt(); - return output; - } - - - /// - /// 用户手动挖矿 - /// - /// - [HttpPost("mining-pool/mining")] - [Authorize] - public async Task MiningAsync() - { - var userId = CurrentUser.GetId(); - var result = await _manager.MiningAsync(userId); - var output = result.Adapt(); - return output; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Record/CollectiblesRecordService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Record/CollectiblesRecordService.cs deleted file mode 100644 index ea336439..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Record/CollectiblesRecordService.cs +++ /dev/null @@ -1,118 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using SqlSugar; -using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; -using Volo.Abp.Users; -using Yi.Framework.Ddd.Application.Contracts; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Collectibles; -using Yi.Framework.DigitalCollectibles.Application.Contracts.Dtos.Records; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Entities.Record; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Application.Services.Record; - -public class CollectiblesRecordService : ApplicationService -{ - private readonly ISqlSugarRepository _miningPoolRecordRepository; - private readonly ISqlSugarRepository _marketRecordRepository; - public CollectiblesRecordService(ISqlSugarRepository miningPoolRecordRepository, ISqlSugarRepository marketRecordRepository) - { - _miningPoolRecordRepository = miningPoolRecordRepository; - _marketRecordRepository = marketRecordRepository; - } - - /// - /// 获取当前用户的挖矿记录 - /// - /// - /// - [Authorize] - public async Task> GetMiningPoolAsync(PagedAllResultRequestDto input) - { - RefAsync total = 0; - var userId = CurrentUser.GetId(); - var output = await _miningPoolRecordRepository._DbQueryable.WhereIF(input.StartTime is not null && input.EndTime is not null, - x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) - .Where(x => x.UserId == userId) - .LeftJoin((x, c) => x.CollectiblesId==c.Id) - .Select((x, c) => - new MiningPoolRecordDto - { - Id = x.Id, - CreationTime = x.CreationTime, - Collectibles = new CollectiblesDto - { - Id = c.Id, - Code = c.Code, - Name = c.Name, - Describe = c.Describe, - ValueNumber = c.ValueNumber, - Url = c.Url, - Rarity = c.Rarity, - FindTotal = c.FindTotal, - OrderNum = c.OrderNum - } - - } - ) - .OrderByDescending(x => x.CreationTime) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - return new PagedResultDto(total,output); - } - - /// - /// 获取当前用户的交易记录 - /// - /// - /// - [Authorize] - public async Task> GetMarketAsync(PagedAllResultRequestDto input) - { - RefAsync total = 0; - var userId = CurrentUser.GetId(); - var output = await _marketRecordRepository._DbQueryable.WhereIF(input.StartTime is not null && input.EndTime is not null, - x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime) - - //交易:是购买和出售,都需要展示 - .Where(x => x.SellUserId == userId||x.BuyId ==userId) - - .LeftJoin((x, c) => x.CollectiblesId==c.Id) - .Select((x, c) => - new MarketRecordDto - { - Id = x.Id, - CreationTime=x.CreationTime, - SellUserId = x.SellUserId, - SellNumber = x.SellNumber, - RealTotalPrice=x.RealTotalPrice, - BuyId = x.BuyId, - UnitPrice=x.UnitPrice, - Collectibles = new CollectiblesDto() - { - Id = c.Id, - Code = c.Code, - Name = c.Name, - Describe = c.Describe, - ValueNumber = c.ValueNumber, - Url = c.Url, - Rarity = c.Rarity, - FindTotal = c.FindTotal, - OrderNum = c.OrderNum - }, - } - ) - .OrderByDescending(x => x.CreationTime) - .ToPageListAsync(input.SkipCount, input.MaxResultCount, total); - - foreach (var dto in output) - { - dto.IsBuyer = dto.BuyId == userId; - } - - - return new PagedResultDto(total,output); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Tool/CollectiblesToolService.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Tool/CollectiblesToolService.cs deleted file mode 100644 index ce65a1c1..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Services/Tool/CollectiblesToolService.cs +++ /dev/null @@ -1,151 +0,0 @@ -using System.IO.Compression; -using FreeRedis; -using Volo.Abp.Application.Services; -using Volo.Abp.Caching; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Entities.Record; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Application.Services.Tool; - -public class CollectiblesToolService : ApplicationService -{ - private ISqlSugarRepository _repository; - private ISqlSugarRepository _recordRepository; - - private IRedisClient RedisClient => LazyServiceProvider.LazyGetRequiredService(); - - public CollectiblesToolService(ISqlSugarRepository repository, - ISqlSugarRepository recordRepository) - { - _repository = repository; - _recordRepository = recordRepository; - } - - public async Task DeleteInitAsync() - { - var directoryPath = Path.Combine("wwwroot", "dc", "data"); - var dataPath = Path.Combine("wwwroot", "dc", "data", "data.zip"); - if (!Directory.Exists(directoryPath)) - { - Directory.CreateDirectory(directoryPath); - } - - if (!File.Exists(dataPath)) - { - throw new UserFriendlyException($"{dataPath}路径不存在数据"); - } - - ZipFile.ExtractToDirectory(dataPath, directoryPath, true); // true 表示覆盖已有文件 - - - var txtPath = Path.Combine("wwwroot", "dc", "data", "data.txt"); - if (!File.Exists(txtPath)) - { - throw new UserFriendlyException($"{txtPath}路径不存在文本"); - } - - var lines = await File.ReadAllLinesAsync(txtPath); - var errData = new List(); - //自动开启事务 - List entities = new List(); - for (int i = 0; i < lines.Length; i++) - { - var line = lines[i]; - if (string.IsNullOrEmpty(line)) - { - continue; - } - - var items = line.Split(",").ToList(); - - - if (items.Count != 6) - { - errData.Add($"{i}行数据存,数据不对,只能6个数据"); - } - - var fileName = items[0]; - var code = Path.GetFileNameWithoutExtension(fileName); - var name = items[1]; - var value = decimal.Parse(items[2]); - var url = $"https://ccnetcore.com/prod-api/wwwroot/dc/data/{fileName}"; - var rarity = int.Parse(items[3]); - var des = items[4]; - var find = int.Parse(items[5]); - - var entity = new CollectiblesAggregateRoot - { - Code = code, - Name = name, - Describe = des, - ValueNumber = value, - Url = url, - Rarity = (RarityEnum)Enum.ToObject(typeof(RarityEnum), rarity), - FindTotal = find, - OrderNum = 0 - }; - entities.Add(entity); - - if (!File.Exists(Path.Combine(directoryPath, fileName))) - { - errData.Add($"文件不存在:{Path.Combine(directoryPath, fileName)}"); - } - } - - if (errData.Any()) - { - return new { ok = false, errData }; - } - - var allCode = await _repository._DbQueryable.Select(x => x.Code).ToListAsync(); - - var existCodes = allCode.Intersect(entities.Select(x => x.Code)).ToList(); - if (existCodes.Count > 0) - { - return new { ok = false, existCodes }; - } - - - await _repository.InsertRangeAsync(entities); - return new { ok = true, entities }; - } - - - /// - /// 跑马灯内容 - /// - /// - public async Task> GetNoticeAsync() - { - //获取最新的3条挖矿记录,高级 - var record = await _recordRepository._DbQueryable - .LeftJoin((x, c) => x.CollectiblesId == c.Id) - .Where((x,c)=>c.Rarity>=RarityEnum.Senior) - .OrderByDescending((x, c) => x.CreationTime) - .Select((x, c) => new - { - c.Name, - c.ValueNumber, - c.Rarity - }) - .ToPageListAsync(1, 3); - - var output = new List(); - - var firstNoticeOrNull = await RedisClient.GetAsync("Yi:Notice"); - if (firstNoticeOrNull is not null) - { - output.Add(firstNoticeOrNull); - } - - foreach (var item in record) - { - output.Add($"恭喜神秘用户,挖到【{item.Rarity.GetRarityName()}-{item.Name}】,价值【{(int)(item.ValueNumber)}】"); - } - - - return output; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/WeChatMiniProgramNoticeEventHandler.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/WeChatMiniProgramNoticeEventHandler.cs deleted file mode 100644 index 00c792e7..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/WeChatMiniProgramNoticeEventHandler.cs +++ /dev/null @@ -1,80 +0,0 @@ -using Microsoft.Extensions.Logging; -using Volo.Abp.Caching; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Caches; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; -using Yi.Framework.Rbac.Application.Contracts.IServices; -using Yi.Framework.WeChat.MiniProgram; -using Yi.Framework.WeChat.MiniProgram.HttpModels; - -namespace Yi.Framework.DigitalCollectibles.Domain.Managers; - -public class WeChatMiniProgramNoticeEventHandler : ILocalEventHandler, ITransientDependency -{ - private readonly IWeChatMiniProgramManager _weChatMiniProgramManager; - private readonly IAuthService _authService; - private readonly ILogger _logger; - private readonly IDistributedCache _noticeCache; - public WeChatMiniProgramNoticeEventHandler(IWeChatMiniProgramManager weChatMiniProgramManager, - IAuthService authService, ILogger logger, IDistributedCache noticeCache) - { - _weChatMiniProgramManager = weChatMiniProgramManager; - _authService = authService; - _logger = logger; - _noticeCache = noticeCache; - } - - public async Task HandleEventAsync(WeChatMiniProgramNoticeEto eventData) - { - //需要判断该用户是否已经订阅 - var noticeCache= await _noticeCache.GetAsync($"MiniProgram:notice:{eventData.UserId}"); - //判断用户是否点击了一次性消息订阅 - if (noticeCache is not null) - { - var authInfo = await _authService.TryGetAuthInfoAsync(null, AuthTypeConst.WeChatMiniProgram, eventData.UserId); - await SendAsync(authInfo.OpenId, eventData.Title); - //发送完成之后,删除缓存 - await _noticeCache.RemoveAsync($"MiniProgram:notice:{eventData.UserId}"); - } - - } - - /// - /// 像用户发送微信消息 - /// - /// - public async Task SendAsync(string openId, string title) - { - try - { - //成功挖到矿,可以发消息给用户了 - await _weChatMiniProgramManager.SendSubscribeNoticeAsync(new SubscribeNoticeInput - { - touser = openId, - page = "pages/digitalCollectibles/digitalCollectibles", - data = new Dictionary() - { - //活动名称 - { "thing9", new keyValueItem("恭喜挖到新的数字藏品") }, - - //奖品名称 - { "thing1", new keyValueItem(title) }, - - //中奖时间 - { "date5", new keyValueItem(DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")) }, - - //温馨提醒 - { "thing4", new keyValueItem("点击前往小程序,可在仓库或者记录中查看") }, - } - }); - } - catch (Exception e) - { - _logger.LogError($"微信通知提醒失败,错误信息:{e.Message},堆栈:{e.InnerException}"); - } - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Yi.Framework.DigitalCollectibles.Application.csproj b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Yi.Framework.DigitalCollectibles.Application.csproj deleted file mode 100644 index a6aeafc1..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/Yi.Framework.DigitalCollectibles.Application.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/YiFrameworkDigitalCollectiblesApplicationModule.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/YiFrameworkDigitalCollectiblesApplicationModule.cs deleted file mode 100644 index 86847911..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Application/YiFrameworkDigitalCollectiblesApplicationModule.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Yi.Framework.DigitalCollectibles.Application.Contracts; -using Yi.Framework.DigitalCollectibles.Domain; -using Yi.Framework.Ddd.Application; - - -namespace Yi.Framework.DigitalCollectibles.Application -{ - [DependsOn( - typeof(YiFrameworkDigitalCollectiblesApplicationContractsModule), - typeof(YiFrameworkDigitalCollectiblesDomainModule), - - typeof(YiFrameworkDddApplicationModule) - )] - public class YiFrameworkDigitalCollectiblesApplicationModule : AbpModule - { - } -} diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Attributes/ProbabilityAttribute.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Attributes/ProbabilityAttribute.cs deleted file mode 100644 index f07df658..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Attributes/ProbabilityAttribute.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Reflection; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Attributes; - - -public class ProbabilityAttribute : Attribute -{ - /// - /// 概率 - /// - public double Probability { get; set; } - - /// - /// 默认价值 - /// - public double DefaultValue { get; set; } - - public ProbabilityAttribute(double probability,double defaultValue) - { - this.Probability = probability; - this.DefaultValue = defaultValue; - } -} - diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Caches/CollectiblesValueCacheItem.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Caches/CollectiblesValueCacheItem.cs deleted file mode 100644 index 62c44e73..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Caches/CollectiblesValueCacheItem.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Caches; - -public class CollectiblesValueCacheItem -{ - public Guid UserId { get; set; } - public decimal Value { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Caches/WeChatNoticeCacheItem.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Caches/WeChatNoticeCacheItem.cs deleted file mode 100644 index 445e89a4..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Caches/WeChatNoticeCacheItem.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Caches; - -public class WeChatNoticeCacheItem -{ - public WeChatNoticeCacheItem(bool isSubscribe) - { - IsSubscribe = isSubscribe; - } - - public bool IsSubscribe { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Consts/AuthTypeConst.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Consts/AuthTypeConst.cs deleted file mode 100644 index b3d1e1ea..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Consts/AuthTypeConst.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -public class AuthTypeConst -{ - public const string WeChatMiniProgram = "WeChatMiniProgram"; -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Consts/MiningCacheConst.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Consts/MiningCacheConst.cs deleted file mode 100644 index f1c633ef..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Consts/MiningCacheConst.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -public class MiningCacheConst -{ - /// - /// 矿池 - /// - public const string MiningPoolContent = "MiningPool"; - - public const string UserMiningLimit = "UserMiningLimit"; - - public const string UserMiningLimitLock = "UserMiningLimitLock"; -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/LoginResultEnum.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/LoginResultEnum.cs deleted file mode 100644 index 8fe35956..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/LoginResultEnum.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Enums; - -public enum LoginResultEnum -{ - Error, - Success -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/MiningResultEnum.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/MiningResultEnum.cs deleted file mode 100644 index 2a94fd35..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/MiningResultEnum.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Enums; - -public enum MiningResultEnum -{ - Success, - Empty, - PoolIsEmpty -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/RarityEnum.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/RarityEnum.cs deleted file mode 100644 index 5738580d..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Enums/RarityEnum.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using System.Reflection; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Attributes; - -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -/// -/// 稀有度枚举 -/// -public enum RarityEnum -{ - [Display(Name = "普通")][Probability(0.6f,100f)] Ordinary = 0, - [Display(Name = "高级")][Probability(0.25f,200f)] Senior = 1, - [Display(Name = "稀有")][Probability(0.1f,300f)] Rare = 2, - [Display(Name = "珍品")][Probability(0.04f,400f)] Gem = 3, - [Display(Name = "传说")][Probability(0.01f,600f)] Legend = 4 -} - -public static class RarityEnumExtensions -{ - public static string GetRarityName(this RarityEnum enumValue) - { - // 获取枚举类型 - Type type = enumValue.GetType(); - - // 获取当前枚举值的 FieldInfo - FieldInfo fieldInfo = type.GetField(enumValue.ToString()); - - // 获取 Display 特性 - DisplayAttribute displayAttribute = fieldInfo - .GetCustomAttributes(typeof(DisplayAttribute), false) - .FirstOrDefault() as DisplayAttribute; - - // 返回名称,如果没有找到,则返回枚举值的名称 - return displayAttribute?.Name ?? enumValue.ToString(); - } - - private static T GetAttribute(RarityEnum rarity) where T : Attribute - { - var fieldInfo = typeof(RarityEnum).GetField(rarity.ToString()); - var attribute = fieldInfo.GetCustomAttribute(); - return attribute!; - } - - public static decimal GetProbabilityValue(this RarityEnum rarity) - { - var attribute = GetAttribute(rarity); - return attribute.Probability.To(); - } - - public static double GetDefaultValue(this RarityEnum rarity) - { - var attribute = GetAttribute(rarity); - return attribute.DefaultValue.To(); - } - - public static string GetDisplayValue(this RarityEnum rarity) - { - var display = GetAttribute(rarity); - return display.Name!; - } - - public static decimal[] GetProbabilityArray() - { - List probabilityList = new List(); - - foreach (var field in typeof(RarityEnum).GetFields()) - { - // 获取特性 - var attribute = field.GetCustomAttribute(); - if (attribute != null) - { - // 将特性值添加到列表 - probabilityList.Add(attribute.Probability.To()); - } - } - - return probabilityList.ToArray(); - } - -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/SuccessMarketEto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/SuccessMarketEto.cs deleted file mode 100644 index 7154da45..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/SuccessMarketEto.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; - -/// -/// 成功交易eto -/// -public class SuccessMarketEto -{ - /// - /// 出售者用户id - /// - public Guid SellUserId { get; set; } - - /// - /// 购买者用户id - /// - public Guid BuyId { get; set; } - - /// - /// 藏品id - /// - public Guid CollectiblesId { get; set; } - - /// - /// 出售数量 - /// - public int SellNumber{ get; set; } - - /// - /// 出售单价 - /// - public decimal UnitPrice{ get; set; } - - /// - /// 实际到手价格(扣除税收) - /// - public decimal RealTotalPrice{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/SuccessMiningEto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/SuccessMiningEto.cs deleted file mode 100644 index ebdc2248..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/SuccessMiningEto.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; - -public class SuccessMiningEto -{ - public Guid CollectiblesId { get; set; } - - public Guid UserId{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/WeChatMiniProgramNoticeEto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/WeChatMiniProgramNoticeEto.cs deleted file mode 100644 index 9e753340..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Etos/WeChatMiniProgramNoticeEto.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; - -public class WeChatMiniProgramNoticeEto -{ - public Guid UserId { get; set; } - public String Title { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Settings/DigitalCollectiblesSettingProvider.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Settings/DigitalCollectiblesSettingProvider.cs deleted file mode 100644 index 37050705..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Settings/DigitalCollectiblesSettingProvider.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Volo.Abp.Settings; - -namespace Yi.Abp.Domain.Shared.Settings -{ - /// - /// 数字藏品配置 - /// - internal class DigitalCollectiblesSettingProvider : SettingDefinitionProvider - { - public override void Define(ISettingDefinitionContext context) - { - context.Add( - //每日挖矿最大上限--控制无限挖矿 - new SettingDefinition("MiningMaxLimit", "36"), - - //每次挖矿最小间隔(秒)--控制暴力挖矿 - new SettingDefinition("MiningMinIntervalSeconds", "3"), - - //每次挖到矿的概率--控制爆率 - new SettingDefinition("MiningMinProbability", "0.06"), - - //交易税率--控制频繁交易 - new SettingDefinition("MarketTaxRate", "0.02"), - - //矿池刷新内容 - new SettingDefinition("PoolData", "60,26,10,3,1"), - - //自动下架多久天前的商品 - new SettingDefinition("AutoPassInGoodsDay","3") - ); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Yi.Framework.DigitalCollectibles.Domain.Shared.csproj b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Yi.Framework.DigitalCollectibles.Domain.Shared.csproj deleted file mode 100644 index 4e77b87c..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/Yi.Framework.DigitalCollectibles.Domain.Shared.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/YiFrameworkDigitalCollectiblesDomainSharedModule.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/YiFrameworkDigitalCollectiblesDomainSharedModule.cs deleted file mode 100644 index aa6022ad..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain.Shared/YiFrameworkDigitalCollectiblesDomainSharedModule.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Volo.Abp.Domain; - -namespace Yi.Framework.DigitalCollectibles.Domain.Shared -{ - [DependsOn( - - typeof(AbpDddDomainSharedModule))] - public class YiFrameworkDigitalCollectiblesDomainSharedModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/MiningPoolContent.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/MiningPoolContent.cs deleted file mode 100644 index b5094bc3..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/MiningPoolContent.cs +++ /dev/null @@ -1,54 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Dtos; - -/// -/// 矿池内容 -/// -public class MiningPoolContent -{ - public MiningPoolContent(DateTime startTime, DateTime endTime) - { - StartTime = startTime; - EndTime = endTime; - } - - /// - /// 普通藏品剩余数量 - /// - public int I0_OrdinaryNumber { get; set; } - - /// - /// 高级藏品剩余数量 - /// - public int I1_SeniorNumber { get; set; } - - /// - /// 稀有藏品剩余数量 - /// - public int I2_RareNumber { get; set; } - - /// - /// 珍品藏品剩余数量 - /// - public int I3_GemNumber { get; set; } - - /// - /// 传说藏品剩余数量 - /// - public int I4_LegendNumber { get; set; } - - /// - /// 开始时间 - /// - public DateTime StartTime{ get; set; } - - /// - /// 结束时间 - /// - public DateTime EndTime{ get; set; } - - /// - /// 总共剩余藏品数量 - /// - public int TotalNumber => I0_OrdinaryNumber + I1_SeniorNumber + I2_RareNumber + I3_GemNumber + I4_LegendNumber; -} - diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/MiningPoolResult.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/MiningPoolResult.cs deleted file mode 100644 index 833f81a9..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/MiningPoolResult.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Enums; - -namespace Yi.Framework.DigitalCollectibles.Domain.Dtos; - -public class MiningPoolResult -{ - public CollectiblesAggregateRoot? Collectibles { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/UserMiningLimitCacheDto.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/UserMiningLimitCacheDto.cs deleted file mode 100644 index 7f000a55..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Dtos/UserMiningLimitCacheDto.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Yi.Framework.DigitalCollectibles.Domain.Dtos; - -public class UserMiningLimitCacheDto -{ - /// - /// 当前已挖矿次数 - /// - public int Number { get; set; } - - /// - /// 上次挖矿时间 - /// - public DateTime? LastMiningTime{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/CollectiblesAggregateRoot.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/CollectiblesAggregateRoot.cs deleted file mode 100644 index 640c60e0..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/CollectiblesAggregateRoot.cs +++ /dev/null @@ -1,54 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities.Auditing; -using Yi.Framework.Core.Data; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; - -namespace Yi.Framework.DigitalCollectibles.Domain.Entities; - -/// -/// 数字藏品定义表 -/// 用于定义数字藏品 -/// -[SugarTable("DC_Collectibles")] -public class CollectiblesAggregateRoot:FullAuditedAggregateRoot,IOrderNum -{ - /// - /// 藏品编号 - /// - public string Code { get; set; } - - /// - /// 藏品名称 - /// - public string Name { get; set; } - - /// - /// 藏品描述 - /// - public string? Describe { get; set; } - - /// - /// 价值数 - /// - public decimal ValueNumber { get; set; } - - /// - /// 藏品地址 - /// - public string Url { get; set; } - - /// - /// 稀有度 - /// - public RarityEnum Rarity{ get; set; } - - /// - /// 总共出现次数 - /// - public int FindTotal { get; set; } - - /// - /// 排序 - /// - public int OrderNum { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/CollectiblesUserStoreAggregateRoot.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/CollectiblesUserStoreAggregateRoot.cs deleted file mode 100644 index 79194398..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/CollectiblesUserStoreAggregateRoot.cs +++ /dev/null @@ -1,50 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities.Auditing; - -namespace Yi.Framework.DigitalCollectibles.Domain.Entities; - -/// -/// 数字藏品用户存储表 -/// 表示用户与藏品的库存关系 -/// -[SugarTable("DC_CollectiblesUserStore")] -public class CollectiblesUserStoreAggregateRoot : FullAuditedAggregateRoot -{ - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 藏品id - /// - public Guid CollectiblesId { get; set; } - - /// - /// 用户是否已读 - /// - public bool IsRead { get; set; } - - /// - /// 是否正在市场交易 - /// - public bool IsAtMarketing { get; set; } - - - /// - /// 上架货物 - /// - public void ShelvedMarket() - { - IsAtMarketing = true; - } - - /// - /// 交易货物 - /// - public void PurchaseMarket(Guid userId) - { - UserId = userId; - IsAtMarketing = false; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/InvitationCodeAggregateRoot.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/InvitationCodeAggregateRoot.cs deleted file mode 100644 index 277df7bb..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/InvitationCodeAggregateRoot.cs +++ /dev/null @@ -1,62 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities.Auditing; - -namespace Yi.Framework.DigitalCollectibles.Domain.Entities; - -[SugarTable("DC_InvitationCode")] -public class InvitationCodeAggregateRoot : FullAuditedAggregateRoot -{ - public InvitationCodeAggregateRoot() - { - } - public InvitationCodeAggregateRoot(Guid userId, string invitationCode) - { - this.UserId = userId; - this.InvitationCode = invitationCode; - } - - - /// - /// 谁的邀请码 - /// - public Guid UserId { get; set; } - - /// - /// 是否填写了邀请码(是否被邀请) - /// - public bool IsInvited { get; set; } = false; - - - /// - /// 积分-邀请数量 - /// - public int PointsNumber { get; set; } = 0; - - /// - /// 邀请码 - /// - public string InvitationCode { get; set; } - - /// - /// 这个人填写了邀请码(不能再进行填写) - /// - public void SetInvite() - { - IsInvited = true; - - } - - /// - /// 别人填写了这个用户的邀请码(这个用户积分+1) - /// - public void SetInvited() - { - PointsNumber += 1; - } - - //不做记录 - // /// - // /// 邀请者的id - // /// - // public Guid InviterUserId{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/MarketGoodsAggregateRoot.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/MarketGoodsAggregateRoot.cs deleted file mode 100644 index 35bcfd2e..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/MarketGoodsAggregateRoot.cs +++ /dev/null @@ -1,32 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities.Auditing; - -namespace Yi.Framework.DigitalCollectibles.Domain.Entities; - -/// -/// 交易市场货物 -/// 用于表示交易市场货物的情况 -/// -[SugarTable("DC_MarketGoods")] -public class MarketGoodsAggregateRoot:FullAuditedAggregateRoot -{ - /// - /// 出售者用户id - /// - public Guid SellUserId { get; set; } - - /// - /// 藏品id - /// - public Guid CollectiblesId { get; set; } - - /// - /// 出售数量 - /// - public int SellNumber{ get; set; } - - /// - /// 出售单价 - /// - public decimal UnitPrice{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/OnHookAggregateRoot.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/OnHookAggregateRoot.cs deleted file mode 100644 index a3eacccd..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/OnHookAggregateRoot.cs +++ /dev/null @@ -1,52 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities.Auditing; - -namespace Yi.Framework.DigitalCollectibles.Domain.Entities; - -/// -/// 挂机表 -/// 表示用户与挂机道具之间的关系 -/// 用于定时任务处理自动挖矿 -/// -[SugarTable("DC_OnHook")] -public class OnHookAggregateRoot : FullAuditedAggregateRoot -{ - public OnHookAggregateRoot() - { - } - - public OnHookAggregateRoot(Guid userId, int effectiveHours) - { - UserId = userId; - EffectiveHours = effectiveHours; - StarTime = DateTime.Now; - EndTime = DateTime.Now.AddHours(effectiveHours); - IsActive = true; - } - - - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 开始时间 - /// - public DateTime? StarTime { get; set; } - - /// - /// 结束时间 - /// - public DateTime? EndTime { get; set; } - - /// - /// 有效小时数 - /// - public int EffectiveHours { get; set; } - - /// - /// 是否激活 - /// - public bool IsActive { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/Record/MarketRecordAggregateRoot.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/Record/MarketRecordAggregateRoot.cs deleted file mode 100644 index fb61b358..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/Record/MarketRecordAggregateRoot.cs +++ /dev/null @@ -1,41 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities.Auditing; - -namespace Yi.Framework.DigitalCollectibles.Domain.Entities.Record; - -/// -/// 交易记录 -/// -[SugarTable("DC_MarketRecord")] -public class MarketRecordAggregateRoot:FullAuditedAggregateRoot -{ - /// - /// 出售者用户id - /// - public Guid SellUserId { get; set; } - - /// - /// 购买者用户id - /// - public Guid BuyId { get; set; } - - /// - /// 藏品id - /// - public Guid CollectiblesId { get; set; } - - /// - /// 出售数量 - /// - public int SellNumber{ get; set; } - - /// - /// 出售单价 - /// - public decimal UnitPrice{ get; set; } - - /// - /// 实际到手价格(扣除税收) - /// - public decimal RealTotalPrice{ get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/Record/MiningPoolRecordAggregateRoot.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/Record/MiningPoolRecordAggregateRoot.cs deleted file mode 100644 index 82490f9c..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Entities/Record/MiningPoolRecordAggregateRoot.cs +++ /dev/null @@ -1,32 +0,0 @@ -using SqlSugar; -using Volo.Abp.Domain.Entities.Auditing; - -namespace Yi.Framework.DigitalCollectibles.Domain.Entities.Record; - -/// -/// 挖矿记录 -/// -[SugarTable("DC_MiningPoolRecord")] -public class MiningPoolRecordAggregateRoot:FullAuditedAggregateRoot -{ - public MiningPoolRecordAggregateRoot(Guid userId, Guid collectiblesId) - { - UserId = userId; - CollectiblesId = collectiblesId; - } - - public MiningPoolRecordAggregateRoot() - { - } - - - /// - /// 用户id - /// - public Guid UserId { get; set; } - - /// - /// 挖到的藏品id - /// - public Guid CollectiblesId { get; set; } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/BindAccountForCollectiblesEventHandler.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/BindAccountForCollectiblesEventHandler.cs deleted file mode 100644 index 9e1f808d..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/BindAccountForCollectiblesEventHandler.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Entities.Record; -using Yi.Framework.DigitalCollectibles.Domain.Managers; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Domain.EventHandlers; - -/// -/// 临时账号绑定到正式账号,价值、积分 (累加) -/// -public class BindAccountForCollectiblesEventHandler : ILocalEventHandler, ITransientDependency -{ - private readonly InvitationCodeManager _invitationCodeManager; - - private readonly ISqlSugarRepository _collectiblesUserStoreRepository; - - - private readonly ISqlSugarRepository _miningPoolRecordRepository; - private readonly ISqlSugarRepository _marketRecordRepository; - private readonly ISqlSugarRepository _marketGoodsRepository; - public BindAccountForCollectiblesEventHandler(InvitationCodeManager invitationCodeManager, ISqlSugarRepository collectiblesUserStoreRepository, ISqlSugarRepository miningPoolRecordRepository, ISqlSugarRepository marketRecordRepository, ISqlSugarRepository marketGoodsRepository) - { - _invitationCodeManager = invitationCodeManager; - _collectiblesUserStoreRepository = collectiblesUserStoreRepository; - _miningPoolRecordRepository = miningPoolRecordRepository; - _marketRecordRepository = marketRecordRepository; - _marketGoodsRepository = marketGoodsRepository; - } - - public async Task HandleEventAsync(BindAccountEto eventData) - { - var oldEntity = await _invitationCodeManager.TryGetOrAddAsync(eventData.OldUserId); - var newEntity = await _invitationCodeManager.TryGetOrAddAsync(eventData.NewUserId); - - newEntity.PointsNumber += oldEntity.PointsNumber; - - //临时账号邀请了,老的账号没有邀请,覆盖 - if (newEntity.IsInvited == false && oldEntity.IsInvited == true) - { - newEntity.IsInvited = true; - } - - await _invitationCodeManager._repository.UpdateAsync(newEntity); - - //藏品转移 - var oldUserStore= await _collectiblesUserStoreRepository.GetListAsync(x => x.UserId == eventData.OldUserId); - if (oldUserStore.Count>0) - { - oldUserStore?.ForEach(x=>x.UserId=eventData.NewUserId); - await _collectiblesUserStoreRepository.UpdateRangeAsync(oldUserStore); - } - - //挖矿记录转移 - var miningPoolRecord= await _miningPoolRecordRepository.GetListAsync(x => x.UserId == eventData.OldUserId); - if (miningPoolRecord.Count>0) - { - miningPoolRecord?.ForEach(x=>x.UserId=eventData.NewUserId); - await _miningPoolRecordRepository.UpdateRangeAsync(miningPoolRecord); - } - - //交易记录转移 - var marketRecord= await _marketRecordRepository.GetListAsync(x => x.SellUserId == eventData.OldUserId||x.BuyId==eventData.OldUserId); - if (marketRecord.Count>0) - { - marketRecord?.ForEach(x => - { - if (x.SellUserId == eventData.OldUserId) - { - x.SellUserId = eventData.NewUserId; - } - - if (x.BuyId == eventData.OldUserId) - { - x.BuyId = eventData.NewUserId; - } - }); - await _marketRecordRepository.UpdateRangeAsync(marketRecord); - } - - - //商城物品交易转移 - var marketGoods= await _marketGoodsRepository.GetListAsync(x => x.SellUserId == eventData.OldUserId); - if (marketGoods.Count>0) - { - marketGoods?.ForEach(x=>x.SellUserId=eventData.NewUserId); - await _marketGoodsRepository.UpdateRangeAsync(marketGoods); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SetAccountInfoEventHandler.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SetAccountInfoEventHandler.cs deleted file mode 100644 index ebdc1937..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SetAccountInfoEventHandler.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.DigitalCollectibles.Domain.Managers; - -namespace Yi.Framework.DigitalCollectibles.Domain.EventHandlers; - -public class SetAccountInfoEventHandler : ILocalEventHandler, ITransientDependency -{ - private readonly CollectiblesManager _collectiblesManager; - private readonly InvitationCodeManager _invitationCodeManager; - - public SetAccountInfoEventHandler(CollectiblesManager collectiblesManager, - InvitationCodeManager invitationCodeManager) - { - _collectiblesManager = collectiblesManager; - _invitationCodeManager = invitationCodeManager; - } - - public async Task HandleEventAsync(SetAccountInfoEto eventData) - { - var userId = eventData.UserId; - //设置价值 - eventData.Value = await _collectiblesManager.GetAccountValueAsync(userId); - - //设置积分 - eventData.Points = (await _invitationCodeManager.TryGetOrAddAsync(userId)).PointsNumber; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SuccessMarketEventHandler.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SuccessMarketEventHandler.cs deleted file mode 100644 index 9682f109..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SuccessMarketEventHandler.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Mapster; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Yi.Framework.DigitalCollectibles.Domain.Entities.Record; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Domain.EventHandlers; - -public class SuccessMarketEventHandler : ILocalEventHandler, ITransientDependency -{ - private readonly ISqlSugarRepository _marketRecordRepository; - - public SuccessMarketEventHandler(ISqlSugarRepository marketRecordRepository) - { - _marketRecordRepository = marketRecordRepository; - } - - public async Task HandleEventAsync(SuccessMarketEto eventData) - { - await _marketRecordRepository.InsertAsync(eventData.Adapt()); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SuccessMiningEventHandler.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SuccessMiningEventHandler.cs deleted file mode 100644 index f62c8352..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/EventHandlers/SuccessMiningEventHandler.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus; -using Volo.Abp.EventBus.Local; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Entities.Record; -using Yi.Framework.DigitalCollectibles.Domain.Managers; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.WeChat.MiniProgram; -using Yi.Framework.WeChat.MiniProgram.HttpModels; - -namespace Yi.Framework.DigitalCollectibles.Domain.EventHandlers; - -/// -/// 成功挖到矿物 -/// -public class SuccessMiningEventHandler : ILocalEventHandler, ITransientDependency -{ - private MiningPoolManager _miningPoolManager; - private ISqlSugarRepository _repository; - private readonly ISqlSugarRepository _userStoreRepository; - private readonly ISqlSugarRepository _miningPoolRecordRepository; - private readonly ILocalEventBus _localEvent; - - public SuccessMiningEventHandler(MiningPoolManager miningPoolManager, - ISqlSugarRepository repository, - ISqlSugarRepository userStoreRepository, - ISqlSugarRepository miningPoolRecordRepository, ILocalEventBus localEvent) - { - _miningPoolManager = miningPoolManager; - _repository = repository; - _userStoreRepository = userStoreRepository; - _miningPoolRecordRepository = miningPoolRecordRepository; - _localEvent = localEvent; - } - - public async Task HandleEventAsync(SuccessMiningEto eventData) - { - //当前藏品 - var currentCollectibles = await _repository.GetFirstAsync(x => x.Id == eventData.CollectiblesId); - //扣减矿池 - await _miningPoolManager.DeductionPoolAsync(currentCollectibles.Rarity); - //新增全世界发现 - currentCollectibles.FindTotal += 1; - await _repository.UpdateAsync(currentCollectibles); - - //使用结果新增给对应的用户 - await _userStoreRepository.InsertAsync(new CollectiblesUserStoreAggregateRoot - { - UserId = eventData.UserId, - CollectiblesId = eventData.CollectiblesId, - IsRead = false - }); - - //新增一条挖矿记录 - await _miningPoolRecordRepository.InsertAsync( - new MiningPoolRecordAggregateRoot(eventData.UserId, eventData.CollectiblesId)); - - //给挖到矿的用户,发送微信小程序通知 - await _localEvent.PublishAsync(new WeChatMiniProgramNoticeEto - { - UserId = eventData.UserId, - Title = $"{currentCollectibles.Rarity.GetRarityName()}-{currentCollectibles.Name}" - },false); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/CollectiblesManager.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/CollectiblesManager.cs deleted file mode 100644 index 55547101..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/CollectiblesManager.cs +++ /dev/null @@ -1,147 +0,0 @@ -using Microsoft.Extensions.Caching.Distributed; -using Volo.Abp.Caching; -using Volo.Abp.Domain.Services; -using Volo.Abp.Users; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Caches; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Domain.Managers; -/// -/// 藏品领域服务 -/// 用于管理用户的藏品库存、藏品的业务逻辑 -/// -public class CollectiblesManager:DomainService -{ - private readonly ISqlSugarRepository _collectiblesUserStoreRepository; - private readonly ISqlSugarRepository _collectiblesRepository; - private readonly IDistributedCache> _distributedCache; - public CollectiblesManager(ISqlSugarRepository collectiblesUserStoreRepository, ISqlSugarRepository collectiblesRepository, IDistributedCache> distributedCache) - { - _collectiblesUserStoreRepository = collectiblesUserStoreRepository; - _collectiblesRepository = collectiblesRepository; - _distributedCache = distributedCache; - } - - /// - /// 获取某个用户的价值 - /// - /// - /// - public async Task GetAccountValueAsync(Guid userId) - { - var collectiblesList = await _collectiblesUserStoreRepository._DbQueryable - .Where(store => store.UserId == userId) - .LeftJoin((store, c) => store.CollectiblesId == c.Id) - .Select((store, c) => - new - { - c.Id, - c.ValueNumber - } - ).ToListAsync(); - var totalValue=ComputeValue(collectiblesList.Select(x=> (x.Id,x.ValueNumber)).ToList()); - return totalValue; - } - - //计算价值,需要每个藏品的唯一值和藏品的价值即可 - private decimal ComputeValue(List<(Guid collectiblesId,decimal valueNumber)> data) - { - var groupBy = data.GroupBy(x => x.collectiblesId); - decimal totalValue = 0; - - //首个价值百分之百,后续每个只有百分之40,最大10个 - foreach (var groupByItem in groupBy) - { - foreach (var item in groupByItem.Select((value, index) => new { value, index })) - { - - if (item.index == 0) - { - totalValue += item.value.valueNumber; - } - else if (item.index == 10) - { - //到第11个,直接跳出循环 - break; - } - else - { - totalValue += item.value.valueNumber * 0.4m; - } - } - } - - return totalValue; - } - -/// -/// 获取全量的排行榜 -/// -/// - public async Task> GetAllAccountValueByCacheAsync() - { - return await _distributedCache.GetOrAddAsync("AllAccountValue", async () => await GetAccountValueAsync(), - () => new DistributedCacheEntryOptions() - { - AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(1) - }); - } - - private async Task> GetAccountValueAsync() - { - var output = new List(); - //获取全部用户的库存 - var allStore= await _collectiblesUserStoreRepository._DbQueryable.ToListAsync(); - //获取全部藏品 - var allCollectiblesDic= (await _collectiblesRepository._DbQueryable.ToListAsync()).ToDictionary(x=>x.Id,y=>y.ValueNumber); - - //根据用户分组 - var userGroup= allStore.GroupBy(x => x.UserId); - //每个用户进行计算价值 - foreach (var item in userGroup) - { - var value= ComputeValue(item.Select(x => (x.CollectiblesId, allCollectiblesDic[x.CollectiblesId])).ToList()); - output.Add(new CollectiblesValueCacheItem - { - UserId = item.Key, - Value = value - }); - } - - return output; - } - - - /// - /// 全量更新藏品价值 - /// - /// - public async Task UpdateAllValueAsync() - { - //全部藏品 - var collectibles = await _collectiblesRepository.GetListAsync(); - foreach (var item in collectibles) - { - var defaultValue= item.Rarity.GetDefaultValue(); - //计算实际的百分比 - var realValueRate= CalculateValue(item.FindTotal); - - var realValue = Math.Round(defaultValue * realValueRate); - item.ValueNumber = realValue.To(); - } - - await _collectiblesRepository.UpdateRangeAsync(collectibles); - } - - /// - /// 价值计算公式 - /// - /// - /// - private double CalculateValue(double x) - { - return 0.1 + 0.9 * Math.Exp(-0.00824 * (x - 1)); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/InvitationCodeManager.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/InvitationCodeManager.cs deleted file mode 100644 index a58503d2..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/InvitationCodeManager.cs +++ /dev/null @@ -1,89 +0,0 @@ -using Volo.Abp.Domain.Services; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Domain.Managers; - -/// -/// 邀请码领域服务 -/// -public class InvitationCodeManager : DomainService -{ - public readonly ISqlSugarRepository _repository; - - public InvitationCodeManager(ISqlSugarRepository repository) - { - _repository = repository; - } - - - /// - /// 填写邀请码 - /// - public async Task SetAsync(Guid writeUserId, string invitationCode) - { - //统一大写 - invitationCode= invitationCode.ToUpper(); - var entityOrNull = await _repository.GetFirstAsync(x => x.InvitationCode == invitationCode); - if (entityOrNull is null) - { - throw new UserFriendlyException("无效邀请码,请检查"); - } - if (entityOrNull.UserId==writeUserId) - { - throw new UserFriendlyException("你不能邀请自己"); - } - - //被邀请的人 - var entity = entityOrNull; - entity.SetInvited(); - - //填写邀请码的人 - var writeEntity = await TryGetOrAddAsync(writeUserId); - writeEntity.SetInvite(); - - await _repository.UpdateRangeAsync(new List { entity, writeEntity }); - } - - public async Task TryGetOrAddAsync(Guid userId, int InitPointsNumber = 0) - { - var entity = await _repository.FindAsync(x => x.UserId == userId); - if (entity is null) - { - string invitationCode = string.Empty; - - //循环到邀请码没有重复为止 - var isExist = true; - while (isExist) - { - invitationCode = CreateInvitationCode(4); - if (!await _repository.IsAnyAsync(x => x.InvitationCode == invitationCode)) - { - isExist = false; - } - } - - var insertEntity = new InvitationCodeAggregateRoot(userId, invitationCode) - { - PointsNumber = InitPointsNumber - }; - entity = await _repository.InsertReturnEntityAsync(insertEntity); - } - - return entity; - } - - private string CreateInvitationCode(int length) - { - const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - Random random = new Random(); - char[] stringChars = new char[length]; - - for (int i = 0; i < length; i++) - { - stringChars[i] = chars[random.Next(chars.Length)]; - } - - return new string(stringChars); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/MarketManager.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/MarketManager.cs deleted file mode 100644 index 3e01f6d2..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/MarketManager.cs +++ /dev/null @@ -1,186 +0,0 @@ -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Settings; -using Yi.Framework.Bbs.Domain.Shared.Etos; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Domain.Managers; - -/// -/// 市场领域服务 -/// 处理交易市场相关业务,例如交易等 -/// -public class MarketManager : DomainService -{ - private readonly ISqlSugarRepository _collectiblesUserStoreRepository; - - private readonly ISqlSugarRepository _marketGoodsRepository; - - private readonly ILocalEventBus _localEventBus; - private readonly ISettingProvider _settingProvider; - - public MarketManager(ISqlSugarRepository collectiblesUserStoreRepository, - ISqlSugarRepository marketGoodsRepository, ILocalEventBus localEventBus, - ISettingProvider settingProvider) - { - _collectiblesUserStoreRepository = collectiblesUserStoreRepository; - _marketGoodsRepository = marketGoodsRepository; - _localEventBus = localEventBus; - _settingProvider = settingProvider; - } - - - /// - /// 商品自动流拍,自动下架 - /// - public async Task AutoPassInGoodsAsync() - { - var autoPassInGoodsDay = (await _settingProvider.GetOrNullAsync("AutoPassInGoodsDay")).To(); - //下架3天前的商品 - var endTine = DateTime.Now.AddDays(-autoPassInGoodsDay); - //获取所有需要下架商品 - var marketGoods = await _marketGoodsRepository._DbQueryable.Where(x => x.CreationTime <= endTine).ToListAsync(); - - //单独处理每一个下架的商品 - foreach (var goods in marketGoods) - { - //用户库存 - var userStore = await _collectiblesUserStoreRepository._DbQueryable - .Where(x=>x.UserId==goods.SellUserId) - .Where(x => x.CollectiblesId == goods.CollectiblesId) - .Where(x => x.IsAtMarketing == true).FirstAsync(); - if (userStore is not null) - { - userStore.IsAtMarketing = false; - await _collectiblesUserStoreRepository.UpdateAsync(userStore); - //删除商品 - await _marketGoodsRepository.DeleteByIdAsync(goods.Id); - } - } - } - - /// - /// 上架货物 - /// - /// 上架者 - /// 上架的收藏品id - /// 上架数量 - /// 上架单价 - /// - public async Task ShelvedGoodsAsync(Guid userId, Guid collectiblesId, int number, decimal money) - { - if (number <= 0) - { - throw new UserFriendlyException("上架藏品数量需大于0"); - } - - var collectiblesList = await _collectiblesUserStoreRepository._DbQueryable - .Where(x => x.UserId == userId) - .Where(x => x.IsAtMarketing == false) - .Where(x => x.CollectiblesId == collectiblesId).ToListAsync(); - if (collectiblesList.Count < number) - { - throw new UserFriendlyException($"您的非上架该藏品不足{number}个,上架失败"); - } - - //上架收藏品 - var shelvedcollectibles = collectiblesList.Take(number); - foreach (var store in shelvedcollectibles) - { - store.ShelvedMarket(); - } - - await _collectiblesUserStoreRepository.UpdateRangeAsync(shelvedcollectibles.ToList()); - - await _marketGoodsRepository.InsertAsync(new MarketGoodsAggregateRoot - { - SellUserId = userId, - CollectiblesId = collectiblesId, - SellNumber = number, - UnitPrice = money - }); - } - - /// - /// 购买商品 - /// - /// 购买者用户 - /// 商品id - /// 购买数量 - /// - public async Task PurchaseGoodsAsync(Guid userId, Guid marketGoodsId, int number) - { - if (number <= 0) - { - throw new UserFriendlyException("交易藏品数量需大于0"); - } - - //1-市场扣减或者关闭该商品 - //2-出售者新增钱,购买者扣钱 - //3-出售者删除对应库存,购买者新增对应库存 - var marketGoods = await _marketGoodsRepository.GetAsync(x => x.Id == marketGoodsId); - - if (marketGoods is null) - { - throw new UserFriendlyException($"交易失败,当前交易市场不存在该商品"); - } - - //1-市场扣减或者关闭该商品 - if (marketGoods.SellNumber == number) - { - await _marketGoodsRepository.DeleteAsync(x => x.Id == marketGoodsId); - } - else if (marketGoods.SellNumber >= number) - { - marketGoods.SellNumber -= number; - await _marketGoodsRepository.UpdateAsync(marketGoods); - } - else - { - throw new UserFriendlyException($"交易失败,当前交易市场库存不足"); - } - - //2-出售者新增钱,购买者扣钱 - //发布一个其他领域的事件-购买者扣钱 - await _localEventBus.PublishAsync( - new MoneyChangeEventArgs() { UserId = userId, Number = -(number * marketGoods.UnitPrice) }, false); - //发布一个其他领域的事件-出售者加钱,同时扣税 - var marketTaxRate = decimal.Parse(await _settingProvider.GetOrNullAsync("MarketTaxRate")); - //价格*扣减税 - var realTotalPrice = (number * marketGoods.UnitPrice) * (1 - marketTaxRate); - //出售者实际加钱 - await _localEventBus.PublishAsync( - new MoneyChangeEventArgs() { UserId = marketGoods.SellUserId, Number = realTotalPrice }, false); - - //3-出售者删除对应库存,购买者新增对应库存(只需更改用户者即可) - var collectiblesList = await _collectiblesUserStoreRepository._DbQueryable.Where(x => x.IsAtMarketing == true) - .Where(x => x.UserId == marketGoods.SellUserId) - .Where(x => x.CollectiblesId == marketGoods.CollectiblesId) - .ToListAsync(); - if (collectiblesList.Count < number) - { - throw new UserFriendlyException($"交易失败,当前出售者库存不足"); - } - - var updateStore = collectiblesList.Take(number).ToList(); - foreach (var userStore in updateStore) - { - userStore.PurchaseMarket(userId); - } - - await _collectiblesUserStoreRepository.UpdateRangeAsync(updateStore); - - //发布一个成功交易事件 - await _localEventBus.PublishAsync(new SuccessMarketEto - { - SellUserId = marketGoods.SellUserId, - BuyId = userId, - CollectiblesId = marketGoods.CollectiblesId, - SellNumber = marketGoods.SellNumber, - UnitPrice = marketGoods.UnitPrice, - RealTotalPrice = realTotalPrice - }, false); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/MiningPoolManager.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/MiningPoolManager.cs deleted file mode 100644 index 0eb08714..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Managers/MiningPoolManager.cs +++ /dev/null @@ -1,432 +0,0 @@ -using FreeRedis; -using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using Volo.Abp.Caching; -using Volo.Abp.Domain.Services; -using Volo.Abp.EventBus.Local; -using Volo.Abp.Settings; -using Volo.Abp.Threading; -using Yi.Framework.DigitalCollectibles.Domain.Dtos; -using Yi.Framework.DigitalCollectibles.Domain.Entities; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Consts; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Enums; -using Yi.Framework.DigitalCollectibles.Domain.Shared.Etos; -using Yi.Framework.SettingManagement.Domain; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Framework.DigitalCollectibles.Domain.Managers; - -/// -/// 矿池领域服务 -/// 处理矿池相关业务,例如挖矿等 -/// -public class MiningPoolManager : DomainService -{ - private readonly ISqlSugarRepository _collectiblesRepository; - private readonly ISqlSugarRepository _onHookRepository; - private readonly ISettingProvider _settingProvider; - private readonly IDistributedCache _miningPoolCache; - private readonly IDistributedCache _userMiningLimitCache; - private readonly ISqlSugarRepository _userStoreRepository; - private readonly ILogger _logger; - private IRedisClient RedisClient => LazyServiceProvider.LazyGetRequiredService(); - private ILocalEventBus LocalEventBus => LazyServiceProvider.LazyGetRequiredService(); - - public MiningPoolManager(ISettingProvider settingProvider, IDistributedCache miningPoolCache, - ISqlSugarRepository collectiblesRepository, - ISqlSugarRepository onHookRepository, - ISqlSugarRepository userStoreRepository, - IDistributedCache userMiningLimitCache, ILogger logger) - { - _settingProvider = settingProvider; - this._miningPoolCache = miningPoolCache; - _collectiblesRepository = collectiblesRepository; - _onHookRepository = onHookRepository; - _userStoreRepository = userStoreRepository; - _userMiningLimitCache = userMiningLimitCache; - _logger = logger; - } - - /// - /// 扣减矿池 - /// - /// 矿物等级 - public async Task DeductionPoolAsync(RarityEnum rarity) - { - var pool = await GetMiningPoolContentAsync(); - switch (rarity) - { - case RarityEnum.Ordinary: - pool.I0_OrdinaryNumber -= 1; - break; - case RarityEnum.Senior: - pool.I1_SeniorNumber -= 1; - break; - case RarityEnum.Rare: - pool.I2_RareNumber -= 1; - break; - case RarityEnum.Gem: - pool.I3_GemNumber -= 1; - break; - case RarityEnum.Legend: - pool.I4_LegendNumber -= 1; - break; - } - - //重新设置 - await SetMiningPoolAsync(pool); - } - - - /// - /// 每次挖矿概率,每天根据特定算法计算 - /// - private decimal CurrentMiningProbability => AsyncHelper.RunSync(async () => - { - return await ComputeMiningProbabilityAsync(); - }); - - public async Task GetMiningPoolContentAsync() - { - var pool = await _miningPoolCache.GetAsync(MiningCacheConst.MiningPoolContent); - return pool; - } - - public async Task GetOnHookAsync(Guid userId) - { - var onHook = await _onHookRepository._DbQueryable.Where(x => x.UserId == userId) - .Where(x => x.IsActive == true) - .Where(x => x.EndTime > DateTime.Now) - .FirstAsync(); - - if (onHook is not null) - { - throw new UserFriendlyException($"当前你正在进行自动挂机,结束时间:{onHook.EndTime.Value.ToString("MM月dd日HH分mm秒")})"); - } - - await _onHookRepository.InsertAsync(new OnHookAggregateRoot(userId, 24)); - } - - /// - /// 校验挖矿限制 - /// - /// - private async Task VerifyMiningLimitAsync(Guid userId) - { - //每天最大次数限制 - var miningMaxLimit = int.Parse(await _settingProvider.GetOrNullAsync("MiningMaxLimit")); - //每次间隔 - var miningMinIntervalSeconds = int.Parse(await _settingProvider.GetOrNullAsync("MiningMinIntervalSeconds")); - - var currentNumber = 1; - - //根据用户进行上锁 - if (await RedisClient.SetNxAsync($"UserMiningLimitLock:{userId}", true, - TimeSpan.FromSeconds(miningMinIntervalSeconds))) - { - var userLimit = await _userMiningLimitCache.GetAsync($"{MiningCacheConst.UserMiningLimit}:{userId}"); - - if (userLimit is not null) - { - //符合条件,成功挖矿 - if (userLimit.Number < miningMaxLimit) - { - currentNumber = userLimit.Number + 1; - } - else - { - throw new UserFriendlyException($"失败,你已达当轮矿池最大限制,给其他人留点吧"); - } - } - - //没有缓存过,必定成功,直接走 - await _userMiningLimitCache.SetAsync($"{MiningCacheConst.UserMiningLimit}:{userId}", - new UserMiningLimitCacheDto - { - Number = currentNumber, - LastMiningTime = DateTime.Now, - }, - new DistributedCacheEntryOptions() - { - //虽然新增的是一天,但是每次刷新是早上10点,矿池刷新时,还需要清除限制 - AbsoluteExpirationRelativeToNow = TimeSpan.FromDays(1) - }); - return; - } - - //已上过锁,并且没有到限制时间,必定失败 - //不符合条件,直接走 - throw new UserFriendlyException($"失败,你都挖的冒烟了,请稍后再挖"); - } - - /// - /// 用户进行一次挖矿 - /// - /// - public async Task MiningAsync(Guid userId) - { - //检验限制 - await VerifyMiningLimitAsync(userId); - - var result = new MiningPoolResult(); - //从矿池中开挖,判断矿池是否还有矿 - //根据挖矿概率,进行挖掘 - //挖到了放到用户仓库即可 - - //如果概率是挖到了矿,再从矿物中随机选择一个稀有度,再在当前稀有度中的矿物列表,随机选择一个具体的矿物 - var pool = await GetMiningPoolContentAsync(); - if (pool is null || pool.TotalNumber == 0) - { - throw new UserFriendlyException($"失败,矿池已经被掏空了,请等矿池刷新后再来"); - } - - // 生成一个 0 到 1 之间的随机数 - double randomValue = new Random().NextDouble(); - //如果随机的概率在当前概率内,成功 - if (randomValue.To() < CurrentMiningProbability) - { - //成功后在藏品中根据稀有度概率必定获取一个 - var probabilityArray = RarityEnumExtensions.GetProbabilityArray(); - var index = GetRandomIndex(probabilityArray); - var rarityType = (RarityEnum)Enum.GetValues(typeof(RarityEnum)).GetValue(index)!; - var collectiblesList = - await _collectiblesRepository._DbQueryable.Where(x => x.Rarity == rarityType).ToListAsync(); - //当前等级的矿物没有设置 - if (collectiblesList.Count == 0) - { - throw new UserFriendlyException($"可惜!差一点就挖到了"); - } - - bool poolState = true; - switch (rarityType) - { - case RarityEnum.Ordinary: - if (pool.I0_OrdinaryNumber <= 0) - { - poolState = false; - } - - break; - case RarityEnum.Senior: - if (pool.I1_SeniorNumber <= 0) - { - poolState = false; - } - - break; - case RarityEnum.Rare: - if (pool.I2_RareNumber <= 0) - { - poolState = false; - } - - break; - case RarityEnum.Gem: - if (pool.I3_GemNumber <= 0) - { - poolState = false; - } - - break; - case RarityEnum.Legend: - if (pool.I4_LegendNumber <= 0) - { - poolState = false; - } - - break; - } - - if (poolState == false) - { - throw new UserFriendlyException($"超级可惜!真的真的只差最后一点就挖到了"); - } - - - int randomIndex = new Random().Next(collectiblesList.Count); - var currentCollectibles = collectiblesList[randomIndex]; - - result.Collectibles = currentCollectibles; - - await LocalEventBus.PublishAsync(new SuccessMiningEto - { - CollectiblesId = currentCollectibles.Id, - UserId = userId - }, false); - - return result; - } - - throw new UserFriendlyException($"恭喜!空空如也,挖了个寂寞"); - } - - /// - /// 挂机挖矿 - /// - public async Task OnHookMiningAsync() - { - //获取当前激活的挂机挖矿 - var currentOnHook = await _onHookRepository._DbQueryable.Where(x => x.IsActive == true) - .Where(x => x.EndTime <= DateTime.Now).ToListAsync(); - - //根据用户对挂机卡hash关系 - var userOnHookDic = currentOnHook.GroupBy(x => x.UserId).ToDictionary(x => x.Key, y => y.First()); - foreach (var onHookItem in userOnHookDic) - { - try - { - await MiningAsync(onHookItem.Value.UserId); - } - catch (UserFriendlyException e) - { - _logger.LogInformation($"自动挖矿-{onHookItem.Value.UserId},{e.Message}"); - } - } - } - - private int GetRandomIndex(decimal[] probabilities) - { - // 生成0到1之间的随机数 - Random random = new Random(); - decimal randomValue = random.NextDouble().To(); - - decimal cumulativeProbability = 0.0m; - - for (int i = 0; i < probabilities.Length; i++) - { - cumulativeProbability += probabilities[i]; - - // 判断随机数是否小于当前的累积概率 - if (randomValue < cumulativeProbability) - { - return i; // 返回中标的索引 - } - } - - //剩余情况都是普通 - return 0; - } - - /// - /// 计算当前挖矿概率 - /// - /// - public async Task ComputeMiningProbabilityAsync() - { - //当前的挖矿期望:当天的所有藏品能被刚好挖完 - - //保底概率:最大不能高过一个值,百分之10 - //手动挖矿:1天可挖10次,每次至少间隔6秒 - //自动挖矿:1天可以挖24次 每次间隔60分钟(需要使用自动挖矿卡) - //可影响因素:剩余手动挖矿次数+剩余自动挖矿次数 - - //简单模式,1/15 - var miningMaxLimit = decimal.Parse(await _settingProvider.GetOrNullAsync("MiningMinProbability")); - return miningMaxLimit; - } - - /// - /// 刷新矿池 - /// - /// - public async Task RefreshMiningPoolAsync() - { - //获取当前最大的限制 - // var maximumPoolLimit = int.Parse(await _settingProvider.GetOrNullAsync("MaxPoolLimit")); - var poolData = (await _settingProvider.GetOrNullAsync("PoolData")).Split(',').Select(x => int.Parse(x)) - .ToList(); - DateTime startTime = DateTime.Today.AddHours(10); - DateTime endTime = startTime.AddDays(1); - // var probabilityValues = RarityEnumExtensions.GetProbabilityArray(); - // var result = GenerateDistribution(maximumPoolLimit, probabilityValues); - - //根据配置,将不同比例的矿,塞入矿池, - //矿池,交给redis - - await SetMiningPoolAsync(new MiningPoolContent(startTime, endTime) - { - I0_OrdinaryNumber = poolData[0], - I1_SeniorNumber = poolData[1], - I2_RareNumber = poolData[2], - I3_GemNumber = poolData[3], - I4_LegendNumber = poolData[4] - }); - } - - private async Task SetMiningPoolAsync(MiningPoolContent content) - { - await _miningPoolCache.SetAsync(MiningCacheConst.MiningPoolContent, content - , new DistributedCacheEntryOptions - { - AbsoluteExpiration = content.EndTime - }); - } - - /// - /// 缓存前缀 - /// - private string CacheKeyPrefix => LazyServiceProvider.LazyGetRequiredService>() - .Value.KeyPrefix; - - /// - /// 刷新用户挖矿限制 - /// - public async Task RefreshMiningUserLimitAsync() - { - var needKeys = await RedisClient.KeysAsync($"{CacheKeyPrefix}{MiningCacheConst.UserMiningLimit}*"); - foreach (var needKey in needKeys) - { - await RedisClient.DelAsync(needKey); - } - } - - /// - /// 根据概率生成给对应稀有度藏品 - /// - /// - /// - /// - /// - private int[] GenerateDistribution(int totalCount, decimal[] probabilities) - { - int[] counts = new int[probabilities.Length]; - decimal totalProbability = 0; - - // 计算概率总和,确保为 1 - foreach (var prob in probabilities) - { - totalProbability += prob; - } - - // 检查概率之和是否为 1 - if (totalProbability < 0.99m || totalProbability > 1.01m) - { - throw new ArgumentException("概率总和必须接近1"); - } - - // 生成分布 - for (int i = 0; i < probabilities.Length; i++) - { - counts[i] = (int)(totalCount * probabilities[i]); - } - - // 处理可能因精度问题导致的总数不足 - int sum = 0; - foreach (var count in counts) - { - sum += count; - } - - int difference = totalCount - sum; - - // 将差值分配给概率最大的一项 - if (difference > 0) - { - int maxIndex = Array.IndexOf(counts, Math.Max(counts[0], counts[1])); - counts[maxIndex] += difference; - } - - return counts; - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Yi.Framework.DigitalCollectibles.Domain.csproj b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Yi.Framework.DigitalCollectibles.Domain.csproj deleted file mode 100644 index 2d47931a..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/Yi.Framework.DigitalCollectibles.Domain.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/YiFrameworkDigitalCollectiblesDomainModule.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/YiFrameworkDigitalCollectiblesDomainModule.cs deleted file mode 100644 index 4a0a0f59..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.Domain/YiFrameworkDigitalCollectiblesDomainModule.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Volo.Abp.Caching; -using Volo.Abp.Domain; -using Volo.Abp.Modularity; -using Yi.Framework.DigitalCollectibles.Domain.Shared; -using Yi.Framework.Mapster; -using Yi.Framework.SettingManagement.Domain; -using Yi.Framework.WeChat.MiniProgram; - -namespace Yi.Framework.DigitalCollectibles.Domain -{ - [DependsOn( - typeof(YiFrameworkDigitalCollectiblesDomainSharedModule), - - typeof(YiFrameworkWeChatMiniProgramModule), - typeof(YiFrameworkSettingManagementDomainModule), - typeof(YiFrameworkMapsterModule), - typeof(AbpDddDomainModule), - typeof(AbpCachingModule) - )] - public class YiFrameworkDigitalCollectiblesDomainModule : AbpModule - { - - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.SqlSugarCore/Yi.Framework.DigitalCollectibles.SqlSugarCore.csproj b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.SqlSugarCore/Yi.Framework.DigitalCollectibles.SqlSugarCore.csproj deleted file mode 100644 index 52f1ba49..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.SqlSugarCore/Yi.Framework.DigitalCollectibles.SqlSugarCore.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.SqlSugarCore/YiFrameworkDigitalCollectiblesSqlSugarCoreModule.cs b/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.SqlSugarCore/YiFrameworkDigitalCollectiblesSqlSugarCoreModule.cs deleted file mode 100644 index 01bf8331..00000000 --- a/Yi.Abp.Net8/module/digital-collectibles/Yi.Framework.DigitalCollectibles.SqlSugarCore/YiFrameworkDigitalCollectiblesSqlSugarCoreModule.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Yi.Framework.DigitalCollectibles.Domain; -using Yi.Framework.Mapster; -using Yi.Framework.SettingManagement.SqlSugarCore; -using Yi.Framework.SqlSugarCore; - -namespace Yi.Framework.DigitalCollectibles.SqlsugarCore -{ - [DependsOn( - typeof(YiFrameworkDigitalCollectiblesDomainModule), - typeof(YiFrameworkSettingManagementSqlSugarCoreModule), - typeof(YiFrameworkMapsterModule), - typeof(YiFrameworkSqlSugarCoreModule) - )] - public class YiFrameworkDigitalCollectiblesSqlSugarCoreModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs index 2e396c5b..1350c1eb 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/AccountService.cs @@ -5,11 +5,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Distributed; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using SqlSugar; -using Volo.Abp; using Volo.Abp.Application.Services; using Volo.Abp.Authorization; using Volo.Abp.Caching; @@ -17,8 +13,6 @@ using Volo.Abp.EventBus.Local; using Volo.Abp.Guids; using Volo.Abp.Uow; using Volo.Abp.Users; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; using Yi.Framework.Rbac.Application.Contracts.Dtos.Account; using Yi.Framework.Rbac.Application.Contracts.IServices; using Yi.Framework.Rbac.Domain.Entities; @@ -519,9 +513,9 @@ namespace Yi.Framework.Rbac.Application.Services entity.Icon = input.Icon; await _userRepository.UpdateAsync(entity); - //发布更新头像任务事件 - await this.LocalEventBus.PublishAsync( - new AssignmentEventArgs(AssignmentRequirementTypeEnum.UpdateIcon, userId), false); + // //发布更新头像任务事件 + // await this.LocalEventBus.PublishAsync( + // new AssignmentEventArgs(AssignmentRequirementTypeEnum.UpdateIcon, userId), false); return true; } } diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs index a7d7c2e2..51146ffd 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs @@ -1,22 +1,19 @@ using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; using Volo.Abp.EventBus.Local; using Volo.Abp.Users; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.Bbs.Domain.Shared.Etos; using Yi.Framework.Ddd.Application; using Yi.Framework.Rbac.Application.Contracts.Dtos.User; using Yi.Framework.Rbac.Application.Contracts.IServices; using Yi.Framework.Rbac.Domain.Authorization; using Yi.Framework.Rbac.Domain.Entities; +using Yi.Framework.Rbac.Domain.Entities.ValueObjects; using Yi.Framework.Rbac.Domain.Managers; using Yi.Framework.Rbac.Domain.Repositories; using Yi.Framework.Rbac.Domain.Shared.Caches; using Yi.Framework.Rbac.Domain.Shared.Consts; -using Yi.Framework.Rbac.Domain.Shared.Etos; using Yi.Framework.Rbac.Domain.Shared.OperLog; using Yi.Framework.SqlSugarCore.Abstractions; @@ -91,7 +88,7 @@ namespace Yi.Framework.Rbac.Application.Services.System protected override UserAggregateRoot MapToEntity(UserCreateInputVo createInput) { var output = base.MapToEntity(createInput); - output.EncryPassword = new Domain.Entities.ValueObjects.EncryPasswordValueObject(createInput.Password); + output.EncryPassword = new EncryPasswordValueObject(createInput.Password); return output; } @@ -186,12 +183,12 @@ namespace Yi.Framework.Rbac.Application.Services.System await _repository.UpdateAsync(entity); var dto = await MapToGetOutputDtoAsync(entity); //发布更新昵称任务事件 - if (input.Nick != entity.Icon) - { - await this.LocalEventBus.PublishAsync( - new AssignmentEventArgs(AssignmentRequirementTypeEnum.UpdateNick, _currentUser.GetId(), input.Nick), - false); - } + // if (input.Nick != entity.Icon) + // { + // await this.LocalEventBus.PublishAsync( + // new AssignmentEventArgs(AssignmentRequirementTypeEnum.UpdateNick, _currentUser.GetId(), input.Nick), + // false); + // } return dto; } diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/DictionaryDataSeed.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/DictionaryDataSeed.cs index f1ce8c9f..8657a9e0 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/DictionaryDataSeed.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/DataSeeds/DictionaryDataSeed.cs @@ -253,7 +253,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds State = true, ListClass = "info" }; - entities.Add(dictInfo14); + entities.Add(dictInfo14_2); DictionaryEntity dictInfo15_2 = new DictionaryEntity() { @@ -266,7 +266,7 @@ namespace Yi.Framework.Rbac.SqlSugarCore.DataSeeds State = true, ListClass = "primary" }; - entities.Add(dictInfo15); + entities.Add(dictInfo15_2); DictionaryEntity dictInfo16 = new DictionaryEntity() { diff --git a/Yi.Abp.Net8/module/stock/Yi.Framework.Stock.Application/Services/StockMarketService.cs b/Yi.Abp.Net8/module/stock/Yi.Framework.Stock.Application/Services/StockMarketService.cs deleted file mode 100644 index e69de29b..00000000 diff --git a/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/Yi.Abp.Application.Contracts.csproj b/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/Yi.Abp.Application.Contracts.csproj index 0c0cd33e..1a268fe6 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/Yi.Abp.Application.Contracts.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/Yi.Abp.Application.Contracts.csproj @@ -3,8 +3,6 @@ - - diff --git a/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/YiAbpApplicationContractsModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/YiAbpApplicationContractsModule.cs index 42fc4229..5b1982f9 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/YiAbpApplicationContractsModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Application.Contracts/YiAbpApplicationContractsModule.cs @@ -1,7 +1,5 @@ using Volo.Abp.SettingManagement; using Yi.Abp.Domain.Shared; -using Yi.Framework.Bbs.Application.Contracts; -using Yi.Framework.ChatHub.Application.Contracts; using Yi.Framework.Ddd.Application.Contracts; using Yi.Framework.Rbac.Application.Contracts; using Yi.Framework.TenantManagement.Application.Contracts; @@ -12,8 +10,6 @@ namespace Yi.Abp.Application.Contracts typeof(YiAbpDomainSharedModule), typeof(YiFrameworkRbacApplicationContractsModule), - typeof(YiFrameworkBbsApplicationContractsModule), - typeof(YiFrameworkChatHubApplicationContractsModule), typeof(AbpSettingManagementApplicationContractsModule), typeof(YiFrameworkTenantManagementApplicationContractsModule), diff --git a/Yi.Abp.Net8/src/Yi.Abp.Application/Services/TestService.cs b/Yi.Abp.Net8/src/Yi.Abp.Application/Services/TestService.cs index 2f709936..04c6dc05 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Application/Services/TestService.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Application/Services/TestService.cs @@ -1,17 +1,14 @@ -using System.Xml.Linq; -using Mapster; +using Mapster; using Medallion.Threading; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.RateLimiting; using Volo.Abp.Application.Services; using Volo.Abp.DistributedLocking; using Volo.Abp.Domain.Repositories; using Volo.Abp.MultiTenancy; using Volo.Abp.Settings; using Volo.Abp.Uow; -using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner; -using Yi.Framework.Bbs.Domain.Entities.Forum; using Yi.Framework.Rbac.Domain.Authorization; +using Yi.Framework.Rbac.Domain.Entities; using Yi.Framework.Rbac.Domain.Extensions; using Yi.Framework.SettingManagement.Domain; using Yi.Framework.SqlSugarCore.Abstractions; @@ -23,11 +20,11 @@ namespace Yi.Abp.Application.Services /// public class TestService : ApplicationService { - /// - /// 属性注入 - /// 不推荐,坑太多,容易把自己玩死,简单的东西可以用一用 - /// - public ISqlSugarRepository sqlSugarRepository { get; set; } + // /// + // /// 属性注入 + // /// 不推荐,坑太多,容易把自己玩死,简单的东西可以用一用 + // /// + public ISqlSugarRepository sqlSugarRepository { get; set; } /// /// @@ -86,11 +83,11 @@ namespace Yi.Abp.Application.Services //await sqlSugarRepository.InsertAsync(new BannerAggregateRoot { Name = "插入2" }); using (var uow = UnitOfWorkManager.Begin(requiresNew: true, isTransactional: true)) { - await sqlSugarRepository.InsertAsync(new BannerAggregateRoot { Name = "插入1" }); + await sqlSugarRepository.InsertAsync(new ConfigAggregateRoot { ConfigKey = "插入1" }); await uow.CompleteAsync(); } })); - await sqlSugarRepository.InsertAsync(new BannerAggregateRoot { Name = "插入3" }); + await sqlSugarRepository.InsertAsync(new ConfigAggregateRoot { ConfigKey = "插入3" }); i--; } @@ -136,8 +133,8 @@ namespace Yi.Abp.Application.Services public void GetMapper() { //直接无脑Adapt,无需配置 - var entity = new BannerAggregateRoot(); - var dto = entity.Adapt(); + var entity = new ConfigAggregateRoot(); + var dto = entity.Adapt(); } private static int RequestNumber { get; set; } = 0; @@ -218,7 +215,7 @@ namespace Yi.Abp.Application.Services } public ICurrentTenant CurrentTenant { get; set; } - public IRepository repository { get; set; } + public IRepository repository { get; set; } /// /// 多租户 /// @@ -232,31 +229,31 @@ namespace Yi.Abp.Application.Services using (CurrentTenant.Change(null,"Default")) { var defautTenantData2= await repository.GetListAsync(); - await repository.InsertAsync(new BannerAggregateRoot + await repository.InsertAsync(new ConfigAggregateRoot { - Name = "default", + ConfigKey = "default", }); - var defautTenantData3= await repository.GetListAsync(x=>x.Name=="default"); + var defautTenantData3= await repository.GetListAsync(x=>x.ConfigKey=="default"); } //此处会实例化一个新的db连接MES using (CurrentTenant.Change(null,"Mes")) { var otherTenantData1= await repository.GetListAsync(); - await repository.InsertAsync(new BannerAggregateRoot + await repository.InsertAsync(new ConfigAggregateRoot { - Name = "Mes1", + ConfigKey = "Mes1", }); - var otherTenantData2= await repository.GetListAsync(x=>x.Name=="Mes1"); + var otherTenantData2= await repository.GetListAsync(x=>x.ConfigKey=="Mes1"); } //此处会复用Mesdb,不会实例化新的db using (CurrentTenant.Change(Guid.Parse("33333333-3d72-4339-9adc-845151f8ada0"))) { var otherTenantData1= await repository.GetListAsync(); - await repository.InsertAsync(new BannerAggregateRoot + await repository.InsertAsync(new ConfigAggregateRoot { - Name = "Mes2", + ConfigKey = "Mes2", }); - var otherTenantData2= await repository.GetListAsync(x=>x.Name=="Mes2"); + var otherTenantData2= await repository.GetListAsync(x=>x.ConfigKey=="Mes2"); } //此处会将多库进行一起提交,前面的操作有报错,全部回滚 await uow.CompleteAsync(); diff --git a/Yi.Abp.Net8/src/Yi.Abp.Application/Yi.Abp.Application.csproj b/Yi.Abp.Net8/src/Yi.Abp.Application/Yi.Abp.Application.csproj index 97b45b8c..68392ee2 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Application/Yi.Abp.Application.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.Application/Yi.Abp.Application.csproj @@ -4,13 +4,8 @@ - - - - - diff --git a/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs index f3a523b6..3bbed85a 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Application/YiAbpApplicationModule.cs @@ -1,14 +1,8 @@ -using Volo.Abp.SettingManagement; -using Yi.Abp.Application.Contracts; +using Yi.Abp.Application.Contracts; using Yi.Abp.Domain; -using Yi.Framework.Bbs.Application; -using Yi.Framework.ChatHub.Application; -using Yi.Framework.CodeGen.Application; using Yi.Framework.Ddd.Application; -using Yi.Framework.DigitalCollectibles.Application; using Yi.Framework.Rbac.Application; using Yi.Framework.SettingManagement.Application; -using Yi.Framework.Stock.Application; using Yi.Framework.TenantManagement.Application; namespace Yi.Abp.Application @@ -19,13 +13,8 @@ namespace Yi.Abp.Application typeof(YiFrameworkRbacApplicationModule), - typeof(YiFrameworkBbsApplicationModule), - typeof(YiFrameworkDigitalCollectiblesApplicationModule), - typeof(YiFrameworkChatHubApplicationModule), - typeof(YiFrameworkStockApplicationModule), typeof(YiFrameworkTenantManagementApplicationModule), - typeof(YiFrameworkCodeGenApplicationModule), typeof (YiFrameworkSettingManagementApplicationModule), typeof(YiFrameworkDddApplicationModule) diff --git a/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/Yi.Abp.Domain.Shared.csproj b/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/Yi.Abp.Domain.Shared.csproj index a282e13a..0c165972 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/Yi.Abp.Domain.Shared.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/Yi.Abp.Domain.Shared.csproj @@ -7,8 +7,6 @@ - - diff --git a/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/YiAbpDomainSharedModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/YiAbpDomainSharedModule.cs index bab6b8ef..cbe0cae6 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/YiAbpDomainSharedModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Domain.Shared/YiAbpDomainSharedModule.cs @@ -1,16 +1,12 @@ using Volo.Abp.Domain; using Volo.Abp.SettingManagement; using Yi.Framework.AuditLogging.Domain.Shared; -using Yi.Framework.Bbs.Domain.Shared; -using Yi.Framework.ChatHub.Domain.Shared; using Yi.Framework.Rbac.Domain.Shared; namespace Yi.Abp.Domain.Shared { [DependsOn( typeof(YiFrameworkRbacDomainSharedModule), - typeof(YiFrameworkBbsDomainSharedModule), - typeof(YiFrameworkChatHubDomainSharedModule), typeof(YiFrameworkAuditLoggingDomainSharedModule), typeof(AbpSettingManagementDomainSharedModule), diff --git a/Yi.Abp.Net8/src/Yi.Abp.Domain/Yi.Abp.Domain.csproj b/Yi.Abp.Net8/src/Yi.Abp.Domain/Yi.Abp.Domain.csproj index a7e6fbff..570113c4 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Domain/Yi.Abp.Domain.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.Domain/Yi.Abp.Domain.csproj @@ -10,8 +10,6 @@ - - diff --git a/Yi.Abp.Net8/src/Yi.Abp.Domain/YiAbpDomainModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Domain/YiAbpDomainModule.cs index d49c75ba..348a21f2 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Domain/YiAbpDomainModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Domain/YiAbpDomainModule.cs @@ -1,10 +1,7 @@ using Volo.Abp.Caching; using Volo.Abp.Domain; -using Volo.Abp.Modularity; using Yi.Abp.Domain.Shared; using Yi.Framework.AuditLogging.Domain; -using Yi.Framework.Bbs.Domain; -using Yi.Framework.ChatHub.Domain; using Yi.Framework.Mapster; using Yi.Framework.Rbac.Domain; using Yi.Framework.SettingManagement.Domain; @@ -17,8 +14,6 @@ namespace Yi.Abp.Domain typeof(YiFrameworkTenantManagementDomainModule), typeof(YiFrameworkRbacDomainModule), - typeof(YiFrameworkBbsDomainModule), - typeof(YiFrameworkChatHubDomainModule), typeof(YiFrameworkAuditLoggingDomainModule), typeof(YiFrameworkSettingManagementDomainModule), diff --git a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj index d6aec39f..3abdbb9e 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj +++ b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/Yi.Abp.SqlSugarCore.csproj @@ -5,10 +5,6 @@ - - - - diff --git a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs index d61b3fa1..73de859b 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiAbpSqlSugarCoreModule.cs @@ -1,18 +1,10 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Modularity; -using Yi.Abp.Domain; +using Yi.Abp.Domain; using Yi.Abp.SqlSugarCore; using Yi.Framework.AuditLogging.SqlSugarCore; -using Yi.Framework.Bbs.SqlSugarCore; -using Yi.Framework.ChatHub.SqlSugarCore; -using Yi.Framework.CodeGen.SqlSugarCore; -using Yi.Framework.DigitalCollectibles.SqlsugarCore; using Yi.Framework.Mapster; using Yi.Framework.Rbac.SqlSugarCore; using Yi.Framework.SettingManagement.SqlSugarCore; using Yi.Framework.SqlSugarCore; -using Yi.Framework.SqlSugarCore.Abstractions; -using Yi.Framework.Stock.SqlsugarCore; using Yi.Framework.TenantManagement.SqlSugarCore; namespace Yi.Abp.SqlsugarCore @@ -20,11 +12,6 @@ namespace Yi.Abp.SqlsugarCore [DependsOn( typeof(YiAbpDomainModule), typeof(YiFrameworkRbacSqlSugarCoreModule), - typeof(YiFrameworkDigitalCollectiblesSqlSugarCoreModule), - typeof(YiFrameworkBbsSqlSugarCoreModule), - typeof(YiFrameworkCodeGenSqlSugarCoreModule), - typeof(YiFrameworkChatHubSqlSugarCoreModule), - typeof(YiFrameworkStockSqlSugarCoreModule), typeof(YiFrameworkSettingManagementSqlSugarCoreModule), typeof(YiFrameworkAuditLoggingSqlSugarCoreModule), typeof(YiFrameworkTenantManagementSqlSugarCoreModule), diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/ai-stock/GenerateNewsJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/ai-stock/GenerateNewsJob.cs deleted file mode 100644 index 23e6e31e..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/ai-stock/GenerateNewsJob.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.Stock.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.ai_stock -{ - public class GenerateNewsJob : HangfireBackgroundWorkerBase - { - private NewsManager _newsManager; - - public GenerateNewsJob(NewsManager newsManager) - { - _newsManager = newsManager; - - RecurringJobId = "AI股票新闻生成"; - //每个小时整点执行一次 - CronExpression = "0 0 * * * ?"; - } - - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - // 每次触发只有2/24的概率执行生成新闻 - var random = new Random(); - var probability = random.Next(0, 24); - - if (probability < 2) - { - await _newsManager.GenerateNewsAsync(); - } - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/ai-stock/GenerateStockPricesJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/ai-stock/GenerateStockPricesJob.cs deleted file mode 100644 index 9e820796..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/ai-stock/GenerateStockPricesJob.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.Stock.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.ai_stock -{ - public class GenerateStockPricesJob : HangfireBackgroundWorkerBase - { - private readonly StockMarketManager _stockMarketManager; - - public GenerateStockPricesJob(StockMarketManager stockMarketManager) - { - _stockMarketManager = stockMarketManager; - - RecurringJobId = "AI股票价格生成"; - //每天凌晨1点执行一次 - CronExpression = "0 0 1 * * ?"; - } - - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - await _stockMarketManager.GenerateStocksAsync(); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AccessLogCacheJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AccessLogCacheJob.cs deleted file mode 100644 index 9ca90b0a..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AccessLogCacheJob.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.EventBus.Local; -using Yi.Framework.Bbs.Domain.Shared.Etos; - -namespace Yi.Abp.Web.Jobs.bbs; - -public class AccessLogCacheJob : HangfireBackgroundWorkerBase -{ - private readonly ILocalEventBus _localEventBus; - - public AccessLogCacheJob(ILocalEventBus localEventBus) - { - _localEventBus = localEventBus; - RecurringJobId = "访问日志写入缓存"; - //每分钟执行一次,将本地缓存转入redis,防止丢数据 - CronExpression = "0 * * * * ?"; - // - // JobDetail = JobBuilder.Create().WithIdentity(nameof(AccessLogCacheJob)) - // .Build(); - - //每10秒执行一次,将本地缓存转入redis,防止丢数据 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(AccessLogCacheJob)) - // .WithSimpleSchedule((schedule) => { schedule.WithInterval(TimeSpan.FromSeconds(10)).RepeatForever();; }) - // .Build(); - } - - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - await _localEventBus.PublishAsync(new AccessLogResetArgs()); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AccessLogStoreJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AccessLogStoreJob.cs deleted file mode 100644 index 29f94f1a..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AccessLogStoreJob.cs +++ /dev/null @@ -1,89 +0,0 @@ -using FreeRedis; -using Microsoft.Extensions.Options; -using Volo.Abp.BackgroundWorkers.Hangfire; -using Volo.Abp.Caching; -using Volo.Abp.DependencyInjection; -using Yi.Framework.Bbs.Domain.Entities; -using Yi.Framework.Bbs.Domain.Shared.Caches; -using Yi.Framework.Bbs.Domain.Shared.Enums; -using Yi.Framework.SqlSugarCore.Abstractions; - -namespace Yi.Abp.Web.Jobs.bbs; - -public class AccessLogStoreJob : HangfireBackgroundWorkerBase -{ - private readonly ISqlSugarRepository _repository; - - /// - /// 缓存前缀 - /// - private string CacheKeyPrefix => LazyServiceProvider.LazyGetRequiredService>() - .Value.KeyPrefix; - - /// - /// 使用懒加载防止报错 - /// - private IRedisClient RedisClient => LazyServiceProvider.LazyGetRequiredService(); - - /// - /// 属性注入 - /// - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } - - private bool EnableRedisCache - { - get - { - var redisEnabled = LazyServiceProvider.LazyGetRequiredService()["Redis:IsEnabled"]; - return redisEnabled.IsNullOrEmpty() || bool.Parse(redisEnabled); - } - } - - public AccessLogStoreJob(ISqlSugarRepository repository) - { - _repository = repository; - - - RecurringJobId = "访问日志写入数据库"; - //每小时执行一次 - CronExpression = "0 0 * * * ?"; - // JobDetail = JobBuilder.Create().WithIdentity(nameof(AccessLogStoreJob)) - // .Build(); - // //每分钟执行一次 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(AccessLogStoreJob)) - // .WithCronSchedule("0 * * * * ?") - // .Build(); - - - } - - - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - if (EnableRedisCache) - { - //当天的访问量 - var number = - await RedisClient.GetAsync($"{CacheKeyPrefix}{AccessLogCacheConst.Key}:{DateTime.Now.Date:yyyyMMdd}"); - - - var entity = await _repository._DbQueryable.Where(x => x.AccessLogType == AccessLogTypeEnum.Request) - .Where(x => x.CreationTime.Date == DateTime.Today) - .FirstAsync(); - - - if (entity is not null) - { - entity.Number = number+1; - await _repository.UpdateAsync(entity); - } - else - { - await _repository.InsertAsync((new AccessLogAggregateRoot() { Number = number,AccessLogType = AccessLogTypeEnum.Request})); - } - - //删除前一天的缓存 - await RedisClient.DelAsync($"{CacheKeyPrefix}{AccessLogCacheConst.Key}:{DateTime.Now.Date.AddDays(-1):yyyyMMdd}"); - } - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AssignmentExpireTimeOutJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AssignmentExpireTimeOutJob.cs deleted file mode 100644 index aaff6f3a..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/AssignmentExpireTimeOutJob.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.Bbs.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.bbs; - -/// -/// 每日任务job -/// -public class AssignmentExpireTimeOutJob : HangfireBackgroundWorkerBase -{ - private readonly AssignmentManager _assignmentManager; - - public AssignmentExpireTimeOutJob(AssignmentManager assignmentManager) - { - _assignmentManager = assignmentManager; - - RecurringJobId = "每日任务系统超时检测"; - //每分钟执行一次 - CronExpression = "0 * * * * ?"; - // - // JobDetail = JobBuilder.Create().WithIdentity(nameof(AssignmentExpireTimeOutJob)).Build(); - // //每个小时整点执行一次 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(AssignmentExpireTimeOutJob)).WithCronSchedule("0 0 * * * ?") - // .Build(); - } - - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - await _assignmentManager.ExpireTimeoutAsync(); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/InterestRecordsJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/InterestRecordsJob.cs deleted file mode 100644 index 052c7e82..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/bbs/InterestRecordsJob.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.Bbs.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.bbs -{ - public class InterestRecordsJob : HangfireBackgroundWorkerBase - { - private BankManager _bankManager; - public InterestRecordsJob(BankManager bankManager) - { - _bankManager = bankManager; - - RecurringJobId = "银行利息积分刷新"; - //每个小时整点执行一次 - CronExpression = "0 0 * * * ?"; - - // JobDetail = JobBuilder.Create().WithIdentity(nameof(InterestRecordsJob)).Build(); - // - // //每个小时整点执行一次 - // - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)).WithCronSchedule("0 0 * * * ?").Build(); - - //测试 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(InterestRecordsJob)) - //.WithSimpleSchedule(x => x - // .WithIntervalInSeconds(10) - // .RepeatForever()) - //.Build(); - } - - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - //创建一个记录,莫得了 - await _bankManager.GetCurrentInterestRate(); - } - } -} diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoPassInGoodsJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoPassInGoodsJob.cs deleted file mode 100644 index 03ff06d0..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoPassInGoodsJob.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.DigitalCollectibles.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.digital_collectibles; -/// -/// 自动下架商品 -/// -public class AutoPassInGoodsJob: HangfireBackgroundWorkerBase -{ - private readonly MarketManager _marketManager; - private readonly ILogger _logger; - public AutoPassInGoodsJob(MarketManager marketManager, ILogger logger) - { - _marketManager = marketManager; - _logger = logger; - RecurringJobId = "交易市场自动流拍"; - //每小时,第10分钟执行一次 - CronExpression = "0 10 * * * ?"; - // - // JobDetail = JobBuilder.Create().WithIdentity(nameof(AutoPassInGoodsJob)) - // .Build(); - // - // //每小时,第10分钟执行一次 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoPassInGoodsJob)) - // // .WithSimpleSchedule((builer) => - // // { - // // builer.WithIntervalInHours(10); - // // }) - // // .StartNow() - // .WithCronSchedule("0 10 * * * ?") - // .Build(); - } - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - await _marketManager.AutoPassInGoodsAsync(); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoRefreshMiningPoolJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoRefreshMiningPoolJob.cs deleted file mode 100644 index f5cb4efa..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoRefreshMiningPoolJob.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.DigitalCollectibles.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.digital_collectibles; - -/// -/// 自动刷新填满矿池 -/// -public class AutoRefreshMiningPoolJob : HangfireBackgroundWorkerBase -{ - private readonly MiningPoolManager _miningPoolManager; - - public AutoRefreshMiningPoolJob(MiningPoolManager miningPoolManager) - { - _miningPoolManager = miningPoolManager; - - RecurringJobId = "刷新矿池和用户限制"; - //每天早上10点执行一次 - CronExpression = "0 0 10 * * ?"; - // - // JobDetail = JobBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob)) - // .Build(); - // - // //每天早上10点执行一次 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob)) - // .WithCronSchedule("0 0 10 * * ?") - // .Build(); - // - - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(AutoRefreshMiningPoolJob)) - // .WithSimpleSchedule((schedule) => - // { - // schedule.WithInterval(TimeSpan.FromHours(1)); - // }) - // .StartNow() - // .Build(); - } - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - - //刷新矿池 - await _miningPoolManager.RefreshMiningPoolAsync(); - //刷新用户限制 - await _miningPoolManager.RefreshMiningUserLimitAsync(); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoUpdateCollectiblesValueJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoUpdateCollectiblesValueJob.cs deleted file mode 100644 index 46b52d98..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/AutoUpdateCollectiblesValueJob.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.DigitalCollectibles.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.digital_collectibles; - -/// -/// 自动更新藏品价值 -/// -public class AutoUpdateCollectiblesValueJob : HangfireBackgroundWorkerBase -{ - private readonly CollectiblesManager _collectiblesManager; - - public AutoUpdateCollectiblesValueJob(CollectiblesManager collectiblesManager) - { - _collectiblesManager = collectiblesManager; - RecurringJobId = "更新藏品价值"; - //每天早上9点执行一次 - CronExpression = "0 0 9 * * ?"; - } - - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - await _collectiblesManager.UpdateAllValueAsync(); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/OnHookAutoMiningJob.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/OnHookAutoMiningJob.cs deleted file mode 100644 index 6df2f6cf..00000000 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Jobs/digital-collectibles/OnHookAutoMiningJob.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Volo.Abp.BackgroundWorkers.Hangfire; -using Yi.Framework.DigitalCollectibles.Domain.Managers; - -namespace Yi.Abp.Web.Jobs.digital_collectibles; - -/// -/// 处理挂机挖矿定时任务 -/// -public class OnHookAutoMiningJob : HangfireBackgroundWorkerBase -{ - private readonly MiningPoolManager _miningPoolManager; - private readonly ILogger _logger; - - public OnHookAutoMiningJob(MiningPoolManager miningPoolManager, ILogger logger) - { - _miningPoolManager = miningPoolManager; - _logger = logger; - - RecurringJobId = "自动挂机挖矿"; - //每小时执行一次 - CronExpression = "0 0 * * * ?"; - // - // JobDetail = JobBuilder.Create().WithIdentity(nameof(OnHookAutoMiningJob)) - // .Build(); - // - // //每小时执行一次 - // Trigger = TriggerBuilder.Create().WithIdentity(nameof(OnHookAutoMiningJob)) - // // .WithCronSchedule("10 * * * * ?") - // .WithCronSchedule("0 0 * * * ?") - // .Build(); - } - public override async Task DoWorkAsync(CancellationToken cancellationToken = new CancellationToken()) - { - await _miningPoolManager.OnHookMiningAsync(); - } -} \ No newline at end of file diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs index d2eaf090..26827236 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/YiAbpWebModule.cs @@ -9,10 +9,7 @@ using Hangfire.Redis.StackExchange; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.StaticFiles; -using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using Microsoft.OpenApi.Models; using StackExchange.Redis; @@ -23,10 +20,8 @@ using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.AntiForgery; using Volo.Abp.AspNetCore.Serilog; -using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.Auditing; using Volo.Abp.Autofac; -using Volo.Abp.BackgroundJobs.Hangfire; using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching; using Volo.Abp.MultiTenancy; @@ -41,17 +36,11 @@ using Yi.Framework.AspNetCore.Microsoft.AspNetCore.Builder; using Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection; using Yi.Framework.AspNetCore.UnifyResult; using Yi.Framework.BackgroundWorkers.Hangfire; -using Yi.Framework.Bbs.Application; -using Yi.Framework.Bbs.Application.Extensions; -using Yi.Framework.ChatHub.Application; -using Yi.Framework.CodeGen.Application; using Yi.Framework.Core.Json; -using Yi.Framework.DigitalCollectibles.Application; using Yi.Framework.Rbac.Application; using Yi.Framework.Rbac.Domain.Authorization; using Yi.Framework.Rbac.Domain.Shared.Consts; using Yi.Framework.Rbac.Domain.Shared.Options; -using Yi.Framework.Stock.Application; using Yi.Framework.TenantManagement.Application; namespace Yi.Abp.Web @@ -85,18 +74,8 @@ namespace Yi.Abp.Web options => options.RemoteServiceName = "default"); options.ConventionalControllers.Create(typeof(YiFrameworkRbacApplicationModule).Assembly, options => options.RemoteServiceName = "rbac"); - options.ConventionalControllers.Create(typeof(YiFrameworkBbsApplicationModule).Assembly, - options => options.RemoteServiceName = "bbs"); - options.ConventionalControllers.Create(typeof(YiFrameworkChatHubApplicationModule).Assembly, - options => options.RemoteServiceName = "chat-hub"); options.ConventionalControllers.Create(typeof(YiFrameworkTenantManagementApplicationModule).Assembly, options => options.RemoteServiceName = "tenant-management"); - options.ConventionalControllers.Create(typeof(YiFrameworkCodeGenApplicationModule).Assembly, - options => options.RemoteServiceName = "code-gen"); - options.ConventionalControllers.Create(typeof(YiFrameworkDigitalCollectiblesApplicationModule).Assembly, - options => options.RemoteServiceName = "digital-collectibles"); - options.ConventionalControllers.Create(typeof(YiFrameworkStockApplicationModule).Assembly, - options => options.RemoteServiceName = "ai-stock"); //统一前缀 options.ConventionalControllers.ConventionalControllerSettings.ForEach(x => x.RootPath = "api/app"); }); @@ -374,10 +353,7 @@ namespace Yi.Abp.Web //swagger app.UseYiSwagger(); - - //流量访问统计,需redis支持,否则不生效 - app.UseAccessLog(); - + //请求处理 app.UseApiInfoHandling(); diff --git a/Yi.Vben5.Vue3/apps/web-antd/.env.development b/Yi.Vben5.Vue3/apps/web-antd/.env.development index bf40e3e6..9c7b1b5f 100644 --- a/Yi.Vben5.Vue3/apps/web-antd/.env.development +++ b/Yi.Vben5.Vue3/apps/web-antd/.env.development @@ -1,5 +1,5 @@ # 端口号 -VITE_PORT=5666 +VITE_PORT=17001 VITE_BASE=/ # 是否开启 Nitro Mock服务,true 为开启,false 为关闭 @@ -10,7 +10,8 @@ VITE_DEVTOOLS=false VITE_INJECT_APP_LOADING=true # 后台请求路径 具体在vite.config.mts配置代理 -VITE_GLOB_API_URL=http://localhost:19001/api/app +VITE_GLOB_API_URL="/dev-api" +VITE_APP_URL="http://localhost:19001/api/app" # 全局加密开关(即开启了加解密功能才会生效 不是全部接口加密 需要和后端对应) VITE_GLOB_ENABLE_ENCRYPT=false diff --git a/Yi.Vben5.Vue3/apps/web-antd/.env.production b/Yi.Vben5.Vue3/apps/web-antd/.env.production index 40f2fd1c..83704c7d 100644 --- a/Yi.Vben5.Vue3/apps/web-antd/.env.production +++ b/Yi.Vben5.Vue3/apps/web-antd/.env.production @@ -16,8 +16,7 @@ VITE_INJECT_APP_LOADING=true VITE_ARCHIVER=true # 后端接口地址 -# VITE_GLOB_API_URL=/prod-api -VITE_GLOB_API_URL=https://yiapi.wjys.top/api +VITE_GLOB_API_URL=/prod-api # 全局加密开关(即开启了加解密功能才会生效 不是全部接口加密 需要和后端对应) VITE_GLOB_ENABLE_ENCRYPT=false diff --git a/Yi.Vben5.Vue3/apps/web-antd/vite.config.mts b/Yi.Vben5.Vue3/apps/web-antd/vite.config.mts index 0d69a721..3a46524e 100644 --- a/Yi.Vben5.Vue3/apps/web-antd/vite.config.mts +++ b/Yi.Vben5.Vue3/apps/web-antd/vite.config.mts @@ -1,10 +1,11 @@ import { defineConfig } from '@vben/vite-config'; - +import { loadEnv } from "vite"; // 自行取消注释来启用按需导入功能 // import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'; // import Components from 'unplugin-vue-components/vite'; -export default defineConfig(async () => { +export default defineConfig(async ({ command, mode }) => { + const env = loadEnv(mode, process.cwd(), ""); return { application: {}, vite: { @@ -23,12 +24,33 @@ export default defineConfig(async () => { ], server: { proxy: { - '/api': { + [env.VITE_GLOB_API_URL]: { + target: env.VITE_APP_URL, changeOrigin: true, - rewrite: (path) => path.replace(/^\/api/, ''), - // mock代理目标地址 - target: 'http://localhost:19001/api/app', + rewrite: (path) => path.replace(`${[env.VITE_GLOB_API_URL]}`, ""), + + //查看真实代理url + bypass(req, res, options) { + const proxyUrl = options.target + options.rewrite(req.url); + console.log(proxyUrl); + req.headers['X-req-proxyURL'] = proxyUrl; + res.setHeader('X-req-proxyURL', proxyUrl); + } + }, + [env.VITE_APP_BASE_WS]: { + target: env.VITE_APP_BASE_URL_WS, + changeOrigin: true, + rewrite: (p) => p.replace( `${[env.VITE_APP_BASE_WS]}`, ""), ws: true, + //查看真实代理url + bypass(req, res, options) { + + const proxyUrl = options.target + options.rewrite(req.url); + // console.log(proxyUrl); + req.headers['X-req-proxyURL'] = proxyUrl; + res.setHeader('X-req-proxyURL', proxyUrl); + + } }, }, },