<develop>:(ShopERP 端)<无> ShopERP 项目优化

parent 87a76dc1
......@@ -41,7 +41,7 @@ namespace CoreCms.Net.Web.Admin.Infrastructure
UserName = builder.Configuration["Smtp:Username"],
Password = builder.Configuration["Smtp:Password"],
FromAddress = builder.Configuration["Smtp:FromAddress"],
DisplayName = builder.Configuration["Smtp:DisplayName"] ?? "My Application"
DisplayName = builder.Configuration["Smtp:DisplayName"] ?? "ShopERP"
};
// 注册邮件服务
......@@ -73,6 +73,7 @@ namespace CoreCms.Net.Web.Admin.Infrastructure
//jwt授权支持注入
builder.Services.AddAuthorizationSetupForAdmin();
//上下文注入
builder.Services.AddHttpContextSetup();
......

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 广告api控制器
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class AdvertController : ControllerBase
{
private IHttpContextUser _user;
private readonly ICoreCmsArticleServices _articleServices;
private readonly ICoreCmsAdvertPositionServices _advertPositionServices;
private readonly ICoreCmsAdvertisementServices _advertisementServices;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="user"></param>
/// <param name="articleServices"></param>
/// <param name="advertPositionServices"></param>
/// <param name="advertisementServices"></param>
public AdvertController(IHttpContextUser user
, ICoreCmsArticleServices articleServices
, ICoreCmsAdvertPositionServices advertPositionServices
, ICoreCmsAdvertisementServices advertisementServices
)
{
_user = user;
_articleServices = articleServices;
_advertPositionServices = advertPositionServices;
_advertisementServices = advertisementServices;
}
#region 获取广告列表=============================================================================
/// <summary>
/// 获取广告列表
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetAdvertList([FromBody] FMPageByIntId entity)
{
var jm = new WebApiCallBack();
var list = await _advertisementServices.QueryPageAsync(p => p.code == entity.where, p => p.createTime, OrderByType.Desc,
entity.page, entity.limit);
jm.status = true;
jm.data = list;
return jm;
}
#endregion
#region 获取广告位置信息=============================================================================
/// <summary>
/// 获取广告位置信息
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetPositionList([FromBody] WxAdvert entity)
{
var jm = new WebApiCallBack();
var position = await _advertPositionServices.QueryListByClauseAsync(p => p.isEnable && p.code == entity.codes);
if (!position.Any())
{
return jm;
}
var ids = position.Select(p => p.id).ToList();
var isement = await _advertisementServices.QueryListByClauseAsync(p => ids.Contains(p.positionId));
Dictionary<string, List<CoreCmsAdvertisement>> list = new Dictionary<string, List<CoreCmsAdvertisement>>();
list.Add(entity.codes, isement);
jm.status = true;
jm.data = list;
return jm;
}
#endregion
}
}

using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 文章api控制器
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class ArticleController : ControllerBase
{
private IHttpContextUser _user;
private readonly ICoreCmsArticleServices _articleServices;
private readonly ICoreCmsArticleTypeServices _articleTypeServices;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="user"></param>
/// <param name="articleServices"></param>
/// <param name="articleTypeServices"></param>
public ArticleController(IHttpContextUser user, ICoreCmsArticleServices articleServices, ICoreCmsArticleTypeServices articleTypeServices)
{
_user = user;
_articleServices = articleServices;
_articleTypeServices = articleTypeServices;
}
#region 获取通知列表
/// <summary>
/// 获取通知列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> NoticeList([FromBody] FMPageByIntId entity)
{
var jm = new WebApiCallBack();
var list = await _articleServices.QueryPageAsync(p => p.isDel == false, p => p.createTime, OrderByType.Desc,
entity.page, entity.limit);
jm.status = true;
jm.data = list;
return jm;
}
#endregion
#region 获取文章列表
/// <summary>
/// 获取文章列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetArticleList([FromBody] FMPageByIntId entity)
{
var jm = new WebApiCallBack();
var list = await _articleServices.QueryPageAsync(p => p.isDel == false && p.typeId == entity.id, p => p.createTime, OrderByType.Desc,
entity.page, entity.limit);
var articleType = await _articleTypeServices.QueryAsync();
var typeName = string.Empty;
if (articleType.Any())
{
var type = articleType.Find(p => p.id == entity.id);
typeName = type != null ? type.name : "";
}
jm.status = true;
jm.data = new
{
list,
articleType,
type_name = typeName,
count = list.TotalCount
};
return jm;
}
#endregion
/// <summary>
/// 获取单个文章内容
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetArticleDetail([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack();
var model = await _articleServices.ArticleDetail(entity.id);
if (model == null)
{
jm.msg = "数据获取失败";
return jm;
}
jm.status = true;
jm.data = model;
return jm;
}
}
}

