mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:43:26 +08:00
【新增】增加易联云小票打印机后台配置表【CoreCmsPrinter】,取消使用配置文件配置,并且支持多台打印机绑定不同门店,实现不同门店不同打印机打单。
This commit is contained in:
76
CoreCms.Net.RedisMQ/AliPayNoticeSubscribe.cs
Normal file
76
CoreCms.Net.RedisMQ/AliPayNoticeSubscribe.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2022/1/31 21:45:10
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Loging;
|
||||
using Essensoft.Paylink.Alipay;
|
||||
using Essensoft.Paylink.Alipay.Notify;
|
||||
using InitQ.Abstractions;
|
||||
using InitQ.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace CoreCms.Net.RedisMQ
|
||||
{
|
||||
/// <summary>
|
||||
/// 支付宝支付成功后推送到接口进行数据处理
|
||||
/// </summary>
|
||||
public class AliPayNoticeSubscribe : IRedisSubscribe
|
||||
{
|
||||
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
|
||||
|
||||
public AliPayNoticeSubscribe(ICoreCmsBillPaymentsServices billPaymentsServices)
|
||||
{
|
||||
_billPaymentsServices = billPaymentsServices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝支付成功后推送到接口进行数据处理
|
||||
/// </summary>
|
||||
/// <param name="msg"></param>
|
||||
/// <returns></returns>
|
||||
[Subscribe(RedisMessageQueueKey.AliPayNotice)]
|
||||
private async Task AliPayNotice(string msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
var notify = JsonConvert.DeserializeObject<AlipayTradeAppPayNotify>(msg);
|
||||
if (notify is { TradeStatus: AlipayTradeStatus.Success })
|
||||
{
|
||||
if (notify.TradeStatus == AlipayTradeStatus.Success)
|
||||
{
|
||||
var money = decimal.Parse(notify.TotalAmount);
|
||||
await _billPaymentsServices.ToUpdate(notify.OutTradeNo,
|
||||
(int)GlobalEnumVars.BillPaymentsStatus.Payed,
|
||||
GlobalEnumVars.PaymentsTypes.alipay.ToString(), money, notify.TradeStatus,notify.TradeNo);
|
||||
}
|
||||
else
|
||||
{
|
||||
var money = decimal.Parse(notify.TotalAmount);
|
||||
var message = notify.TradeStatus;
|
||||
await _billPaymentsServices.ToUpdate(notify.OutTradeNo,
|
||||
(int)GlobalEnumVars.BillPaymentsStatus.Other,
|
||||
GlobalEnumVars.PaymentsTypes.alipay.ToString(), money, message, notify.TradeNo);
|
||||
}
|
||||
}
|
||||
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "支付宝支付成功后推送到接口进行数据处理", msg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "支付宝支付成功后推送到接口进行数据处理", msg, ex);
|
||||
throw;
|
||||
}
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user