├── .gitignore
├── Document
├── 工程结构图.xmind
└── 工程结构架构图.png
├── Test
├── Ccshis.ConsulExtend.Test
│ ├── ComponentServiceExtendUnitTest.cs
│ ├── Ccshis.ServiceDiscovery.ConsulExtend.Test.csproj.user
│ ├── Ccshis.ServiceDiscovery.ConsulExtend.Test.csproj
│ └── DefaultConfiguationServiceTest.cs
├── BaseTest
│ ├── BaseTestClass.cs
│ └── BaseTest.csproj
└── Ccshis.Information.Sms.Ali.Test
│ └── Ccshis.Information.Sms.Ali.Test.csproj
├── Infrastructure
├── Component
│ ├── Ccshis.Aliyun
│ │ └── Ccshis.Aliyun.LogExtend
│ │ │ ├── AliyunLogSetting.cs
│ │ │ ├── AliYunLogAppend.cs
│ │ │ ├── Ccshis.Aliyun.LogExtend.csproj
│ │ │ └── ComponentServiceExtend.cs
│ ├── Ccshis.ConsulExtend
│ │ ├── IConsulServices.cs
│ │ ├── Ccshis.ConsulComponent.csproj
│ │ ├── IConsulSetting.cs
│ │ ├── ConsulServerSetting.cs
│ │ ├── MicServerSetting.cs
│ │ ├── ConsulConfigurationService.cs
│ │ ├── HealthCheckSetting.cs
│ │ └── ComponentServiceExtend.cs
│ ├── Ccshis.Component
│ │ ├── Information
│ │ │ ├── EmaiInformation.cs
│ │ │ ├── IEmailSenderService.cs
│ │ │ └── ComponentServiceExtend.cs
│ │ ├── IFileConfigurationService.cs
│ │ ├── Cluster
│ │ │ ├── ServerMember.cs
│ │ │ └── ClusterService.cs
│ │ ├── Ccshis.Component.csproj
│ │ ├── Util
│ │ │ └── IdentifiedGenerateService.cs
│ │ ├── ComponentServiceExtend.cs
│ │ ├── ComponentService.cs
│ │ ├── ComponentContainer.cs
│ │ └── DefaultConfigurationService.cs
│ ├── Ccshis.QuzrtzExtend
│ │ └── Ccshis.QuzrtzExtend.csproj
│ ├── Ccshis.ExceptionlessExtend
│ │ ├── ExceptionlessSetting.cs
│ │ ├── Ccshis.ExceptionlessExtend.csproj
│ │ ├── ComponentServiceExtend.cs
│ │ └── log4net.config
│ └── Ccshis.Information
│ │ └── Ccshis.Information.Sms.Ali
│ │ ├── ISmsSender.cs
│ │ ├── AliApiResult.cs
│ │ ├── Ccshis.Information.Sms.Ali.csproj
│ │ ├── SmsInformation.cs
│ │ ├── ComponentServiceExtend.cs
│ │ └── SmsSender.cs
├── SmsSender
│ ├── SmsSender.cs
│ ├── SmsSender.csproj
│ └── Program.cs
├── Ccshis
│ ├── IServices.cs
│ ├── ISetting.cs
│ ├── Job
│ │ ├── IJob.cs
│ │ └── IJobService.cs
│ ├── Util
│ │ ├── Ensure.cs
│ │ ├── IIdentifiedGenerate.cs
│ │ ├── LocalizationUtil.cs
│ │ └── StringUtil.cs
│ ├── Security
│ │ └── Authorize
│ │ │ ├── IRole.cs
│ │ │ ├── IUser.cs
│ │ │ ├── IHotel.cs
│ │ │ ├── Identity.cs
│ │ │ ├── IOpeartion.cs
│ │ │ ├── IResource.cs
│ │ │ └── IPermission.cs
│ ├── Information
│ │ ├── IInformation.cs
│ │ └── IInformationSender.cs
│ ├── Ccshis.csproj
│ ├── SystemConst.cs
│ ├── IConfigurationService.cs
│ ├── IAggregateRoot.cs
│ ├── Cluster
│ │ ├── Virtualization.cs
│ │ ├── IClusterService.cs
│ │ └── IServerMember.cs
│ ├── IPager.cs
│ ├── AggregateRoot.cs
│ ├── SysException.cs
│ ├── BizException.cs
│ ├── DataException.cs
│ ├── AuthorizeExcpetion.cs
│ ├── CoreException.cs
│ └── IComponentService.cs
└── Infrastructure.sln
├── Shared
├── Ccshis.Shared
│ ├── Topics.cs
│ ├── Ccshis.Shared.csproj
│ ├── Settings
│ │ ├── AliYunApiSetting.cs
│ │ └── Cluster
│ │ │ └── ServerMemberSetting.cs
│ ├── SettingsPath.cs
│ └── Localization.cs
└── Shared.sln
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | obj
3 | .vs
4 | package
--------------------------------------------------------------------------------
/Document/工程结构图.xmind:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cheetahing/Ccshis/HEAD/Document/工程结构图.xmind
--------------------------------------------------------------------------------
/Document/工程结构架构图.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cheetahing/Ccshis/HEAD/Document/工程结构架构图.png
--------------------------------------------------------------------------------
/Test/Ccshis.ConsulExtend.Test/ComponentServiceExtendUnitTest.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cheetahing/Ccshis/HEAD/Test/Ccshis.ConsulExtend.Test/ComponentServiceExtendUnitTest.cs
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Aliyun/Ccshis.Aliyun.LogExtend/AliyunLogSetting.cs:
--------------------------------------------------------------------------------
1 | namespace Ccshis.Aliyun.LogExtend
2 | {
3 | public class AliyunLogSetting
4 | {
5 | }
6 | }
--------------------------------------------------------------------------------
/Infrastructure/SmsSender/SmsSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace SmsSender
6 | {
7 | class SmsSender
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/IServices.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | public interface IServices
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/ISetting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | public interface ISetting
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Job/IJob.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Job
6 | {
7 | public interface IJob
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Util/Ensure.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Util
6 | {
7 | public class Ensure
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Job/IJobService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Job
6 | {
7 | public interface IJobService
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Security/Authorize/IRole.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Security.Authorize
6 | {
7 | public class IRole
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/SmsSender/SmsSender.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp2.1
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Security/Authorize/IUser.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Security.Authorize
6 | {
7 | public interface IUser
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Security/Authorize/IHotel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Security.Authorize
6 | {
7 | public interface IHotel
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Security/Authorize/Identity.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Security.Authorize
6 | {
7 | public interface Identity
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Security/Authorize/IOpeartion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Security.Authorize
6 | {
7 | public interface IOpeartion
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Security/Authorize/IResource.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Security.Authorize
6 | {
7 | public interface IResource
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Security/Authorize/IPermission.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Security.Authorize
6 | {
7 | public interface IPermission
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ConsulExtend/IConsulServices.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.ConsulComponent
6 | {
7 | interface IConsulServices
8 | {
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Component/Information/EmaiInformation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Ccshis.Information.Email
4 | {
5 | public class EmaiInformation : IInformation
6 | {
7 | public string Body { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Infrastructure/SmsSender/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace SmsSender
4 | {
5 | class Program
6 | {
7 | static void Main(string[] args)
8 | {
9 | Console.WriteLine("Hello World!");
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Information/IInformation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Information
6 | {
7 | public interface IInformation
8 | {
9 | string Body { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Util/IIdentifiedGenerate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Util
6 | {
7 | public interface IIdentifiedGenerateService
8 | {
9 | long GetIdentified();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Ccshis.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Test/Ccshis.ConsulExtend.Test/Ccshis.ServiceDiscovery.ConsulExtend.Test.csproj.user:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | true
5 |
6 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/SystemConst.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | public static class SystemConst
8 | {
9 | public const string ValueIsEmpty = "Empty";
10 |
11 | public const string EmptyString = "";
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.QuzrtzExtend/Ccshis.QuzrtzExtend.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Shared/Ccshis.Shared/Topics.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | ///
8 | /// 消息队列订阅主题
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// date:2019-5-20
13 | ///
14 | public class Topics
15 | {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Shared/Ccshis.Shared/Ccshis.Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Ccshis
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/IConfigurationService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 |
6 | namespace Ccshis
7 | {
8 | public interface IConfigurationService
9 | {
10 | Task GetAsync(string key) where T : class, ISetting;
11 |
12 | Task GetAsync(string key);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Component/Information/IEmailSenderService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 |
6 | namespace Ccshis.Information.Email
7 | {
8 | public interface IEmailSenderService
9 | {
10 | Task SendAsync(List receivers, EmaiInformation information);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/IAggregateRoot.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using ENode.Domain;
5 |
6 | namespace Ccshis
7 | {
8 | ///
9 | /// 聚合根接口
10 | /// 直接引用enode框架聚合根接口
11 | ///
12 | ///
13 | ///
14 | public interface IAggregateRoot:ENode.Domain.IAggregateRoot
15 | {
16 | }
17 | }
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Cluster/Virtualization.cs:
--------------------------------------------------------------------------------
1 | namespace Ccshis.Cluster
2 | {
3 | ///
4 | /// 虚拟化类型
5 | ///
6 | public enum Virtualization
7 | {
8 | ///
9 | /// docker容器
10 | ///
11 | Docker=0,
12 |
13 | ///
14 | /// 实体服务器或虚拟机
15 | ///
16 | Machine=1
17 | }
18 | }
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Aliyun/Ccshis.Aliyun.LogExtend/AliYunLogAppend.cs:
--------------------------------------------------------------------------------
1 | using log4net.Appender;
2 | using log4net.Core;
3 | using System;
4 |
5 | namespace Ccshis.Aliyun.LogExtend
6 | {
7 | public class AliYunLogAppend : AppenderSkeleton
8 | {
9 | protected override void Append(LoggingEvent loggingEvent)
10 | {
11 | //todo 写入阿里云日志
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Information/IInformationSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 |
6 | namespace Ccshis.Information
7 | {
8 | public interface IInformationSenderService
9 | {
10 | Task SendAsync(List receivers, T information) where T:IInformation;
11 | Task SendAsync(string oneReceiver, T information);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/IPager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Ccshis
4 | {
5 | ///
6 | /// 分页数据接口
7 | ///
8 | ///
9 | /// author:catdemon
10 | /// data:2019-05-15
11 | /// opt:create
12 | ///
13 | public interface IPager
14 | {
15 | int pageIndex { get; set; }
16 |
17 | int PageSize { get; set; }
18 |
19 | int Totle { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Cluster/IClusterService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Cluster
6 | {
7 | public interface IClusterService
8 | {
9 | IServerMember ServerMember { get; }
10 |
11 | IServerMember JoinCluster(string clusterServerIp, IServerMember serverMember);
12 |
13 | IServerMember QuitCluster(string clusterServerIp, IServerMember serverMember);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Aliyun/Ccshis.Aliyun.LogExtend/Ccshis.Aliyun.LogExtend.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/AggregateRoot.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | ///
8 | /// 框架领域聚合根
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// data:2019-05-14
13 | /// opt:create
14 | /// remark:框架使用雪花算法id,要求使用long作为聚合根id
15 | ///
16 | public class AggregateRoot:ENode.Domain.AggregateRoot,IAggregateRoot
17 | {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Shared/Ccshis.Shared/Settings/AliYunApiSetting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Settings
6 | {
7 | ///
8 | /// 阿里去配制
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// date;2019-5-22
13 | ///
14 | public class AliYunApiSetting:ISetting
15 | {
16 | public string accessKeyId { get; set; }
17 | public string secret { get; set; }
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Test/BaseTest/BaseTestClass.cs:
--------------------------------------------------------------------------------
1 | using Ccshis;
2 | using NUnit.Framework;
3 | using System;
4 |
5 | namespace BaseTest
6 | {
7 | public class BaseTestClass
8 | {
9 |
10 | protected IComponentService componentService;
11 |
12 | [SetUp]
13 | public void SetUp()
14 | {
15 | componentService = ComponentService.Create();
16 | componentService
17 | .UseAutofac()
18 | .UseCommonComponent();
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Test/BaseTest/BaseTest.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Shared/Ccshis.Shared/SettingsPath.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Ccshis
4 | {
5 | ///
6 | /// 配置文件路径
7 | ///
8 | ///
9 | /// author:catdemon
10 | /// date:2019-5-20
11 | ///
12 | public static class SettingsPath
13 | {
14 | ///
15 | /// 服务器节点成员配置文件路径
16 | ///
17 | public const string ServerMemberSettingPath = "/Cluster/ServerMemberSetting.json";
18 |
19 | public const string AliYunApiSettingPath = "AliYunApiSetting.json";
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ConsulExtend/Ccshis.ConsulComponent.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Ccshis.ConsulComponent
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Component/IFileConfigurationService.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 |
6 | namespace Ccshis
7 | {
8 | ///
9 | /// 文件配置服务
10 | ///
11 | ///
12 | /// author:catdemon
13 | /// date:2019-5-21
14 | /// reamark:
15 | ///
16 | public interface IFileConfigurationService:IConfigurationService
17 | {
18 | Task SetAsync(string key,T value) where T:class,ISetting;
19 | Task SetAsync(string key, string value);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Shared/Ccshis.Shared/Settings/Cluster/ServerMemberSetting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Settings.Cluster
6 | {
7 | ///
8 | /// 服务器配置成员,注册到集群后,集群会分配一个服务器节点id给到当前节点
9 | /// 当前节点会存储集群分配的节点,并使用该节点作为雪花算法的服务器节点id
10 | ///
11 | ///
12 | /// authro:catdemon
13 | /// date:2019-5-21
14 | ///
15 | public class ServerMemberSetting:ISetting
16 | {
17 | ///
18 | /// 服务器节点,在集群中全局唯一
19 | ///
20 | public long Id { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ExceptionlessExtend/ExceptionlessSetting.cs:
--------------------------------------------------------------------------------
1 | namespace Ccshis.ExceptionlessExtend
2 | {
3 | ///
4 | /// Exceptionless配制项
5 | ///
6 | ///
7 | /// author:catdemon
8 | /// data:2019-05-15
9 | /// opt:create
10 | ///
11 | public class ExceptionlessSetting : ISetting
12 | {
13 | ///
14 | /// 服务器地址
15 | ///
16 | public string ServerUrl { get; set; }
17 |
18 | ///
19 | /// apikey
20 | ///
21 | public string ApiKey { get; set; }
22 | }
23 | }
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Component/Cluster/ServerMember.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Net;
4 | using System.Text;
5 |
6 | namespace Ccshis.Cluster
7 | {
8 | public class ServerMember : IServerMember
9 | {
10 | public long Id { get; set; }
11 |
12 | public Virtualization Virtualization { get; set; }
13 |
14 | public IPAddress IPAddress { get; set; }
15 |
16 | public string Name { get; set; }
17 |
18 | public string GroupName { get; set; }
19 |
20 | public string[] Tags { get; set; }
21 |
22 | public string Remark { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Information/Ccshis.Information.Sms.Ali/ISmsSender.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 |
6 | namespace Ccshis.Information.Sms.Ali
7 | {
8 | ///
9 | /// 阿里云短信发送
10 | ///
11 | /// ///
12 | /// author:catdemon
13 | /// data:2019-05-15
14 | /// opt:create
15 | ///
16 | interface ISmsSender
17 | {
18 | Task SendAsync(string[] receivers, SmsInformation information);
19 |
20 | Task SendAsync(string receivers, SmsInformation information);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ConsulExtend/IConsulSetting.cs:
--------------------------------------------------------------------------------
1 | using Consul;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace Ccshis.ServiceDiscovery.ConsulExtend
7 | {
8 | public interface IConsulSetting
9 | {
10 |
11 | ///
12 | /// 服务发现中间件配置
13 | ///
14 | ConsulServerSetting ConsulServerSetting { get; }
15 |
16 | ///
17 | /// 微服务配置
18 | ///
19 | MicServerSetting MicServerSetting { get; }
20 |
21 | ///
22 | /// 健康检查
23 | ///
24 | HealthCheckSetting HealthCheckSetting { get;}
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ExceptionlessExtend/Ccshis.ExceptionlessExtend.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | PreserveNewest
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Component/Ccshis.Component.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 | Ccshis
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Information/Ccshis.Information.Sms.Ali/AliApiResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Information.Sms.Ali
6 | {
7 | ///
8 | /// 阿里云短信调用结果
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// date:2019-5-23
13 | /// opt:create
14 | ///
15 | class AliApiResult
16 | {
17 | public string Message { get; set; }
18 | public string RequestId { get; set; }
19 | public string BizId { get; set; }
20 |
21 | ///
22 | /// 返回代码,如果成功返回OK
23 | ///
24 | public string Code { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Information/Ccshis.Information.Sms.Ali/Ccshis.Information.Sms.Ali.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netstandard2.0
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ConsulExtend/ConsulServerSetting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.ConsulComponent
6 | {
7 | ///
8 | /// 服务器发现中间件配置
9 | ///
10 | public class ConsulServerSetting
11 | {
12 | ///
13 | /// 默认端口号
14 | ///
15 | public const int DefaultPort = 8500;
16 |
17 | ///
18 | /// 服务发现地址,例如http://127.0.0.1
19 | ///
20 | public string Url { get; set; }
21 |
22 | ///
23 | /// 服务发现端口,默认8500
24 | ///
25 | public int Port { get; set; } = DefaultPort;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Util/LocalizationUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Linq;
5 |
6 | namespace Ccshis.Util
7 | {
8 | public static class LocalizationUtil
9 | {
10 | ///
11 | /// 构建多语言
12 | ///
13 | ///
14 | ///
15 | public static string Build(Enum[] localization)
16 | {
17 | var result = new StringBuilder();
18 |
19 | foreach(Enum item in localization)
20 | {
21 | result.Append($"{item.ToString()},");
22 | }
23 | return result.Remove(result.Length - 1, 1).ToString();
24 | }
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Aliyun/Ccshis.Aliyun.LogExtend/ComponentServiceExtend.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Aliyun.LogExtend
6 | {
7 | public static class ComponentServiceExtend
8 | {
9 | ///
10 | /// 注册使用阿里云日志
11 | ///
12 | /// IComponentService
13 | /// 发件邮箱配置项
14 | ///
15 | public static IComponentService UseEmail(this IComponentService componentService, AliyunLogSetting aliyunLogSetting)
16 | {
17 | componentService.RegisterAssembly(typeof(ComponentServiceExtend).Assembly);
18 | return componentService;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Test/Ccshis.Information.Sms.Ali.Test/Ccshis.Information.Sms.Ali.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/SysException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | ///
8 | /// 框架级别的错误
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// date:2019-5-23
13 | /// opt:create
14 | ///
15 | public class SysException:CoreException
16 | {
17 | public SysException(string message = SystemConst.EmptyString, string localizationCode = SystemConst.ValueIsEmpty, Exception innerException = null)
18 | : base(message, localizationCode, innerException)
19 | {
20 |
21 | }
22 |
23 | public SysException(Enum[] messageCode, Enum[] localizationCode, Exception innerException = null)
24 | : base(messageCode, localizationCode, innerException)
25 | {
26 |
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/BizException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | ///
8 | /// ccshis系统业务异常类
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// data:2019-05-14
13 | /// opt:create
14 | ///
15 | public class BizException:CoreException
16 | {
17 | public BizException(string message = SystemConst.EmptyString, string localizationCode = SystemConst.ValueIsEmpty, Exception innerException = null)
18 | :base(message,localizationCode,innerException)
19 | {
20 |
21 | }
22 | public BizException(Enum[] messageCode = null, Enum[] localizationCode = null, Exception innerException = null)
23 | : base(messageCode, localizationCode, innerException)
24 | {
25 |
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/DataException.cs:
--------------------------------------------------------------------------------
1 | using Ccshis.Util;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 |
6 | namespace Ccshis
7 | {
8 | ///
9 | /// ccshis系统数据异常类
10 | ///
11 | ///
12 | /// author:catdemon
13 | /// data:2019-05-14
14 | /// opt:create
15 | ///
16 | public class DataException:CoreException
17 | {
18 | public DataException(string message = SystemConst.EmptyString, string localizationCode = SystemConst.ValueIsEmpty, Exception innerException = null)
19 | : base(message, localizationCode, innerException)
20 | {
21 | }
22 |
23 | public DataException(Enum[] messageCode = null, Enum[] localizationCode = null, Exception innerException = null)
24 | : base(messageCode, localizationCode,innerException)
25 | {
26 |
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Component/Util/IdentifiedGenerateService.cs:
--------------------------------------------------------------------------------
1 | using Ccshis.Cluster;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using Snowflake.Core;
6 | using System.Collections.Concurrent;
7 | using System.Threading.Tasks;
8 |
9 | namespace Ccshis.Util
10 | {
11 | public class IdentifiedGenerateService : IIdentifiedGenerateService
12 | {
13 | IdWorker _idWorker;
14 |
15 | public IdentifiedGenerateService(IClusterService clusterService)
16 | {
17 | if(clusterService==null||clusterService.ServerMember==null)
18 | {
19 | throw new SysException(ExcpetionCode.EX1100000.ToString(), Localization.Sy000000.ToString());
20 | }
21 |
22 | _idWorker = new IdWorker(clusterService.ServerMember.Id, 1);
23 | }
24 |
25 | public long GetIdentified()
26 | {
27 | return _idWorker.NextId();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ExceptionlessExtend/ComponentServiceExtend.cs:
--------------------------------------------------------------------------------
1 | using ECommon.Configurations;
2 | using Exceptionless;
3 | using System;
4 |
5 | namespace Ccshis.ExceptionlessExtend
6 | {
7 | public static class ComponentServiceExtend
8 | {
9 | public static IComponentService UseExceptionless(this IComponentService componentService, ExceptionlessSetting exceptionlessSetting)
10 | {
11 | initExceptionless(exceptionlessSetting);
12 |
13 | componentService.RegisterAssembly(typeof(ComponentManagerExtend).Assembly);
14 | return componentService;
15 | }
16 |
17 | private static void initExceptionless(ExceptionlessSetting exceptionlessSetting)
18 | {
19 | //TODO这里修改
20 | ExceptionlessClient.Default.Configuration.ApiKey = exceptionlessSetting.ApiKey;
21 | ExceptionlessClient.Default.Configuration.ServerUrl = exceptionlessSetting.ServerUrl;
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Component/Information/ComponentServiceExtend.cs:
--------------------------------------------------------------------------------
1 | namespace Ccshis.Information.Email
2 | {
3 | ///
4 | /// 注册使用电子邮件组件,系统所有发的邮件,都由该组件提供
5 | ///
6 | ///
7 | /// author:catdemon
8 | /// data:2019-05-15
9 | /// opt:create
10 | ///
11 | ///
12 | /// componentService.UseEmail(emailSetting);
13 | ///
14 | public static class ComponentServiceExtend
15 | {
16 | ///
17 | /// 注册使用电子邮件组件
18 | ///
19 | /// IComponentService
20 | /// 发件邮箱配置项
21 | ///
22 | public static IComponentService UseEmail(this IComponentService componentService)
23 | {
24 | componentService.RegisterAssembly(typeof(ComponentServiceExtend).Assembly);
25 | return componentService;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Test/Ccshis.ConsulExtend.Test/Ccshis.ServiceDiscovery.ConsulExtend.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.2
5 |
6 | false
7 |
8 | Ccshis.ConsulExtend.Test
9 |
10 | Ccshis.ConsulExtend.Test
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ConsulExtend/MicServerSetting.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.ConsulComponent
6 | {
7 |
8 | public class MicServerSetting
9 | {
10 | ///
11 | /// 默认端口号
12 | ///
13 | public const int DefaultPort = 80;
14 |
15 | ///
16 | /// 注册id
17 | ///
18 | public long Id { get; set; }
19 |
20 | ///
21 | /// 微服务器健康url地址,例如http://127.0.0.1
22 | ///
23 | public string Url { get; set; }
24 |
25 | ///
26 | /// 端口号,默认60
27 | ///
28 | public int Port { get; set; } = DefaultPort;
29 |
30 | ///
31 | /// 注册服务名
32 | ///
33 | public string Name { get; set; }
34 |
35 | ///
36 | /// 注册标签
37 | ///
38 | public string[] Tags { get; set; }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## 智选云开发平台 ##
2 |
3 | 响应github针对华为,已转到码云,码云地址见下
4 | https://gitee.com/cheetahing2017/ccshis
5 |
6 | **智选云开发平台** 基于ddd(领域驱动设计)+cqrs(命令查询职责分离)+micservice(微服务)的开发框架,在使用该架构时,你需要提前了解以上开发方式。
7 |
8 | ### 架构特点 ###
9 |
10 | - 微服务
11 | - 分布式
12 | - 高并发
13 | - 横向扩容
14 | - saas平台化
15 | - 多租户云化
16 | - iot物联网化
17 | - 容器化
18 | - 平台可监控
19 | - 多语言
20 |
21 | ### 技术要点 ###
22 | - .net core,c#语言
23 | - autoface,ico注入
24 | - castle,aop切面
25 | - docker,部署
26 | - enode,cqrs框架
27 | - equeue,消息队列
28 | - mongodb
29 | - redis
30 | - mysql
31 | - ocelot,微服务网关
32 | - consul,服务发现与配置中心
33 | - Skywalking,调用链路追踪
34 | - Quzrtz.net core,任务管理
35 | - exceptionless,分布式日志
36 | - WebApiClient.JIT,微服务RPC调用
37 | - swagger,API调试组件
38 | - singlR,websocket双向通行
39 | - 阿里云短信sms
40 | - 阿里对象存储oss
41 | - 集成微信公从号
42 | - 集成微信小程序
43 | - 集成微信支付
44 | - 集成阿里支付
45 | - 集成阿里云
46 |
47 |
48 | ### 项目结构图 ###
49 | 
50 |
51 | copyright 智选云® [www.ccshis.com](http://www.ccshis.com)
52 |
--------------------------------------------------------------------------------
/Shared/Ccshis.Shared/Localization.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | ///
8 | /// 多语言管理类
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// date:2019-5-20
13 | /// Sy000000-Sy999999为系统级别
14 | /// Fi000000-Fi999999为常用字段名
15 | /// Xx000000-Xx999999为x微服务
16 | /// Xx000000-Xx999999为x微服务
17 | /// Xx000000-Xx999999为x微服务
18 | ///
19 | public enum Localization
20 | {
21 | #region Sy000000-Sy999999为系统级别
22 | ///
23 | /// Yes 是
24 | ///
25 | Sy000000,
26 |
27 | ///
28 | /// No 否
29 | ///
30 | Sy000001,
31 |
32 | ///
33 | /// Ok 确定
34 | ///
35 | Sy000002,
36 |
37 | ///
38 | /// cancel 取消
39 | ///
40 | Sy000003
41 | #endregion
42 |
43 | #region Fi000000-Fi999999为常用字段名
44 |
45 | #endregion
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Cluster/IServerMember.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Net;
4 | using System.Text;
5 |
6 | namespace Ccshis.Cluster
7 | {
8 | ///
9 | /// 服务节点
10 | ///
11 | public interface IServerMember
12 | {
13 | ///
14 | /// 服务器Id
15 | ///
16 | long Id { get; }
17 |
18 | ///
19 | /// 虚拟化类型
20 | ///
21 | Virtualization Virtualization { get; }
22 |
23 | ///
24 | /// 服务器地址
25 | ///
26 | IPAddress IPAddress { get; }
27 |
28 | ///
29 | /// 服务器名称
30 | ///
31 | string Name { get; }
32 |
33 | ///
34 | /// 服务器组
35 | ///
36 | string GroupName { get;}
37 |
38 | ///
39 | /// 服务器标签
40 | ///
41 | string[] Tags { get;}
42 |
43 | ///
44 | /// 备注
45 | ///
46 | string Remark { get; }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Shared/Shared.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.28803.452
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ccshis.Shared", "Ccshis.Shared\Ccshis.Shared.csproj", "{DD9E0939-B581-4886-AC36-3D9F34FC0784}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Release|Any CPU = Release|Any CPU
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {DD9E0939-B581-4886-AC36-3D9F34FC0784}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15 | {DD9E0939-B581-4886-AC36-3D9F34FC0784}.Debug|Any CPU.Build.0 = Debug|Any CPU
16 | {DD9E0939-B581-4886-AC36-3D9F34FC0784}.Release|Any CPU.ActiveCfg = Release|Any CPU
17 | {DD9E0939-B581-4886-AC36-3D9F34FC0784}.Release|Any CPU.Build.0 = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {08077019-D35E-4E62-B3C9-6DEB071A6040}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/AuthorizeExcpetion.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis
6 | {
7 | ///
8 | /// catdemon 2019-5-4
9 | /// 权限身份认证异常
10 | /// 当平台发生权限验证失败时,抛出该异常信息
11 | ///
12 | ///
13 | /// author:catdemon
14 | /// data:2019-05-14
15 | /// opt:create
16 | ///
17 | public class AuthorizeExcpetion:CoreException
18 | {
19 | ///
20 | /// catdemon 2019-5-4
21 | /// 权限身份认证异常
22 | ///
23 | /// 异常消息
24 | /// 多语言编码
25 | /// 内部异常
26 | public AuthorizeExcpetion(string message = SystemConst.EmptyString, string localizationCode = SystemConst.ValueIsEmpty, Exception innerException = null)
27 | : base(message, localizationCode,innerException)
28 | {
29 |
30 | }
31 | public AuthorizeExcpetion(Enum[] messageCode = null, Enum[] localizationCode = null, Exception innerException = null)
32 | : base(messageCode, localizationCode, innerException)
33 | {
34 |
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.ConsulExtend/ConsulConfigurationService.cs:
--------------------------------------------------------------------------------
1 | using Consul;
2 | using Newtonsoft.Json;
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace Ccshis.ConsulComponent
9 | {
10 | ///
11 | /// 配置中心
12 | ///
13 | public class ConsulConfigurationService : IConfigurationService
14 | {
15 | private IConsulClient _consulClien;
16 |
17 | public ConsulConfigurationService(IConsulClient consulClient)
18 | {
19 | _consulClien = consulClient;
20 | }
21 |
22 | public async Task GetAsync(string key) where T:class,ISetting
23 | {
24 | return JsonConvert.DeserializeObject(await GetAsync(key));
25 | }
26 |
27 |
28 | public async Task GetAsync(string key)
29 | {
30 | return await GetConfigByConsul(key);
31 | }
32 |
33 | public async Task GetConfigByConsul(string key)
34 | {
35 | var result = await _consulClien.KV.Get(key);
36 | var list = await _consulClien.KV.List("test/");
37 | return Encoding.UTF8.GetString(result.Response.Value);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Test/Ccshis.ConsulExtend.Test/DefaultConfiguationServiceTest.cs:
--------------------------------------------------------------------------------
1 | using BaseTest;
2 | using ECommon.Components;
3 | using NUnit.Framework;
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Text;
7 | using System.IO;
8 |
9 | namespace Ccshis.ConsulExtend.Test
10 | {
11 | public class DefaultConfiguationServiceTest:BaseTestClass
12 | {
13 | [Test]
14 | public void TestGet()
15 | {
16 | this.componentService
17 | .UseDefaultConfigurationService()
18 | .BuildContainer();
19 |
20 | var fileName = "test.json";
21 | var fileContext = "testFielContext";
22 | //var filePath = Path.Combine(DefaultConfiguationService.DefaultPath,fileName);
23 |
24 | //set configFile
25 | var fileConfigurationService = ObjectContainer.Resolve();
26 | fileConfigurationService.SetAsync(fileName,fileContext);
27 |
28 | //get configFile
29 | var configurationService=ObjectContainer.Resolve();
30 | var result=configurationService.GetAsync(fileName).GetAwaiter().GetResult();
31 |
32 | Assert.AreEqual(fileContext, result);
33 |
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Information/Ccshis.Information.Sms.Ali/SmsInformation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Information.Sms.Ali
6 | {
7 | ///
8 | /// 阿里云短信模板
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// data:2019-05-15
13 | /// opt:create
14 | ///
15 | public class SmsInformation:IInformation
16 | {
17 | ///
18 | /// 短信模板编码
19 | ///
20 | public string TemplateCode { get; set; }
21 |
22 | ///
23 | /// 短信签名
24 | ///
25 | public string SignName { get; set; }
26 |
27 | ///
28 | /// 发送信息的内容
29 | ///
30 | string IInformation.Body { get; set; }
31 |
32 |
33 | ///
34 | /// 模板参数,json格式字符串
35 | ///
36 | ///
37 | /// {'cdoe':'12345'}
38 | ///
39 | public string TemplateParam
40 | {
41 | get
42 | {
43 | return (this as IInformation).Body;
44 | }
45 | set
46 | {
47 | (this as IInformation).Body = value;
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/CoreException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 | using System.Linq;
5 | using Ccshis.Util;
6 |
7 | namespace Ccshis
8 | {
9 | ///
10 | /// ccshis系统核心异常类
11 | ///
12 | ///
13 | /// author:catdemon
14 | /// data:2019-05-14
15 | /// opt:create
16 | ///
17 | public class CoreException:Exception
18 | {
19 | ///
20 | /// 多语言编号
21 | ///
22 | public string LocalizationCode { get; private set; }
23 |
24 | ///
25 | /// 核心异常类
26 | ///
27 | ///
28 | /// 异常消息
29 | /// 多语言编码
30 | /// 内部异常
31 | public CoreException(string message= SystemConst.EmptyString, string localizationCode= SystemConst.ValueIsEmpty, Exception innerException=null)
32 | :base(message,innerException)
33 | {
34 | this.LocalizationCode = localizationCode;
35 | }
36 |
37 | public CoreException(Enum[] messageCode=null, Enum[] localizationCode=null, Exception innerException = null)
38 | : base(StringUtil.SplitJoint(messageCode), innerException)
39 | {
40 | LocalizationCode = StringUtil.SplitJoint(localizationCode);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Infrastructure/Component/Ccshis.Information/Ccshis.Information.Sms.Ali/ComponentServiceExtend.cs:
--------------------------------------------------------------------------------
1 | using Ccshis.Settings;
2 | using ECommon.Configurations;
3 |
4 | namespace Ccshis.Information.Sms.Ali
5 | {
6 | ///
7 | /// 注册使用阿里云短信
8 | ///
9 | ///
10 | /// author:catdemon
11 | /// data:2019-05-15
12 | /// opt:create
13 | ///
14 | ///
15 | /// componentService.UseAliSms(aliSmsSetting);
16 | ///
17 | public static class ComponentServiceExtend
18 | {
19 | ///
20 | /// 注册使用阿里云短信组件
21 | ///
22 | /// IComponentService
23 | /// 阿里云配置
24 | ///
25 | public static IComponentService UseAliSms(this IComponentService componentService)
26 | {
27 | componentService.SetDefault();
28 |
29 | componentService.RegisterAssembly(typeof(ComponentServiceExtend).Assembly);
30 | return componentService;
31 | }
32 |
33 | public static IComponentService InitializeAliSms(this IComponentService componentService,AliYunApiSetting aliYunApiSetting)
34 | {
35 | var smsSender=ComponentContainer.Resolve();
36 | return componentService;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Infrastructure/Ccshis/Util/StringUtil.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Text;
4 |
5 | namespace Ccshis.Util
6 | {
7 | ///
8 | /// 字符串处理工具类
9 | ///
10 | ///
11 | /// author:catdemon
12 | /// date:2019-5-23
13 | ///
14 | public static class StringUtil
15 | {
16 | private const string _default_splitChar = ",";
17 |
18 | ///
19 | /// 把数组对象拼接为字符串,使用默认obj.ToString()转为字符串
20 | ///
21 | /// 数组对象
22 | /// 拼接字符串,默认为逗号","
23 | /// 拼接后字符串
24 | public static string SplitJoint(object[] objArray,string splitChar= _default_splitChar)
25 | {
26 | return SplitJoint(objArray, splitChar, p => p.ToString());
27 | }
28 |
29 | ///
30 | /// 把数组对象拼接为字符串,使用默认objToStringAction委托把对象转为字符串
31 | ///
32 | /// 数组对象
33 | /// 拼接字符串
34 | /// 返回拼接后字符串
35 | /// 拼接后字符串
36 | public static string SplitJoint(object[] objArray, string splitChar,Func