using System;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 优惠券接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class CouponController : ControllerBase
{
private readonly IHttpContextUser _user;
private readonly ICoreCmsCouponServices _couponServices;
private readonly ICoreCmsPromotionServices _promotionServices;
private readonly IUnitOfWork _unionOfWork;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="user"></param>
/// <param name="couponServices"></param>
/// <param name="promotionServices"></param>
/// <param name="unionOfWork"></param>
public CouponController(IHttpContextUser user
, ICoreCmsCouponServices couponServices, ICoreCmsPromotionServices promotionServices, IUnitOfWork unionOfWork)
{
_user = user;
_couponServices = couponServices;
_promotionServices = promotionServices;
_unionOfWork = unionOfWork;
}
//公共接口====================================================================================================
#region 获取 可领取的优惠券==================================================
/// <summary>
/// 获取 可领取的优惠券
/// </summary>
/// <returns></returns>
[HttpPost]
//[Authorize]
public async Task<WebApiCallBack> CouponList([FromBody] FMCouponForUserCouponPost entity)
{
var jm = new WebApiCallBack() { msg = "获取失败" };
var list = await _promotionServices.GetReceiveCouponList(entity.page, entity.limit);
jm.status = true;
jm.data = list;
jm.msg = "获取成功";
jm.otherData = new
{
totalCount = 0,
totalPages = 0,
};
if (list != null && list.Any())
{
jm.data = list;
jm.otherData = new
{
list.TotalCount,
list.TotalPages
};
}
return jm;
}
#endregion
//验证接口====================================================================================================
#region 获取优惠券 详情==================================================
/// <summary>
/// 获取优惠券 详情
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> CouponDetail([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack() { msg = "获取失败" };
if (entity.id == 0)
{
jm.status = false;
jm.msg = GlobalErrorCodeVars.Code15006;
return jm;
}
var promotionModel = await _promotionServices.QueryByClauseAsync(p => p.id == entity.id);
if (promotionModel != null)
{
jm.status = true;
jm.data = promotionModel;
jm.msg = "获取成功";
}
return jm;
}
#endregion
#region 获取用户已领取的优惠券==================================================
/// <summary>
/// 获取用户已领取的优惠券
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> UserCoupon([FromBody] FMCouponForUserCouponPost entity)
{
var jm = await _couponServices.GetMyCoupon(_user.ID, 0, entity.display, entity.page, entity.limit);
return jm;
}
#endregion
#region 用户领取优惠券==================================================
/// <summary>
/// 用户领取优惠券
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetCoupon([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack();
if (entity.id == 0)
{
jm.msg = GlobalErrorCodeVars.Code15006;
return jm;
}
try
{
_unionOfWork.BeginTran();
//判断优惠券是否可以领取?
var promotionModel = await _promotionServices.ReceiveCoupon(entity.id);
if (promotionModel.status == false)
{
_unionOfWork.RollbackTran();
return promotionModel;
}
var promotion = (CoreCmsPromotion)promotionModel.data;
if (promotion == null)
{
_unionOfWork.RollbackTran();
jm.msg = GlobalErrorCodeVars.Code15019;
return jm;
}
if (promotion.maxNums > 0)
{
//判断用户是否已领取?领取次数
var couponResult = await _couponServices.GetMyCoupon(_user.ID, entity.id, "all", 1, 9999);
if (couponResult.status && couponResult.code >= promotion.maxNums)
{
_unionOfWork.RollbackTran();
jm.msg = GlobalErrorCodeVars.Code15018;
return jm;
}
}
jm = await _couponServices.AddData(_user.ID, entity.id, promotion);
_unionOfWork.CommitTran();
jm.otherData = promotionModel;
}
catch (Exception e)
{
_unionOfWork.RollbackTran();
jm.msg = GlobalErrorCodeVars.Code10000;
}
return jm;
}
#endregion
#region 用户输入code领取优惠券==================================================
/// <summary>
/// 用户输入code领取优惠券
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetCouponKey([FromBody] FMCouponForGetCouponKeyPost entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.key))
{
jm.msg = GlobalErrorCodeVars.Code15006;
return jm;
}
var coupon = await _couponServices.QueryByClauseAsync(p => p.couponCode == entity.key);
if (coupon == null || coupon.promotionId <= 0)
{
jm.msg = GlobalErrorCodeVars.Code15009;
return jm;
}
//判断优惠券是否可以领取?
var promotionModel = await _promotionServices.ReceiveCoupon(coupon.promotionId);
if (promotionModel.status == false)
{
return promotionModel;
}
//判断用户是否已领取?
if (promotionModel.data is CoreCmsPromotion { maxNums: > 0 } info)
{
//判断用户是否已领取?领取次数
var couponResult = await _couponServices.GetMyCoupon(_user.ID, coupon.promotionId, "all", 1, 9999);
if (couponResult.status && couponResult.code > info.maxNums)
{
jm.msg = GlobalErrorCodeVars.Code15018;
return jm;
}
}
//
jm = await _couponServices.ReceiveCoupon(_user.ID, entity.key);
return jm;
}
#endregion
}
}
\ No newline at end of file

using CoreCms.Net.Model.ViewModels.Email;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 默认接口示例
/// </summary>
public class DemoController : ControllerBase
{
/// <summary>
///默认首页
/// </summary>
/// <returns></returns>
public IActionResult Index()
{
return Content("已结束");
}
}
}
\ No newline at end of file

