feat 添加支付后的操作,添加首页推荐
This commit is contained in:
parent
1527a229f6
commit
d194f85676
@ -19,7 +19,7 @@ namespace ARW.Model.Dto.Api.GoodsManager.Goodss
|
||||
/// <summary>
|
||||
/// 店铺经营类目
|
||||
/// </summary>
|
||||
public long? GoodsCategoryGuid { get; set; }
|
||||
public long GoodsCategoryGuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 店铺商品类目
|
||||
|
@ -55,6 +55,16 @@ namespace ARW.Model.Models.Business.OrderManage.Orders
|
||||
public long CustomerGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :购物车Id
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[EpplusTableColumn(Header = "购物车Id")]
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "cart_ids")]
|
||||
public string CartIds { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :订单号
|
||||
/// 空值 : false
|
||||
|
31
ARW.Model/Vo/Api/Home/HomeCategoryApiVo.cs
Normal file
31
ARW.Model/Vo/Api/Home/HomeCategoryApiVo.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ARW.Model.Vo.Api.Home
|
||||
{
|
||||
/// <summary>
|
||||
/// 首页推荐类目展示对象Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-07-08
|
||||
/// </summary>
|
||||
public class HomeCategoryApiVo
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 : 名称
|
||||
/// </summary>
|
||||
public string Text { get; set; }
|
||||
|
||||
|
||||
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long Key { get; set; }
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -13,6 +13,7 @@ using ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Dto.Api.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Vo.Api.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Vo.Api.Home;
|
||||
|
||||
namespace ARW.Service.Api.BusinessService.GoodsManager.GoodsCategorys
|
||||
{
|
||||
@ -63,6 +64,33 @@ namespace ARW.Service.Api.BusinessService.GoodsManager.GoodsCategorys
|
||||
return await query.ToTreeAsync(it => it.Children, it => it.ParentGuid, 0);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取首页推荐类目列表(Api)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<HomeCategoryApiVo>> GetHomeCategoryListApi()
|
||||
{
|
||||
var query = _GoodsCategoryRepository
|
||||
.Queryable()
|
||||
.Where(s => s.GoodsCategoryIsPopular == 1)
|
||||
.OrderBy(s => s.ProductCategorySort, OrderByType.Asc)
|
||||
.Select((s) => new HomeCategoryApiVo
|
||||
{
|
||||
Key = s.GoodsCategoryGuid,
|
||||
Text = s.GoodsCategoryName,
|
||||
});
|
||||
|
||||
var list = await query.ToListAsync();
|
||||
|
||||
//for (int i = 0; i < list.Count; i++)
|
||||
//{
|
||||
// list[i].Key = i + 1;
|
||||
//}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace ARW.Service.Api.BusinessService.GoodsManager.Goodss
|
||||
{
|
||||
//开始拼装查询条件
|
||||
var predicate = Expressionable.Create<Goods>();
|
||||
//string[] goodsCategoryArr = null;
|
||||
string[] goodsCategoryArr = null;
|
||||
|
||||
// 检索经营类目
|
||||
//if (parm.GoodsCategoryGuid != null)
|
||||
@ -106,7 +106,7 @@ namespace ARW.Service.Api.BusinessService.GoodsManager.Goodss
|
||||
.Queryable()
|
||||
.LeftJoin<Shop>((s, c) => s.ShopGuid == c.ShopGuid)
|
||||
.Where(predicate.ToExpression())
|
||||
.WhereIF(parm.GoodsCategoryGuid != null, (s, c) => c.ShopBusinessCategoryGuid == parm.GoodsCategoryGuid)
|
||||
.WhereIF(parm.GoodsCategoryGuid != 0, (s, c) => c.ShopBusinessCategoryGuid == parm.GoodsCategoryGuid)
|
||||
//.WhereIF(parm.GoodsCategoryGuid != null, (s, c) => c.ShopBusinessCategoryGuid == parm.GoodsCategoryGuid || goodsCategoryArr.Contains(c.ShopBusinessCategoryGuid.ToString()))
|
||||
.Where(s => s.GoodsShelfStatus == 1)
|
||||
.OrderByIF(parm.GoodsSort == 0, s => s.GoodsSort, OrderByType.Asc)
|
||||
|
@ -23,7 +23,14 @@ using ARW.Repository.Business.OrderManage.OrderGoodss;
|
||||
using ARW.Repository.Business.OrderManage.OrderCustomerAddreses;
|
||||
using ARW.Repository.Business.Custom.CustomerAddresses;
|
||||
using ARW.Model.Models.Business.OrderManage.OrderCustomerAddreses;
|
||||
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
using Senparc.Weixin.TenPayV3.Apis.BasePay;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Models.Business.Carts;
|
||||
using ARW.Repository.Business.Marketing.CouponManage.CustomerCoupons;
|
||||
using ARW.Model.Models.Business.Marketing.CouponManage.CustomerCoupons;
|
||||
using ARW.Model.Vo.Business.Marketing.CouponManage.CustomerCoupons;
|
||||
|
||||
namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
{
|
||||
@ -53,10 +60,11 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
private readonly OrderGoodsRepository _OrderGoodsRepository;
|
||||
private readonly OrderCustomerAddressRepository _OrderCustomerAddressRepository;
|
||||
private readonly CustomerAddressRepository _CustomerAddressRepository;
|
||||
private readonly CustomerCouponRepository _CustomerCouponRepository;
|
||||
|
||||
|
||||
|
||||
public PayServiceApi(ShopRepository ShopRepository, GoodsCategoryRepository goodsCategoryRepository, CustomerRepository customerRepository, OrderRepository orderRepository, PaymentRepository paymentRepository, CouponRepository couponRepository, SenparcHttpClient httpClient, GoodsRepository goodsRepository, GoodsSkuRepository goodsSkuRepository, IGoodsServiceApi goodsServiceApi, CartRepository cartRepository, OrderGoodsRepository orderGoodsRepository, OrderCustomerAddressRepository orderCustomerAddressRepository, CustomerAddressRepository customerAddressRepository)
|
||||
public PayServiceApi(ShopRepository ShopRepository, GoodsCategoryRepository goodsCategoryRepository, CustomerRepository customerRepository, OrderRepository orderRepository, PaymentRepository paymentRepository, CouponRepository couponRepository, SenparcHttpClient httpClient, GoodsRepository goodsRepository, GoodsSkuRepository goodsSkuRepository, IGoodsServiceApi goodsServiceApi, CartRepository cartRepository, OrderGoodsRepository orderGoodsRepository, OrderCustomerAddressRepository orderCustomerAddressRepository, CustomerAddressRepository customerAddressRepository, CustomerCouponRepository customerCouponRepository)
|
||||
{
|
||||
this._ShopRepository = ShopRepository;
|
||||
_GoodsCategoryRepository = goodsCategoryRepository;
|
||||
@ -72,15 +80,43 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
_OrderGoodsRepository = orderGoodsRepository;
|
||||
_OrderCustomerAddressRepository = orderCustomerAddressRepository;
|
||||
_CustomerAddressRepository = customerAddressRepository;
|
||||
_CustomerCouponRepository = customerCouponRepository;
|
||||
}
|
||||
|
||||
#region Api接口代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 统一下单的业务处理
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="CustomException"></exception>
|
||||
public async Task<PayParams> HandelPrePay(CommitPayDtoApi parm)
|
||||
{
|
||||
/* 计算核销前价格(商品总额) */
|
||||
var goodsPrice = await CalculateBeforePrice(parm);
|
||||
|
||||
/* 计算运费 */
|
||||
GoodsFreightDto goodsFreightDto = new()
|
||||
{
|
||||
GoodsRequestList = parm.GoodsRequestList,
|
||||
CustomerAddressGuid = parm.CustomerAddressGuid,
|
||||
};
|
||||
var freight = await _GoodsServiceApi.GetGoodsFreight(goodsFreightDto);
|
||||
var totalPrice = goodsPrice + freight;
|
||||
|
||||
/* 计算核销前后价格(优惠后价格) */
|
||||
var afterPriceRes = await CalculateAfterPrice(parm);
|
||||
if (parm.TotalAmount != afterPriceRes.DiscountPrice) throw new CustomException("前端传递金额不合法!下单失败!");
|
||||
parm.TotalAmount = afterPriceRes.DiscountPrice;
|
||||
|
||||
|
||||
// 获取金额
|
||||
var price = 1;//单位:分
|
||||
//int price = (int)(afterPriceRes.DiscountPrice * 100);//单位:分
|
||||
|
||||
|
||||
// 生成订单号
|
||||
var orderNo = Common.Common.CreateNoQuery();
|
||||
// 调用统一下单(接口)
|
||||
@ -96,23 +132,6 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
{
|
||||
#region 业务处理
|
||||
|
||||
/* 计算核销前价格(商品总额) */
|
||||
var goodsPrice = await CalculateBeforePrice(parm);
|
||||
|
||||
/* 计算运费 */
|
||||
GoodsFreightDto goodsFreightDto = new()
|
||||
{
|
||||
GoodsRequestList = parm.GoodsRequestList,
|
||||
CustomerAddressGuid = parm.CustomerAddressGuid,
|
||||
};
|
||||
var freight = await _GoodsServiceApi.GetGoodsFreight(goodsFreightDto);
|
||||
|
||||
var totalPrice = goodsPrice + freight;
|
||||
if (parm.TotalAmount != totalPrice) throw new CustomException("前端传递金额不合法!下单失败!");
|
||||
parm.TotalAmount = totalPrice;
|
||||
|
||||
/* 计算核销前后价格(优惠后价格) */
|
||||
var afterPriceRes = await CalculateAfterPrice(parm);
|
||||
|
||||
|
||||
/* 添加订单流水 */
|
||||
@ -142,9 +161,26 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付回调的业务处理
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task HandleNotify(OrderReturnJson res)
|
||||
{
|
||||
/* 修改订单流水 */
|
||||
await UpdatePayment(res);
|
||||
|
||||
/* 修改业务订单 */
|
||||
await UpdateOrder(res);
|
||||
}
|
||||
|
||||
|
||||
#region 业务方法调用
|
||||
|
||||
|
||||
#region 添加订单
|
||||
|
||||
/// <summary>
|
||||
/// 计算核销前的价格
|
||||
/// </summary>
|
||||
@ -169,11 +205,27 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
{
|
||||
price += sku.GoodsSkuPrice * quantity;
|
||||
}
|
||||
// 下单立减库存
|
||||
if (goods.GoodsDeductStockType == 1)
|
||||
{
|
||||
sku.GoodsSkuStockNum -= quantity;
|
||||
await _GoodsSkuRepository.UpdateAsync(sku);
|
||||
goods.GoodsTotalInventory -= quantity;
|
||||
await _GoodsRepository.UpdateAsync(goods);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
price += goods.GoodsPriceHighest * quantity;
|
||||
// 下单立减库存
|
||||
if (goods.GoodsDeductStockType == 1)
|
||||
{
|
||||
goods.GoodsTotalInventory -= quantity;
|
||||
await _GoodsRepository.UpdateAsync(goods);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return price;
|
||||
@ -230,8 +282,8 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
CustomerGuid = parm.UserId,
|
||||
PaymentNumber = orderNo,
|
||||
PaymentBuytype = parm.PayType,
|
||||
PaymentBeforeMoney = beforeMoney,
|
||||
PaymentMoney = afterMoney,
|
||||
PaymentBeforeMoney = afterMoney,
|
||||
//PaymentMoney = afterMoney,
|
||||
PaymentStatus = 1
|
||||
};
|
||||
var response = await _PaymentRepository.InsertReturnSnowflakeIdAsync(payment);
|
||||
@ -264,7 +316,7 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
CouponMoney = discountRes.CouponMoney,
|
||||
GoodsTotalAmoun = beforeMoney,
|
||||
OrderAmount = discountRes.DiscountPrice,
|
||||
PayPrice = discountRes.DiscountPrice,
|
||||
//PayPrice = discountRes.DiscountPrice,
|
||||
OrderRemark = parm?.Remark,
|
||||
PayType = parm.PayType,
|
||||
PayStatus = 1,
|
||||
@ -278,12 +330,21 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
ExpressPrice = freight,
|
||||
};
|
||||
|
||||
// TODO:余额支付
|
||||
// 关联购物车ids
|
||||
var idsList = new List<int>();
|
||||
foreach (var item in parm.GoodsRequestList)
|
||||
{
|
||||
idsList.Add(item.CartId);
|
||||
}
|
||||
var idsArrar = idsList.ToArray();
|
||||
order.CartIds = string.Join(",", idsList);
|
||||
|
||||
var response = await _OrderRepository.InsertReturnSnowflakeIdAsync(order);
|
||||
if (response == 0)
|
||||
throw new CustomException("业务订单数据加入失败");
|
||||
|
||||
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@ -367,6 +428,115 @@ namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 支付完成后的业务调用方法
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改订单流水
|
||||
/// </summary>
|
||||
/// <param name="res"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdatePayment(OrderReturnJson res)
|
||||
{
|
||||
await _PaymentRepository.UpdateAsync(f => new Payment
|
||||
{
|
||||
PaymentWeixinNumber = res.transaction_id,
|
||||
PaymentMoney = res.amount.payer_total / 100,
|
||||
PaymentStatus = 2,
|
||||
Update_time = DateTime.Now,
|
||||
}, f => f.PaymentNumber == res.out_trade_no);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改业务订单
|
||||
/// </summary>
|
||||
/// <param name="res"></param>
|
||||
/// <returns></returns>
|
||||
public async Task UpdateOrder(OrderReturnJson res)
|
||||
{
|
||||
|
||||
await _OrderRepository.UpdateAsync(f => new Model.Models.Business.OrderManage.Orders.Order
|
||||
{
|
||||
TransactionId = res.transaction_id,
|
||||
PayPrice = res.amount.payer_total / 100,
|
||||
PayStatus = 2,
|
||||
PayTime = DateTime.Now,
|
||||
Update_time = DateTime.Now,
|
||||
}, f => f.OrderNumber == res.out_trade_no);
|
||||
|
||||
var order = await _OrderRepository.GetFirstAsync(s => s.OrderNumber == res.out_trade_no);
|
||||
|
||||
|
||||
/* 删除购物车中对应的商品 */
|
||||
var cartIds = Tools.SpitIntArrary(order.CartIds);
|
||||
foreach (var cartId in cartIds)
|
||||
{
|
||||
await _CartRepository.UpdateAsync(s => new Cart
|
||||
{
|
||||
IsDelete = true,
|
||||
}, s => s.CartId == cartId);
|
||||
}
|
||||
|
||||
/* 对应优惠券修改为已使用 */
|
||||
if (order.CouponGuid != 0)
|
||||
{
|
||||
var customer = await _CustomerRepository.GetFirstAsync(s => s.CustomerXcxOpenid == res.payer.openid);
|
||||
var customerCoupon = await _CustomerCouponRepository.GetFirstAsync(s => s.CouponGuid == order.CouponGuid && s.CustomerGuid == customer.CustomerGuid);
|
||||
await _CustomerCouponRepository.UpdateAsync(s => new CustomerCoupon
|
||||
{
|
||||
CustomerCouponIsUsed = 2,
|
||||
}, s => s.CustomerCouponId == customerCoupon.CustomerCouponId);
|
||||
}
|
||||
|
||||
|
||||
/* 店铺和商品的销售数量增加 对应库存减少*/
|
||||
var orderGoodsList = await _OrderGoodsRepository.GetListAsync(s => s.OrderGuid == order.OrderGuid);
|
||||
foreach (var orderGood in orderGoodsList)
|
||||
{
|
||||
var goods = await _GoodsRepository.GetFirstAsync(s => s.GoodsGuid == orderGood.GoodsGuid);
|
||||
var shop = await _ShopRepository.GetFirstAsync(s => s.ShopGuid == goods.ShopGuid);
|
||||
|
||||
goods.GoodsSalesActual += orderGood.GoodsTotalNum;
|
||||
await _GoodsRepository.UpdateAsync(goods);
|
||||
shop.ShopSalesOrderCount += orderGood.GoodsTotalNum;
|
||||
await _ShopRepository.UpdateAsync(shop);
|
||||
|
||||
if (goods.GoodsDeductStockType == 2)
|
||||
{
|
||||
if (orderGood.GoodsSkuId != 0)
|
||||
{
|
||||
var sku = await _GoodsSkuRepository.GetFirstAsync(s => s.GoodsSkuId == orderGood.GoodsSkuId);
|
||||
sku.GoodsSkuStockNum -= orderGood.GoodsTotalNum;
|
||||
goods.GoodsTotalInventory -= orderGood.GoodsTotalNum;
|
||||
await _GoodsSkuRepository.UpdateAsync(sku);
|
||||
await _GoodsRepository.UpdateAsync(goods);
|
||||
}
|
||||
else
|
||||
{
|
||||
goods.GoodsTotalInventory -= orderGood.GoodsTotalNum;
|
||||
await _GoodsRepository.UpdateAsync(goods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 积分操作*/
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ using ARW.Model;
|
||||
using ARW.Model.Dto.Api.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Vo.Api.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Vo.Api.Home;
|
||||
|
||||
namespace ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys
|
||||
{
|
||||
@ -26,5 +27,11 @@ namespace ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys
|
||||
Task<List<GoodsCategoryVoApi>> GetGoodsCategoryTreeListApi(GoodsCategoryQueryDtoApi parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取首页推荐类目列表(Api)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<HomeCategoryApiVo>> GetHomeCategoryListApi();
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ using System.Threading.Tasks;
|
||||
using ARW.Model.Dto.Api.Carts;
|
||||
using ARW.Model.Dto.Api.Pay;
|
||||
using ARW.Model.Models.Business.Payments;
|
||||
using Senparc.Weixin.TenPayV3.Apis.BasePay;
|
||||
using static Infrastructure.WeChat.TenPay.Pay;
|
||||
|
||||
namespace ARW.Service.Api.IBusinessService.PayManage
|
||||
@ -22,5 +23,12 @@ namespace ARW.Service.Api.IBusinessService.PayManage
|
||||
Task<PayParams> HandelPrePay(CommitPayDtoApi parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付回调的业务处理
|
||||
/// </summary>
|
||||
/// <param name="res"></param>
|
||||
/// <returns></returns>
|
||||
Task HandleNotify(OrderReturnJson res);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
using ARW.Model.Vo.Api.GoodsManager.Goodss;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Geocoding;
|
||||
using ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.GoodsManager.Goodss
|
||||
{
|
||||
@ -30,6 +31,7 @@ namespace ARW.WebApi.Controllers.Api.GoodsManager.Goodss
|
||||
{
|
||||
private readonly IGoodsServiceApi _GoodsServiceApi;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
|
60
ARW.WebApi/Controllers/Api/Home/HomeApiController.cs
Normal file
60
ARW.WebApi/Controllers/Api/Home/HomeApiController.cs
Normal file
@ -0,0 +1,60 @@
|
||||
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.GoodsManager.Goodss;
|
||||
using ARW.Service.Api.IBusinessService.GoodsManager.Goodss;
|
||||
using ARW.Model.Models.Business.GoodsManager.Goodss;
|
||||
using ARW.Model.Vo.Api.GoodsManager.Goodss;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Geocoding;
|
||||
using ARW.Service.Api.IBusinessService.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Dto.Api.GoodsManager.GoodsCategorys;
|
||||
using ARW.Model.Vo.Api.GoodsManager.GoodsCategorys;
|
||||
|
||||
namespace ARW.WebApi.Controllers.Api.GoodsManager.Home
|
||||
{
|
||||
/// <summary>
|
||||
/// 首页控制器Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-07-09
|
||||
/// </summary>
|
||||
//[Verify]
|
||||
[Route("api/[controller]")]
|
||||
public class HomeApiController : BaseController
|
||||
{
|
||||
private readonly IGoodsServiceApi _GoodsServiceApi;
|
||||
private readonly IGoodsCategoryServiceApi _GoodsCategoryServiceApi;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="GoodsServiceApi">商品商品Api服务</param>
|
||||
public HomeApiController(IGoodsServiceApi GoodsServiceApi, IGoodsCategoryServiceApi goodsCategoryServiceApi)
|
||||
{
|
||||
_GoodsServiceApi = GoodsServiceApi;
|
||||
_GoodsCategoryServiceApi = goodsCategoryServiceApi;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取首页推荐类目列表(Api)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getHomeCategoryListApi")]
|
||||
public async Task<IActionResult> GetHomeCategoryListApi()
|
||||
{
|
||||
var res = await _GoodsCategoryServiceApi.GetHomeCategoryListApi();
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -75,16 +75,8 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
|
||||
if (res.trade_state == "SUCCESS")
|
||||
{
|
||||
// 业务
|
||||
var respones = _PayServiceApi.UpdateAsync(f => new Payment
|
||||
{
|
||||
PaymentWeixinNumber = res.transaction_id,
|
||||
PaymentBeforeMoney = res.amount.total,
|
||||
PaymentMoney = res.amount.payer_total,
|
||||
PaymentStatus = 2,
|
||||
Update_time = DateTime.Now,
|
||||
}, f => f.PaymentNumber == res.out_trade_no);
|
||||
|
||||
/* 支付回调的业务处理 */
|
||||
await _PayServiceApi.HandleNotify(res);
|
||||
}
|
||||
|
||||
return SUCCESS("");
|
||||
|
Loading…
Reference in New Issue
Block a user