diff --git a/ARW.Model/Dto/Api/Marketing/CouponManage/Coupons/CouponApiDto.cs b/ARW.Model/Dto/Api/Marketing/CouponManage/Coupons/CouponApiDto.cs
new file mode 100644
index 0000000..b07e7f1
--- /dev/null
+++ b/ARW.Model/Dto/Api/Marketing/CouponManage/Coupons/CouponApiDto.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using ARW.Model.Models.Business.Marketing.CouponManage.Coupons;
+
+namespace ARW.Model.Dto.Api.Marketing.CouponManage.Coupons
+{
+
+ ///
+ /// 优惠券查询对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-08-01
+ ///
+ public class CouponQueryDtoApi : PagerInfo
+ {
+ public string CouponName { get; set; }
+ public int? CouponType { get; set; }
+ public int? CouponExpireType { get; set; }
+ public int? CouponApplicableScope { get; set; }
+ public int? CouponDisplayStatus { get; set; }
+ }
+
+
+ ///
+ /// 优惠券详情输入对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-08-01
+ ///
+ public class CouponDtoApi
+ {
+ [Required(ErrorMessage = "CouponGuid不能为空")]
+ public long CouponGuid { get; set; }
+ }
+
+}
diff --git a/ARW.Model/Vo/Api/Marketing/CouponManage/Coupons/CouponApiVo.cs b/ARW.Model/Vo/Api/Marketing/CouponManage/Coupons/CouponApiVo.cs
new file mode 100644
index 0000000..7380858
--- /dev/null
+++ b/ARW.Model/Vo/Api/Marketing/CouponManage/Coupons/CouponApiVo.cs
@@ -0,0 +1,182 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Api.Marketing.CouponManage.Coupons
+{
+ ///
+ /// 优惠券展示对象Api
+ ///
+ /// @author lwh
+ /// @date 2023-08-01
+ ///
+ public class CouponVoApi
+ {
+
+
+ ///
+ /// 描述 :
+ ///
+ [EpplusIgnore]
+ public int CouponId { get; set; }
+
+
+ ///
+ /// 描述 :
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [EpplusIgnore]
+ public long CouponGuid { get; set; }
+
+
+ ///
+ /// 描述 :优惠劵名称
+ ///
+ [EpplusTableColumn(Header = "优惠劵名称")]
+ public string CouponName { get; set; }
+
+
+ ///
+ /// 描述 :优惠劵类型
+ ///
+ [EpplusTableColumn(Header = "优惠劵类型")]
+ public int CouponType { get; set; }
+
+
+ ///
+ /// 描述 :减免金额
+ ///
+ [EpplusIgnore]
+ public decimal CouponDeductionMoney { get; set; }
+
+
+ ///
+ /// 描述 :折扣率
+ ///
+ [EpplusIgnore]
+ public float CouponDiscountRate { get; set; }
+
+
+ ///
+ /// 描述 :最低消费金额
+ ///
+ [EpplusTableColumn(Header = "最低消费金额")]
+ public decimal CouponMinConsumeMoney { get; set; }
+
+
+ ///
+ /// 描述 :到期类型
+ ///
+ [EpplusTableColumn(Header = "到期类型")]
+ public int CouponExpireType { get; set; }
+
+
+ ///
+ /// 描述 :有效天数
+ ///
+ [EpplusIgnore]
+ public int? CouponEffectiveDays { get; set; }
+
+
+ ///
+ /// 描述 :固定时间-开始时间
+ ///
+ [EpplusIgnore]
+ public DateTime? CouponFixedStartTime { get; set; }
+
+
+ ///
+ /// 描述 :固定时间-结束时间
+ ///
+ [EpplusIgnore]
+ public DateTime? CouponFixedEndTime { get; set; }
+
+
+ ///
+ /// 描述 :适用范围
+ ///
+ [EpplusIgnore]
+ public int? CouponApplicableScope { get; set; }
+
+
+
+ ///
+ /// 描述 :发送数量(-1不限制)
+ ///
+ [EpplusTableColumn(Header = "发送数量(-1不限制)")]
+ public int CouponSendNumber { get; set; }
+
+
+
+ ///
+ /// 描述 :显示状态
+ ///
+ [EpplusTableColumn(Header = "显示状态")]
+ public int CouponDisplayStatus { get; set; }
+
+
+ ///
+ /// 描述 :排序
+ ///
+ [EpplusTableColumn(Header = "排序")]
+ public int CouponSort { get; set; }
+
+ }
+
+
+ ///
+ /// 优惠券详情展示对象Api
+ ///
+ public class CouponApiDetailsVo
+ {
+ ///
+ /// 描述 : Key
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long Key { get; set; }
+
+
+ ///
+ /// 描述 :优惠劵类型
+ ///
+ public int Type { get; set; }
+
+ ///
+ /// 描述 :优惠劵状态
+ ///
+ public int Status { get; set; }
+
+ ///
+ /// 描述 :折扣或者满减值
+ ///
+ public string Value { get; set; }
+
+
+ ///
+ /// 描述 :描述
+ ///
+ public string Desc { get; set; }
+
+
+ ///
+ /// 描述 :标题
+ ///
+ public string Title { get; set; }
+
+ ///
+ /// 描述 :订单底价,满n元
+ ///
+ public decimal Base { get; set; }
+
+ ///
+ /// 描述 :有效时间限制
+ ///
+ public string TimeLimit { get; set; }
+
+ [JsonIgnore]
+ public DateTime CreateTime { get; set; }
+
+ }
+
+}
diff --git a/ARW.Service/Api/BusinessService/Marketing/CouponManage/Coupons/CouponServiceApi.cs b/ARW.Service/Api/BusinessService/Marketing/CouponManage/Coupons/CouponServiceApi.cs
new file mode 100644
index 0000000..73ffdd9
--- /dev/null
+++ b/ARW.Service/Api/BusinessService/Marketing/CouponManage/Coupons/CouponServiceApi.cs
@@ -0,0 +1,111 @@
+using Infrastructure.Attribute;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Repository;
+using ARW.Repository.Business.Marketing.CouponManage.Coupons;
+using ARW.Service.Api.IBusinessService.Marketing.CouponManage.Coupons;
+using ARW.Model.Dto.Api.Marketing.CouponManage.Coupons;
+using ARW.Model.Models.Business.Marketing.CouponManage.Coupons;
+using ARW.Model.Vo.Api.Marketing.CouponManage.Coupons;
+using Senparc.Weixin.WxOpen.AdvancedAPIs.Tcb;
+
+namespace ARW.Service.Api.BusinessService.Marketing.CouponManage.Coupons
+{
+ ///
+ /// 优惠券接口实现类Api
+ ///
+ /// @author lwh
+ /// @date 2023-08-01
+ ///
+ [AppService(ServiceType = typeof(ICouponServiceApi), ServiceLifetime = LifeTime.Transient)]
+ public class CouponServiceImplApi : BaseService, ICouponServiceApi
+ {
+ private readonly CouponRepository _CouponRepository;
+
+ public CouponServiceImplApi(CouponRepository CouponRepository)
+ {
+ this._CouponRepository = CouponRepository;
+ }
+
+ #region Api接口代码
+
+
+ ///
+ /// 查询优惠券列表(Api)
+ ///
+ ///
+ ///
+ public async Task> GetCouponListApi(CouponQueryDtoApi parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CouponName), s => s.CouponName == parm.CouponName);
+ predicate = predicate.AndIF(parm.CouponType != null, s => s.CouponType == parm.CouponType);
+ predicate = predicate.AndIF(parm.CouponExpireType != null, s => s.CouponExpireType == parm.CouponExpireType);
+ predicate = predicate.AndIF(parm.CouponApplicableScope != null, s => s.CouponApplicableScope == parm.CouponApplicableScope);
+ predicate = predicate.AndIF(parm.CouponDisplayStatus != null, s => s.CouponDisplayStatus == parm.CouponDisplayStatus);
+ var query = _CouponRepository
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .OrderBy(s => s.CouponSort, OrderByType.Desc)
+ .Select(s => new CouponVoApi
+ {
+ CouponId = s.CouponId,
+ CouponGuid = s.CouponGuid,
+ CouponName = s.CouponName,
+ CouponType = s.CouponType,
+ CouponDeductionMoney = s.CouponDeductionMoney,
+ CouponDiscountRate = s.CouponDiscountRate,
+ CouponMinConsumeMoney = s.CouponMinConsumeMoney,
+ CouponExpireType = s.CouponExpireType,
+ CouponEffectiveDays = s.CouponEffectiveDays,
+ CouponFixedStartTime = s.CouponFixedStartTime,
+ CouponFixedEndTime = s.CouponFixedEndTime,
+ CouponApplicableScope = s.CouponApplicableScope,
+ CouponSendNumber = s.CouponSendNumber,
+ CouponDisplayStatus = s.CouponDisplayStatus,
+ CouponSort = s.CouponSort,
+ });
+
+
+ return await query.ToPageAsync(parm);
+ }
+
+ ///
+ /// 查询优惠券详情(Api)
+ ///
+ ///
+ ///
+ public async Task GetCouponDetails(CouponDtoApi parm)
+ {
+
+ var query = _CouponRepository
+ .Queryable()
+ .Where(s => s.CouponGuid == parm.CouponGuid)
+ .Select(s => new CouponApiDetailsVo
+ {
+ Key = s.CouponGuid,
+ Type = s.CouponType,
+ Value = s.CouponDeductionMoney != 0 ? s.CouponDeductionMoney.ToString() : s.CouponDiscountRate.ToString(),
+ Desc = s.CouponDesc,
+ Title = s.CouponName,
+ Base = s.CouponMinConsumeMoney,
+ CreateTime = s.Create_time
+ }).Take(1);
+
+
+ return await query.ToJsonAsync();
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/ARW.Service/Api/IBusinessService/Marketing/CouponManage/Coupons/ICouponServiceApi.cs b/ARW.Service/Api/IBusinessService/Marketing/CouponManage/Coupons/ICouponServiceApi.cs
new file mode 100644
index 0000000..4b11a41
--- /dev/null
+++ b/ARW.Service/Api/IBusinessService/Marketing/CouponManage/Coupons/ICouponServiceApi.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Api.Marketing.CouponManage.Coupons;
+using ARW.Model.Models.Business.Marketing.CouponManage.Coupons;
+using ARW.Model.Vo.Api.Marketing.CouponManage.Coupons;
+
+namespace ARW.Service.Api.IBusinessService.Marketing.CouponManage.Coupons
+{
+ ///
+ /// 优惠券接口类Api
+ ///
+ /// @author lwh
+ /// @date 2023-08-01
+ ///
+ public interface ICouponServiceApi : IBaseService
+ {
+ ///
+ /// 获取优惠券分页列表(Api)
+ ///
+ ///
+ ///
+ Task> GetCouponListApi(CouponQueryDtoApi parm);
+
+ ///
+ /// 获取优惠券详情(Api)
+ ///
+ ///
+ ///
+ Task GetCouponDetails(CouponDtoApi parm);
+
+ }
+}
diff --git a/ARW.WebApi/Controllers/Api/Marketing/CouponManage/Coupons/CouponApiController.cs b/ARW.WebApi/Controllers/Api/Marketing/CouponManage/Coupons/CouponApiController.cs
new file mode 100644
index 0000000..3e87ffe
--- /dev/null
+++ b/ARW.WebApi/Controllers/Api/Marketing/CouponManage/Coupons/CouponApiController.cs
@@ -0,0 +1,81 @@
+using Infrastructure;
+using Infrastructure.Attribute;
+using Infrastructure.Enums;
+using Infrastructure.Model;
+using Mapster;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using ARW.Admin.WebApi.Extensions;
+using ARW.Admin.WebApi.Filters;
+using ARW.Common;
+using ARW.Admin.WebApi.Controllers;
+using ARW.Model.Dto.Api.Marketing.CouponManage.Coupons;
+using ARW.Service.Api.IBusinessService.Marketing.CouponManage.Coupons;
+using ARW.Model.Models.Business.Marketing.CouponManage.Coupons;
+using ARW.Model.Vo.Api.Marketing.CouponManage.Coupons;
+using Microsoft.AspNetCore.Authorization;
+using Geocoding;
+
+namespace ARW.WebApi.Controllers.Api.Marketing.CouponManage.Coupons
+{
+ /// f
+ /// 优惠券控制器Api
+ ///
+ /// @author lwh
+ /// @date 2023-08-01
+ ///
+ [Verify]
+ [Route("api/[controller]")]
+ public class CouponApiController : BaseController
+ {
+ private readonly ICouponServiceApi _CouponServiceApi;
+
+ ///
+ /// 依赖注入
+ ///
+ /// 优惠券优惠券Api服务
+ public CouponApiController(ICouponServiceApi CouponServiceApi)
+ {
+ _CouponServiceApi = CouponServiceApi;
+ }
+
+
+ ///
+ /// 获取优惠券列表(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getCouponList")]
+ public async Task GetCouponListApi([FromQuery] CouponQueryDtoApi parm)
+ {
+ var res = await _CouponServiceApi.GetCouponListApi(parm);
+ return SUCCESS(res);
+ }
+
+ ///
+ /// 获取Coupon详情(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getCouponDetails")]
+ public async Task GetCouponDetails([FromQuery] CouponDtoApi parm)
+ {
+ //if (parm == null) throw new CustomException("参数错误!");
+
+ var res = await _CouponServiceApi.GetCouponDetails(parm);
+
+ if (res != "[]")
+ {
+ res = res.Remove(0, 1);
+ res = res.Substring(0, res.Length - 1);
+ var data = res.FromJSON();
+ return SUCCESS(data);
+ }
+ else
+ {
+ return SUCCESS(res);
+ }
+ }
+
+ }
+}