框架分层

This commit is contained in:
橙子
2021-10-10 17:30:31 +08:00
parent 945437a2eb
commit cf062cadcd
59 changed files with 2908 additions and 14 deletions

View File

@@ -0,0 +1,8 @@
using System;
namespace Yi.Framework.Common
{
public class Class1
{
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Common.IOCOptions
{
public class ElasticSearchOptions
{
public string Url { get; set; }
public string IndexName { get; set; }
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CC.ElectronicCommerce.Common.IOCOptions
{
public class JWTTokenOptions
{
public string Audience
{
get;
set;
}
public string SecurityKey
{
get;
set;
}
//public SigningCredentials Credentials
//{
// get;
// set;
//}
public string Issuer
{
get;
set;
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CC.ElectronicCommerce.Common.IOCOptions
{
public class KafkaOptions
{
public string BrokerList { get; set; }
public string TopicName { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using System;
namespace Yi.Framework.Common.IOCOptions
{
public class MySqlConnOptions
{
public string Url { get; set; }
}
}

View File

@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.IOCOptions
{
public class RabbitMQOptions
{
///// <summary>
///// exchange---queue
///// </summary>
//private static Dictionary<string, string> RabbitMQ_Mapping = new Dictionary<string, string>();
//private static readonly object RabbitMQOptions_Lock = new object();
//public void Init(string exchangeName, string queueName)
//{
// lock (RabbitMQOptions_Lock)
// {
// RabbitMQ_Mapping[exchangeName] = queueName;
// }
//}
public string HostName { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
}
public class RabbitMQConsumerModel
{
/// <summary>
/// 生产者指定,交换机
/// </summary>
public string ExchangeName { get; set; }
/// <summary>
/// 自己起的名字
/// </summary>
public string QueueName { get; set; }
}
public class RabbitMQExchangeQueueName
{
public static readonly string SKUCQRS_Exchange = "Zhaoxi.MSACormmerce.SKUCQRS.Exchange";
public static readonly string SKUCQRS_Queue_StaticPage = "Zhaoxi.MSACormmerce.SKUCQRS.Queue.StaticPage";
public static readonly string SKUCQRS_Queue_ESIndex = "Zhaoxi.MSACormmerce.SKUCQRS.Queue.ESIndex";
public static readonly string SKUWarmup_Exchange = "Zhaoxi.MSACormmerce.Warmup.Exchange";
public static readonly string SKUWarmup_Queue_StaticPage = "Zhaoxi.MSACormmerce.Warmup.Queue.StaticPage";
public static readonly string SKUWarmup_Queue_ESIndex = "Zhaoxi.MSACormmerce.Warmup.Queue.ESIndex";
/// <summary>
/// 订单创建后的交换机
/// </summary>
public static readonly string OrderCreate_Exchange = "Zhaoxi.MSACormmerce.OrderCreate.Exchange";
public static readonly string OrderCreate_Queue_CleanCart = "Zhaoxi.MSACormmerce.OrderCreate.Queue.CleanCart";
/// <summary>
/// 订单创建后的交换机,支付状态的
/// </summary>
public static readonly string OrderPay_Exchange = "Zhaoxi.MSACormmerce.OrderPay.Exchange";
public static readonly string OrderPay_Queue_RefreshPay = "Zhaoxi.MSACormmerce.OrderPay.Queue.RefreshPay";
/// <summary>
/// 创建订单后的延时队列配置
/// </summary>
public static readonly string OrderCreate_Delay_Exchange = "Zhaoxi.MSACormmerce.OrderCreate.DelayExchange";
public static readonly string OrderCreate_Delay_Queue_CancelOrder = "Zhaoxi.MSACormmerce.OrderCreate.DelayQueue.CancelOrder";
/// <summary>
/// 秒杀异步的
/// </summary>
public static readonly string Seckill_Exchange = "Zhaoxi.MSACormmerce.Seckill.Exchange";
public static readonly string Seckill_Order_Queue = "Zhaoxi.MSACormmerce.Seckill.Order.Queue";
/// <summary>
/// CAP队列名称
/// </summary>
public const string Order_Stock_Decrease = "RabbitMQ.MySQL.Order-Stock.Decrease";
public const string Order_Stock_Resume = "RabbitMQ.MySQL.Order-Stock.Resume";
public const string Stock_Logistics = "RabbitMQ.MySQL.Stock-Logistics";
public const string Pay_Order_UpdateStatus = "RabbitMQ.MySQL.Pay_Order.UpdateStatus";
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.IOCOptions
{
public class RedisConnOptions
{
public string Host { get; set; }
public int DB { get; set; } = 0;
public int Prot { get; set; }
public string Password { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Common.Models
{
/// <summary>
/// 写入分布式日志需要的字段
/// </summary>
public class LogModel
{
public string OriginalClassName { get; set; }
public string OriginalMethodName { get; set; }
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Yi.Framework.Common.Models
{
/// <summary>
/// 结果数据
/// </summary>
public class Result
{
public bool status { get; set; }
public int code { get; set; }
public string msg { get; set; }
public object data { get; set; }
public static Result Instance(bool status, string msg)
{
return new Result() { status = status, code = 500, msg = msg };
}
public static Result Error(string msg = "fail")
{
return new Result() { status = false, code = 500, msg = msg };
}
public static Result Success(string msg = "succeed")
{
return new Result() { status = true, code = 200, msg = msg };
}
public Result SetData(object obj)
{
this.data = obj;
return this;
}
public Result SetCode(int Code)
{
this.code = Code;
return this;
}
}
public class Result<T>
{
public bool status { get; set; }
public int code { get; set; }
public string msg { get; set; }
public T data { get; set; }
public static Result<T> Instance(bool status, string msg)
{
return new Result<T>() { status = status, code = 500, msg = msg };
}
public static Result<T> Error(string msg = "fail")
{
return new Result<T> { status = false, code = 500, msg = msg };
}
public static Result<T> Success(string msg = "succeed")
{
return new Result<T> { status = true, code = 200, msg = msg };
}
public Result<T> SetData(T TValue)
{
this.data = TValue;
return this;
}
}
}

View File

@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>