fixed 修改自营内容,添加领券中心接口
This commit is contained in:
parent
3ed452c803
commit
c729e8cf50
@ -14,6 +14,7 @@ namespace ARW.Model.Dto.Api.Marketing.CouponManage.Coupons
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class CouponQueryDtoApi : PagerInfo
|
public class CouponQueryDtoApi : PagerInfo
|
||||||
{
|
{
|
||||||
|
public long CustomerGuid { get; set; }
|
||||||
public long ShopGuid { get; set; }
|
public long ShopGuid { get; set; }
|
||||||
public string CouponName { get; set; }
|
public string CouponName { get; set; }
|
||||||
public int? CouponType { get; set; }
|
public int? CouponType { get; set; }
|
||||||
|
@ -21,13 +21,10 @@ namespace ARW.Model.Dto.Business.Marketing.CouponManage.CustomerCoupons
|
|||||||
[Required(ErrorMessage = "优惠劵guid不能为空")]
|
[Required(ErrorMessage = "优惠劵guid不能为空")]
|
||||||
public long CouponGuid { get; set; }
|
public long CouponGuid { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "客户guid不能为空")]
|
|
||||||
public long CustomerGuid { get; set; }
|
public long CustomerGuid { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "是否过期不能为空")]
|
|
||||||
public int CustomerCouponIsExpired { get; set; }
|
public int CustomerCouponIsExpired { get; set; }
|
||||||
|
|
||||||
[Required(ErrorMessage = "是否已使用不能为空")]
|
|
||||||
public int CustomerCouponIsUsed { get; set; }
|
public int CustomerCouponIsUsed { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ namespace ARW.Model.Vo.Api.Marketing.CouponManage.CustomerCoupons
|
|||||||
/// 描述 : CouponGuid
|
/// 描述 : CouponGuid
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(ValueToStringConverter))]
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
[JsonIgnore]
|
|
||||||
public long CouponGuid { get; set; }
|
public long CouponGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,10 +29,12 @@ namespace ARW.Service.Api.BusinessService.Marketing.CouponManage.Coupons
|
|||||||
public class CouponServiceImplApi : BaseService<Coupon>, ICouponServiceApi
|
public class CouponServiceImplApi : BaseService<Coupon>, ICouponServiceApi
|
||||||
{
|
{
|
||||||
private readonly CouponRepository _CouponRepository;
|
private readonly CouponRepository _CouponRepository;
|
||||||
|
private readonly CustomerCouponRepository _CustomerCouponRepository;
|
||||||
|
|
||||||
public CouponServiceImplApi(CouponRepository CouponRepository)
|
public CouponServiceImplApi(CouponRepository CouponRepository, CustomerCouponRepository customerCouponRepository)
|
||||||
{
|
{
|
||||||
this._CouponRepository = CouponRepository;
|
this._CouponRepository = CouponRepository;
|
||||||
|
_CustomerCouponRepository = customerCouponRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Api接口代码
|
#region Api接口代码
|
||||||
@ -85,6 +87,12 @@ namespace ARW.Service.Api.BusinessService.Marketing.CouponManage.Coupons
|
|||||||
item.TimeLimit = firstTime + "-" + lastTime;
|
item.TimeLimit = firstTime + "-" + lastTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理领取状态
|
||||||
|
var customerCoupon = await _CustomerCouponRepository.GetFirstAsync(s => s.CouponGuid == item.CouponGuid && s.CustomerGuid == parm.CustomerGuid);
|
||||||
|
if (customerCoupon != null)
|
||||||
|
item.Status = 5;
|
||||||
|
else item.Status = 4;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +115,28 @@ namespace ARW.Service.Api.BusinessService.Marketing.CouponManage.CustomerCoupons
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 领取优惠券
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> AddCustomerCoupon(CustomerCoupon model)
|
||||||
|
{
|
||||||
|
model.CustomerCouponIsExpired = 1;
|
||||||
|
model.CustomerCouponIsUsed = 1;
|
||||||
|
|
||||||
|
var response = await _CustomerCouponRepository.InsertReturnSnowflakeIdAsync(model);
|
||||||
|
if (response != 0)
|
||||||
|
{
|
||||||
|
await _CouponRepository.UpdateAsync(f => new Coupon
|
||||||
|
{
|
||||||
|
CouponGetNumber = f.CouponGetNumber + 1
|
||||||
|
}, s => s.CouponGuid == model.CouponGuid);
|
||||||
|
}
|
||||||
|
return "领取成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询领券记录详情(Api)
|
/// 查询领券记录详情(Api)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -120,8 +120,8 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
|||||||
|
|
||||||
|
|
||||||
// 获取金额
|
// 获取金额
|
||||||
var price = 1;//单位:分
|
//var price = 1;//单位:分
|
||||||
//int price = (int)(afterPriceRes.DiscountPrice * 100);//单位:分
|
int price = (int)(afterPriceRes.DiscountPrice * 100);//单位:分
|
||||||
|
|
||||||
|
|
||||||
// 生成订单号
|
// 生成订单号
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using ARW.Model;
|
using ARW.Model;
|
||||||
using ARW.Model.Dto.Api.Marketing.CouponManage.CustomerCoupons;
|
using ARW.Model.Dto.Api.Marketing.CouponManage.CustomerCoupons;
|
||||||
|
using ARW.Model.Dto.Business.Marketing.CouponManage.CustomerCoupons;
|
||||||
using ARW.Model.Models.Business.Marketing.CouponManage.CustomerCoupons;
|
using ARW.Model.Models.Business.Marketing.CouponManage.CustomerCoupons;
|
||||||
using ARW.Model.Vo.Api.Marketing.CouponManage.CustomerCoupons;
|
using ARW.Model.Vo.Api.Marketing.CouponManage.CustomerCoupons;
|
||||||
|
|
||||||
@ -25,7 +26,16 @@ namespace ARW.Service.Api.IBusinessService.Marketing.CouponManage.CustomerCoupon
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<CustomerCouponVoApi>> GetCustomerCouponListApi(CustomerCouponQueryDtoApi parm);
|
Task<List<CustomerCouponVoApi>> GetCustomerCouponListApi(CustomerCouponQueryDtoApi parm);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// 领取优惠券
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<string> AddCustomerCoupon(CustomerCoupon parm);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// 获取领券记录详情(Api)
|
/// 获取领券记录详情(Api)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parm"></param>
|
/// <param name="parm"></param>
|
||||||
|
@ -15,6 +15,7 @@ using ARW.Model.Models.Business.Marketing.CouponManage.Coupons;
|
|||||||
using ARW.Model.Vo.Api.Marketing.CouponManage.Coupons;
|
using ARW.Model.Vo.Api.Marketing.CouponManage.Coupons;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Geocoding;
|
using Geocoding;
|
||||||
|
using ARW.Admin.WebApi.Framework;
|
||||||
|
|
||||||
namespace ARW.WebApi.Controllers.Api.Marketing.CouponManage.Coupons
|
namespace ARW.WebApi.Controllers.Api.Marketing.CouponManage.Coupons
|
||||||
{
|
{
|
||||||
@ -48,6 +49,8 @@ namespace ARW.WebApi.Controllers.Api.Marketing.CouponManage.Coupons
|
|||||||
[HttpGet("getCouponList")]
|
[HttpGet("getCouponList")]
|
||||||
public async Task<IActionResult> GetCouponListApi([FromQuery] CouponQueryDtoApi parm)
|
public async Task<IActionResult> GetCouponListApi([FromQuery] CouponQueryDtoApi parm)
|
||||||
{
|
{
|
||||||
|
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||||
|
parm.CustomerGuid = user.UserId;
|
||||||
var res = await _CouponServiceApi.GetCouponListApi(parm);
|
var res = await _CouponServiceApi.GetCouponListApi(parm);
|
||||||
return SUCCESS(res);
|
return SUCCESS(res);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ using ARW.Model.Vo.Api.Marketing.CouponManage.CustomerCoupons;
|
|||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Geocoding;
|
using Geocoding;
|
||||||
using ARW.Admin.WebApi.Framework;
|
using ARW.Admin.WebApi.Framework;
|
||||||
|
using ARW.Model.Dto.Business.Marketing.CouponManage.CustomerCoupons;
|
||||||
|
using ARW.Service.Business.IBusinessService.Marketing.CouponManage.CustomerCoupons;
|
||||||
|
|
||||||
namespace ARW.WebApi.Controllers.Api.Marketing.CouponManage.CustomerCoupons
|
namespace ARW.WebApi.Controllers.Api.Marketing.CouponManage.CustomerCoupons
|
||||||
{
|
{
|
||||||
@ -55,7 +57,28 @@ namespace ARW.WebApi.Controllers.Api.Marketing.CouponManage.CustomerCoupons
|
|||||||
return SUCCESS(res);
|
return SUCCESS(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
|
/// <summary>
|
||||||
|
/// 领取优惠券
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("addCustomerCoupon")]
|
||||||
|
[Log(Title = "领取优惠券", BusinessType = BusinessType.ADDORUPDATE)]
|
||||||
|
public async Task<IActionResult> AddCustomerCoupon([FromBody] CustomerCouponDto parm)
|
||||||
|
{
|
||||||
|
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||||
|
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||||
|
parm.CustomerGuid = user.UserId;
|
||||||
|
|
||||||
|
var modal = parm.Adapt<CustomerCoupon>().ToCreate(HttpContext);
|
||||||
|
|
||||||
|
var res = await _CustomerCouponServiceApi.AddCustomerCoupon(modal);
|
||||||
|
return SUCCESS(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// 获取CustomerCoupon详情(Api)
|
/// 获取CustomerCoupon详情(Api)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="parm">查询参数</param>
|
/// <param name="parm">查询参数</param>
|
||||||
|
@ -80,8 +80,8 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
|||||||
var payment = await _PayServiceApi.GetFirstAsync(s => s.PaymentGuid == order.PaymentGuid);
|
var payment = await _PayServiceApi.GetFirstAsync(s => s.PaymentGuid == order.PaymentGuid);
|
||||||
|
|
||||||
// 获取金额
|
// 获取金额
|
||||||
var price = 1;//单位:分
|
//var price = 1;//单位:分
|
||||||
//var price = payment.PaymentBeforeMoney;//单位:分
|
var price = (int)(payment.PaymentBeforeMoney * 100);//单位:分
|
||||||
|
|
||||||
var orderNo = Common.Common.CreateNoQuery();
|
var orderNo = Common.Common.CreateNoQuery();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user