using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 分销请求接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class DistributionController : ControllerBase
{
private readonly ICoreCmsDistributionOrderServices _distributionOrderServices;
private readonly ICoreCmsDistributionServices _distributionServices;
private readonly ICoreCmsSettingServices _settingServices;
private readonly ICoreCmsUserServices _userServices;
private readonly IHttpContextUser _user;
/// <summary>
/// 构造函数
/// </summary>
public DistributionController(IHttpContextUser user, ICoreCmsDistributionServices distributionServices,
ICoreCmsSettingServices settingServices, ICoreCmsUserServices userServices,
ICoreCmsDistributionOrderServices distributionOrderServices)
{
_user = user;
_distributionServices = distributionServices;
_settingServices = settingServices;
_userServices = userServices;
_distributionOrderServices = distributionOrderServices;
}
//公共接口====================================================================================================
#region 获取店铺信息
/// <summary>
/// 获取店铺信息
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetStoreInfo([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack();
if (entity.id == 0)
{
jm.msg = "店铺信息丢失";
return jm;
}
var store = UserHelper.GetUserIdByShareCode(entity.id);
if (store <= 0)
{
jm.msg = "店铺信息丢失";
return jm;
}
jm = await _distributionServices.GetStore(store);
return jm;
}
#endregion
//验证接口====================================================================================================
#region 查询用户是否可以成为分销商
/// <summary>
/// 查询用户是否可以成为分销商
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> Info()
{
var jm = await _distributionServices.GetInfo(_user.ID, true);
return jm;
}
#endregion
#region 申请成为分销商接口
/// <summary>
/// 申请成为分销商接口
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> ApplyDistribution([FromBody] FMDistributionApply entity)
{
var jm = new WebApiCallBack();
if (entity.agreement != "on")
{
jm.msg = "请勾选分销协议";
return jm;
}
var iData = new CoreCmsDistribution();
iData.mobile = entity.mobile;
iData.name = entity.name;
iData.weixin = entity.weixin;
iData.qq = entity.qq;
jm = await _distributionServices.AddData(iData, _user.ID);
return jm;
}
#endregion
#region 我推广的订单
/// <summary>
/// 我推广的订单
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> MyOrder([FromBody] FMPageByIntId entity)
{
var jm = await _distributionServices.GetMyOrderList(_user.ID, entity.page, entity.limit, entity.id);
return jm;
}
#endregion
#region 店铺设置
/// <summary>
/// 店铺设置
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> SetStore([FromBody] FMSetDistributionStorePost entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.storeName))
{
jm.msg = "请填写店铺名称";
return jm;
}
if (string.IsNullOrEmpty(entity.storeLogo))
{
jm.msg = "请上传店铺logo";
return jm;
}
if (string.IsNullOrEmpty(entity.storeBanner))
{
jm.msg = "请上传店铺banner";
return jm;
}
var info = await _distributionServices.QueryByClauseAsync(p => p.userId == _user.ID);
if (info != null)
{
info.storeLogo = entity.storeLogo;
info.storeBanner = entity.storeBanner;
info.storeDesc = entity.storeDesc;
info.storeName = entity.storeName;
await _distributionServices.UpdateAsync(info);
}
jm.status = true;
jm.msg = "保存成功";
return jm;
}
#endregion
#region 获取我的订单统计
/// <summary>
/// 获取我的订单统计
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetOrderSum()
{
var jm = new WebApiCallBack();
//全部订单
var allOrder = await _distributionOrderServices.QueryChildOrderCountAsync(_user.ID, 0);
//一级订单
var firstOrder = await _distributionOrderServices.QueryChildOrderCountAsync(_user.ID);
//二级订单
var secondOrder = await _distributionOrderServices.QueryChildOrderCountAsync(_user.ID, 2);
//本月订单
var monthOrder = await _distributionOrderServices.QueryChildOrderCountAsync(_user.ID, 0, true);
//全部订单金额
var allOrderMoney = await _distributionOrderServices.QueryChildOrderMoneySumAsync(_user.ID, 0);
//代购订单金额
var firstOrderMoney = await _distributionOrderServices.QueryChildOrderMoneySumAsync(_user.ID);
//推广订单金额
var secondOrderMoney = await _distributionOrderServices.QueryChildOrderMoneySumAsync(_user.ID, 2);
//本月订单金额
var monthOrderMoney = await _distributionOrderServices.QueryChildOrderMoneySumAsync(_user.ID, 0, true);
jm.status = true;
jm.data = new
{
allOrder,
firstOrder,
secondOrder,
monthOrder,
allOrderMoney,
firstOrderMoney,
secondOrderMoney,
monthOrderMoney
};
return jm;
}
#endregion
#region 获取我的下级用户数量
/// <summary>
/// 获取我的下级用户数量
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetTeamSum()
{
var jm = new WebApiCallBack();
//一级统计人数
var first = await _userServices.QueryChildCountAsync(_user.ID);
//二级发展人数
var second = await _userServices.QueryChildCountAsync(_user.ID, 2);
//当月发展一级人数
var monthFirst = await _userServices.QueryChildCountAsync(_user.ID, 1, true);
//当月发展二级分数
var monthSecond = await _userServices.QueryChildCountAsync(_user.ID, 2, true);
jm.status = true;
jm.data = new
{
count = first + second,
first,
second,
monthCount = monthFirst + monthSecond,
monthFirst,
monthSecond
};
return jm;
}
#endregion
#region 获取分销商排行
/// <summary>
/// 获取分销商排行
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetDistributionRanking([FromBody] FMPageByIntId entity)
{
var jm = new WebApiCallBack();
var list = await _distributionServices.QueryRankingPageAsync(entity.page, entity.limit);
jm.status = true;
jm.data = new
{
data = list,
list.HasNextPage,
list.HasPreviousPage,
list.PageIndex,
list.PageSize,
list.TotalPages,
list.TotalCount
};
return jm;
}
#endregion
}
}
\ No newline at end of file

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 表单接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class FormController : ControllerBase
{
private readonly ICoreCmsFormServices _formServices;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="formServices"></param>
public FormController(ICoreCmsFormServices formServices)
{
_formServices = formServices;
}
#region 万能表单/获取活动商品详情=============================================================================
/// <summary>
/// 万能表单/获取活动商品详情
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetFormDetial([FromBody] FmGetForm entity)
{
var jm = await _formServices.GetFormInfo(entity.id, entity.token);
return jm;
}
#endregion
#region 万能表单/提交表单=============================================================================
/// <summary>
/// 万能表单/提交表单
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> AddSubmit([FromBody] FmAddSubmit entity)
{
var jm = await _formServices.AddSubmit(entity);
jm.otherData = entity;
return jm;
}
#endregion
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 团购调用接口数据
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class GroupController : ControllerBase
{
private readonly IHttpContextUser _user;
private readonly ICoreCmsPromotionServices _coreCmsPromotionServices;
private ICoreCmsGoodsServices _goodsServices;
/// <summary>
/// 构造函数
/// </summary>
public GroupController(IHttpContextUser user, ICoreCmsPromotionServices coreCmsPromotionServices, ICoreCmsGoodsServices goodsServices)
{
_user = user;
_coreCmsPromotionServices = coreCmsPromotionServices;
_goodsServices = goodsServices;
}
//公共接口====================================================================================================
#region 获取秒杀团购列表===========================================================
/// <summary>
/// 获取秒杀团购列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetList([FromBody] FMGroupGetListPost entity)
{
var jm = await _coreCmsPromotionServices.GetGroupList(entity.type, _user.ID, entity.status, entity.page, entity.limit);
return jm;
}
#endregion
#region 获取秒杀团购详情===========================================================
/// <summary>
/// 获取秒杀团购详情
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetGoodsDetial([FromBody] FMGetGoodsDetial entity)
{
var jm = await _coreCmsPromotionServices.GetGroupDetail(entity.id, 0, "group", entity.groupId);
return jm;
}
#endregion
//验证接口====================================================================================================
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 公告控制器
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class NoticeController : ControllerBase
{
private IHttpContextUser _user;
private ICoreCmsNoticeServices _noticeServices;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="user"></param>
/// <param name="noticeServices"></param>
public NoticeController(IHttpContextUser user, ICoreCmsNoticeServices noticeServices)
{
_user = user;
_noticeServices = noticeServices;
}
#region 列表
/// <summary>
/// 列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> NoticeList([FromBody] FMPageByIntId entity)
{
var jm = new WebApiCallBack();
var list = await _noticeServices.QueryPageAsync(p => p.isDel == false, p => p.createTime, OrderByType.Desc,
entity.page, entity.limit);
jm.status = true;
jm.data = list;
return jm;
}
#endregion
/// <summary>
/// 获取单个公告内容
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> NoticeInfo([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack();
var model = await _noticeServices.QueryByIdAsync(entity.id);
if (model == null)
{
jm.msg = "数据获取失败";
return jm;
}
jm.status = true;
jm.data = model;
return jm;
}
}
}
......@@ -62,26 +62,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers
_storeServices = storeServices;
}
//公共接口====================================================================================================
//验证接口====================================================================================================
#region 发票模糊查询==================================================
/// <summary>
/// 发票模糊查询
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetTaxCode([FromBody] GetTaxCodePost entity)
{
var jm = await _orderServices.GetTaxCode(entity.name);
return jm;
}
#endregion
#region 创建订单==================================================
/// <summary>
/// 创建订单
......@@ -144,59 +124,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers
}
#endregion
#region 订单预览==================================================
/// <summary>
/// 订单预览
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> OrderDetails([FromBody] FMStringId entity)
{
var jm = new WebApiCallBack();
var userId = _user.ID;
if ((string)entity.data == "merchant")
{
var store = await _storeServices.GetStoreByUserId(_user.ID);
if (store == null)
{
jm.status = false;
jm.msg = "你不是店员";
return jm;
}
else
{
userId = 0;
}
}
jm = await _orderServices.GetOrderInfoByOrderId(entity.id, userId);
return jm;
}
#endregion
#region 获取订单不同状态的数量==================================================
/// <summary>
/// 获取订单不同状态的数量
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetOrderStatusNum([FromBody] GetOrderStatusNumPost entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.ids))
{
jm.msg = "请提交要查询的订单统计类型";
}
var ids = CommonHelper.StringToIntArray(entity.ids);
jm = await _orderServices.GetOrderStatusNum(_user.ID, ids, entity.isAfterSale);
return jm;
}
#endregion
#region 获取个人订单列表=======================================================
/// <summary>
......@@ -284,203 +211,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers
}
#endregion
#region 添加售后单=======================================================
/// <summary>
/// 添加售后单
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> AddAftersales([FromBody] ToAddBillAfterSalesPost entity)
{
var jm = new WebApiCallBack();
jm.otherData = entity;
if (string.IsNullOrEmpty(entity.orderId))
{
jm.msg = GlobalErrorCodeVars.Code13100;
jm.code = 13100;
return jm;
}
if (entity.type == 0)
{
jm.msg = GlobalErrorCodeVars.Code10051;
jm.code = 10051;
return jm;
}
jm = await _aftersalesServices.ToAdd(_user.ID, entity.orderId, entity.type, entity.items, entity.images,
entity.reason, entity.refund);
return jm;
}
#endregion
#region 获取售后单列表=======================================================
/// <summary>
/// 获取售后单列表
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> AftersalesList([FromBody] FMPageByStringId entity)
{
var jm = new WebApiCallBack();
jm.status = true;
jm.msg = "数据获取成功";
var where = PredicateBuilder.True<CoreCmsBillAftersales>();
where = where.And(p => p.userId == _user.ID);
if (!string.IsNullOrEmpty(entity.order))
{
where = where.And(p => p.orderId == entity.id);
}
var data = await _aftersalesServices.QueryPageAsync(where, p => p.createTime, OrderByType.Desc, entity.page, entity.limit);
jm.data = new
{
list = data,
page = data.PageIndex,
totalPage = data.TotalPages,
hasNextPage = data.HasNextPage
};
return jm;
}
#endregion
#region 获取单个售后单详情
/// <summary>
/// 获取售后单列表
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> Aftersalesinfo([FromBody] FMStringId entity)
{
var jm = new WebApiCallBack { status = true, msg = "数据获取成功" };
var info = await _aftersalesServices.GetInfo(entity.id, _user.ID);
var allConfigs = await _settingServices.GetConfigDictionaries();
var reshipAddress = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ReshipAddress);
var reshipArea = string.Empty;
var reshipId = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ReshipAreaId).ObjectToInt(0);
if (reshipId > 0)
{
var result = await _areaServices.GetAreaFullName(reshipId);
if (result.status)
{
reshipArea = result.data.ToString();
}
}
var reshipMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ReshipMobile);
var reshipName = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ReshipName);
var reship = new
{
reshipAddress,
reshipArea,
reshipMobile,
reshipName
};
jm.data = new
{
info,
reship
};
return jm;
}
#endregion
#region 提交售后发货快递信息
/// <summary>
/// 提交售后发货快递信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> SendReship([FromBody] FMBillReshipForSendReshipPost entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.reshipId))
{
jm.data = jm.msg = GlobalErrorCodeVars.Code13212;
return jm;
}
else if (string.IsNullOrEmpty(entity.logiCode))
{
jm.data = jm.msg = GlobalErrorCodeVars.Code13213;
return jm;
}
else if (string.IsNullOrEmpty(entity.logiNo))
{
jm.data = jm.msg = GlobalErrorCodeVars.Code13214;
return jm;
}
var model = await _reshipServices.QueryByIdAsync(entity.reshipId);
if (model == null)
{
jm.data = jm.msg = GlobalErrorCodeVars.Code13211;
return jm;
}
var up = await _reshipServices.UpdateAsync(
p => new CoreCmsBillReship()
{
logiCode = entity.logiCode,
logiNo = entity.logiNo,
status = (int)GlobalEnumVars.BillReshipStatus.运输中
}, p => p.reshipId == entity.reshipId);
jm.status = true;
jm.msg = "数据保存成功";
return jm;
}
#endregion
#region 获取配送方式列表=======================================================
/// <summary>
/// 获取配送方式列表
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public WebApiCallBack GetShip([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack();
jm.msg = "暂未设置配送方式";
var ship = _shipServices.GetShip(entity.id);
if (ship != null)
{
jm.status = true;
jm.data = ship;
jm.msg = "获取成功";
}
return jm;
}
#endregion
#region 前台物流查询接口=======================================================
/// <summary>
......

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using AutoMapper;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 页面接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class PageController : ControllerBase
{
private IMapper _mapper;
private readonly ICoreCmsSettingServices _settingServices;
private readonly ICoreCmsPagesServices _pagesServices;
private readonly ICoreCmsOrderServices _orderServices;
private readonly ICoreCmsUserServices _userServices;
/// <summary>
/// 构造函数
/// </summary>
public PageController(IMapper mapper
, ICoreCmsSettingServices settingServices
, ICoreCmsPagesServices pagesServices
, ICoreCmsOrderServices orderServices
, ICoreCmsUserServices userServices)
{
_mapper = mapper;
_settingServices = settingServices;
_pagesServices = pagesServices;
_orderServices = orderServices;
_userServices = userServices;
}
//公共接口====================================================================================================
#region 获取页面布局数据=============================================================
/// <summary>
/// 获取页面布局数据
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("获取页面布局数据")]
public async Task<WebApiCallBack> GetPageConfig([FromBody] FMWxPost entity)
{
var jm = await _pagesServices.GetPageConfig(entity.code);
return jm;
}
#endregion
#region 获取用户购买记录=============================================================
/// <summary>
/// 获取用户购买记录
/// </summary>
[HttpPost]
[Description("获取用户购买记录")]
public async Task<WebApiCallBack> GetRecod([FromBody] FMGetRecodPost entity)
{
var jm = new WebApiCallBack() { status = true, msg = "获取成功", otherData = entity };
/***
* 随机数
* 其它随机数据,需要自己补充
*/
//logo作为头像
Random rand = new Random();
var allConfigs = await _settingServices.GetConfigDictionaries();
var avatar = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopLogo);
var names = new string[] { "无人像你", "啭裑①羣豞", "朕射妳无罪", "骑着蜗牛狂奔", "残孤星", "上网可以,别开QVOD", "请把QQ留下!", "蹭网可以,一小时两块钱", "I~在。哭泣", "不倾国倾城只倾他一人", "你再发光我就拔你插头", "家,世间最温暖的地方", "挥着鸡翅膀的女孩", "难不难过都是一个人过", "原谅我盛装出席只为错过你", "残孤星", "只适合被遗忘", "爱情,算个屁丶", "执子辶掱", "朕今晚翻你牌子", "①苆兜媞命", "中华一样的高傲", "始于心动止于枯骨", "我们幸福呢", "表白失败,勿扰", "髮型吥能亂", "陽咣丅啲憂喐", "你棺材是翻盖的还是滑盖的", "孤枕", "泪颜葬相思", "喵星人", "超拽霸气的微博名字", "晚安晚安晚晚难安", "却输给了秒", "为什么我吃德芙没有黑丝飘", "请输入我大" };
var listUsers = new List<RandUser>();
foreach (var itemName in names)
{
var min = rand.Next(100, 1000);
var createTime = DateTime.Now.AddMinutes(-min);
listUsers.Add(new RandUser()
{
avatar = avatar,
createTime = CommonHelper.TimeAgo(createTime),
nickname = itemName,
desc = "下单成功",
dt = createTime
});
}
if (entity.type == "home")
{
//数据库里面随机取出来几条数据
var orders = await _orderServices.QueryListByClauseAsync(p => p.isdel == false, 20, p => p.createTime,
OrderByType.Desc);
if (orders != null && orders.Any())
{
Random rd = new Random();
var index = rd.Next(orders.Count);
var orderItem = orders[index];
if (orderItem != null)
{
var user = await _userServices.QueryByIdAsync(orderItem.userId);
if (user != null && !string.IsNullOrEmpty(user.nickName))
{
jm.data = new RandUser()
{
avatar = !string.IsNullOrEmpty(user.avatarImage) ? user.avatarImage : avatar,
createTime = CommonHelper.TimeAgo(orderItem.createTime),
nickname = user.nickName,
desc = "下单成功",
dt = orderItem.createTime
};
}
}
}
else
{
Random rd = new Random();
var listI = rd.Next(listUsers.Count);
jm.data = listUsers[listI];
}
}
return jm;
}
#endregion
//验证接口====================================================================================================
}
}
\ No newline at end of file

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Model.ViewModels.DTO;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 支付调用接口数据
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class PaymentsController : ControllerBase
{
private IHttpContextUser _user;
private ICoreCmsBillPaymentsServices _billPaymentsServices;
private ICoreCmsPaymentsServices _paymentsServices;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="user"></param>
/// <param name="billPaymentsServices"></param>
/// <param name="paymentsServices"></param>
public PaymentsController(IHttpContextUser user
, ICoreCmsBillPaymentsServices billPaymentsServices
, ICoreCmsPaymentsServices paymentsServices
)
{
_user = user;
_billPaymentsServices = billPaymentsServices;
_paymentsServices = paymentsServices;
}
//公共接口====================================================================================================
#region 获取支付方式列表==================================================
/// <summary>
/// 获取支付方式列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetList()
{
var jm = new WebApiCallBack();
var list = await _paymentsServices.QueryListByClauseAsync(p => p.isEnable == true, p => p.sort, OrderByType.Asc);
jm.status = true;
jm.data = list;
return jm;
}
#endregion
//验证接口====================================================================================================
#region 支付确认页面取信息==================================================
/// <summary>
/// 支付确认页面取信息
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> CheckPay([FromBody] CheckPayPost entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.ids))
{
jm.msg = GlobalErrorCodeVars.Code13100;
return jm;
}
jm = await _billPaymentsServices.FormatPaymentRel(entity.ids, entity.paymentType, entity.@params);
return jm;
}
#endregion
#region 获取支付单详情==================================================
/// <summary>
/// 获取支付单详情
/// </summary>
/// <returns></returns>
[HttpPost]
[Authorize]
public async Task<WebApiCallBack> GetInfo([FromBody] FMStringId entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.id))
{
jm.msg = GlobalErrorCodeVars.Code13100;
return jm;
}
var userId = entity.data.ObjectToInt(0);
jm = await _billPaymentsServices.GetInfo(entity.id, userId);
return jm;
}
#endregion
}
}
\ No newline at end of file

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Auth.HttpContextUser;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 拼团接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class PinTuanController : ControllerBase
{
private readonly IHttpContextUser _user;
private readonly ICoreCmsPinTuanGoodsServices _pinTuanGoodsServices;
private readonly ICoreCmsPinTuanRuleServices _pinTuanRuleServices;
private readonly ICoreCmsProductsServices _productsServices;
private readonly ICoreCmsPinTuanRecordServices _pinTuanRecordServices;
private readonly ICoreCmsGoodsServices _goodsServices;
/// <summary>
/// 构造函数
/// </summary>
public PinTuanController(IHttpContextUser user
, ICoreCmsPinTuanGoodsServices pinTuanGoodsServices
, ICoreCmsPinTuanRuleServices pinTuanRuleServices
, ICoreCmsProductsServices productsServices
, ICoreCmsPinTuanRecordServices pinTuanRecordServices, ICoreCmsGoodsServices goodsServices)
{
_user = user;
_pinTuanGoodsServices = pinTuanGoodsServices;
_pinTuanRuleServices = pinTuanRuleServices;
_productsServices = productsServices;
_pinTuanRecordServices = pinTuanRecordServices;
_goodsServices = goodsServices;
}
#region 拼团列表
/// <summary>
/// 拼团列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetList([FromBody] FMIntId entity)
{
WebApiCallBack jm;
var userId = 0;
if (_user != null)
{
userId = _user.ID;
}
var id = 0;
if (entity.id > 0)
{
id = entity.id;
}
jm = await _pinTuanRuleServices.GetPinTuanList(id, userId);
return jm;
}
#endregion
#region 获取拼团商品信息
/// <summary>
/// 获取拼团商品信息
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetGoodsInfo([FromBody] FMIntId entity)
{
var jm = new WebApiCallBack();
var userId = 0;
if (_user != null)
{
userId = _user.ID;
}
var pinTuanStatus = entity.data.ObjectToInt(1);
jm.status = true;
jm.msg = "获取详情成功";
jm.data = await _pinTuanGoodsServices.GetGoodsInfo(entity.id, userId, pinTuanStatus);
return jm;
}
#endregion
#region 获取货品信息
/// <summary>
/// 获取货品信息
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetProductInfo([FromBody] FMGetProductInfo entity)
{
var jm = new WebApiCallBack();
var products = await _productsServices.GetProductInfo(entity.id, false, 0, entity.type);
if (products == null)
{
jm.msg = GlobalErrorCodeVars.Code10000;
return jm;
}
//把拼团的一些属性等加上
var info = await _pinTuanRuleServices.QueryMuchFirstAsync<CoreCmsPinTuanRule, CoreCmsPinTuanGoods, CoreCmsPinTuanRule>(
(join1, join2) => new object[] { JoinType.Left, join1.id == join2.ruleId },
(join1, join2) => join1, (join1, join2) => join2.goodsId == products.goodsId);
if (info == null)
{
jm.msg = GlobalErrorCodeVars.Code10000;
return jm;
}
products.pinTuanRule = info;
jm.status = true;
jm.data = products;
return jm;
}
#endregion
#region 根据订单id取拼团信息,用在订单详情页
/// <summary>
/// 根据订单id取拼团信息,用在订单详情页
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> GetPinTuanTeam([FromBody] FMGetPinTuanTeamPost entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.orderId) && entity.teamId == 0)
{
jm.msg = GlobalErrorCodeVars.Code15606;
return jm;
}
jm = await _pinTuanRecordServices.GetTeamList(entity.teamId, entity.orderId);
return jm;
}
#endregion
}
}
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Model.ViewModels.Email;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Helper;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
namespace CoreCms.Net.Web.WebApi.Controllers
{
/// <summary>
/// 用户测试事件
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class TestController : ControllerBase
{
private readonly EmailSenderHelper _emailSender;//发邮件的服务
/// <summary>
/// 构造函数注入
/// </summary>
/// <param name="emailSender"></param>
public TestController(EmailSenderHelper emailSender)
{
_emailSender = emailSender;
}
#region 用户邮箱发送===================================================================
/// <summary>
/// 用户邮箱发送
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
public async Task<WebApiCallBack> SendEmail([FromBody] FMSendEmail entity)
{
var jm = new WebApiCallBack();
if (string.IsNullOrEmpty(entity.email))
{
jm.msg = "请输入合法的邮箱地址";
return jm;
}
//发送验证码, 发送邮件
Random rd = new Random();
int codeNumber = rd.Next(100000, 999999);
var message = new MailMessageModel()
{
ToAddresses = new List<string> { entity.email },
Subject = "邮箱验证码",
Body = $"""
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>邮箱验证</title>
</head>
<body>
<div style="max-width: 600px; margin: 0 auto; font-family: Arial, sans-serif;">
<h2 style="color: #1e9fff;">邮箱验证请求</h2>
<p>您的验证码是:<strong style="font-size: 24px; letter-spacing: 2px;">
{codeNumber}
</strong></p>
<p>验证码将在30分钟后失效,请尽快使用。</p>
<hr style="border: 0; border-top: 1px solid #eee;">
<p style="color: #999; font-size: 12px;">此为系统邮件,请勿直接回复</p>
</div>
</body>
</html>
""",
IsBodyHtml = true
};
// 在应用启动代码前添加
System.Net.ServicePointManager.SecurityProtocol =
SecurityProtocolType.Tls12 | SecurityProtocolType.Tls13;
await _emailSender.SendWithMailKitAsync(message);
return jm;
}
#endregion
}
}
......@@ -14,7 +14,7 @@
dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient"
connectionString="Server=127.0.0.1;Database=BaseMIS;User ID=sa;Password=123456"
-->
<target name="log_database" xsi:type="Database" dbProvider="Microsoft.Data.SqlClient.SqlConnection, Microsoft.Data.SqlClient" connectionString="Server=192.168.8.109;Port=3306;Database=ShopERP;Uid=root;Pwd=123456;CharSet=utf8;pooling=true;SslMode=None;Allow User Variables=true;Convert Zero Datetime=True;Allow Zero Datetime=True;">
<target name="log_database" xsi:type="Database" dbProvider="MySql.Data.MySqlClient.MySqlConnection,Mysql.Data" connectionString="Server=192.168.8.109;Port=3306;Database=ShopERP;Uid=root;Pwd=123456;CharSet=utf8;pooling=true;SslMode=None;Allow User Variables=true;Convert Zero Datetime=True;Allow Zero Datetime=True;">
<commandText>
INSERT INTO SysNLogRecords
(LogDate,LogLevel,LogType,LogTitle,Logger,Message,MachineName,MachineIp,NetRequestMethod
......
License text copyright (c) 2020 MariaDB Corporation Ab, All Rights Reserved.
"Business Source License" is a trademark of MariaDB Corporation Ab.
Parameters
Licensor: HashiCorp, Inc.
Licensed Work: Consul Version 1.17.0 or later. The Licensed Work is (c) 2024
HashiCorp, Inc.
Additional Use Grant: You may make production use of the Licensed Work, provided
Your use does not include offering the Licensed Work to third
parties on a hosted or embedded basis in order to compete with
HashiCorp's paid version(s) of the Licensed Work. For purposes
of this license:
A "competitive offering" is a Product that is offered to third
parties on a paid basis, including through paid support
arrangements, that significantly overlaps with the capabilities
of HashiCorp's paid version(s) of the Licensed Work. If Your
Product is not a competitive offering when You first make it
generally available, it will not become a competitive offering
later due to HashiCorp releasing a new version of the Licensed
Work with additional capabilities. In addition, Products that
are not provided on a paid basis are not competitive.
"Product" means software that is offered to end users to manage
in their own environments or offered as a service on a hosted
basis.
"Embedded" means including the source code or executable code
from the Licensed Work in a competitive offering. "Embedded"
also means packaging the competitive offering in such a way
that the Licensed Work must be accessed or downloaded for the
competitive offering to operate.
Hosting or using the Licensed Work(s) for internal purposes
within an organization is not considered a competitive
offering. HashiCorp considers your organization to include all
of your affiliates under common control.
For binding interpretive guidance on using HashiCorp products
under the Business Source License, please visit our FAQ.
(https://www.hashicorp.com/license-faq)
Change Date: Four years from the date the Licensed Work is published.
Change License: MPL 2.0
For information about alternative licensing arrangements for the Licensed Work,
please contact licensing@hashicorp.com.
Notice
Business Source License 1.1
Terms
The Licensor hereby grants you the right to copy, modify, create derivative
works, redistribute, and make non-production use of the Licensed Work. The
Licensor may make an Additional Use Grant, above, permitting limited production use.
Effective on the Change Date, or the fourth anniversary of the first publicly
available distribution of a specific version of the Licensed Work under this
License, whichever comes first, the Licensor hereby grants you rights under
the terms of the Change License, and the rights granted in the paragraph
above terminate.
If your use of the Licensed Work does not comply with the requirements
currently in effect as described in this License, you must purchase a
commercial license from the Licensor, its affiliated entities, or authorized
resellers, or you must refrain from using the Licensed Work.
All copies of the original and modified Licensed Work, and derivative works
of the Licensed Work, are subject to this License. This License applies
separately for each version of the Licensed Work and the Change Date may vary
for each version of the Licensed Work released by Licensor.
You must conspicuously display this License on each original or modified copy
of the Licensed Work. If you receive the Licensed Work in original or
modified form from a third party, the terms and conditions set forth in this
License apply to your use of that work.
Any use of the Licensed Work in violation of this License will automatically
terminate your rights under this License for the current and all other
versions of the Licensed Work.
This License does not grant you any right in any trademark or logo of
Licensor or its affiliates (provided that you may use a trademark or logo of
Licensor as expressly required by this License).
TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
TITLE.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment