制作自定义交易组件用户前端售后,微信内取消售后操作

This commit is contained in:
大灰灰
2022-06-30 23:43:16 +08:00
parent dc408b8596
commit 9bf0a42289
7 changed files with 182 additions and 20 deletions

View File

@@ -0,0 +1,74 @@
/***********************************************************************
* Project: CoreCms.Net *
* Web: https://CoreCms.Net *
* ProjectName: 核心内容管理系统 *
* Author: 大灰灰 *
* Email: JianWeie@163.com *
* CreateTime: 2020-08-13 23:57:23
* Description: 暂无
***********************************************************************/
using System;
using System.Threading;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.WeChat.Service.HttpClients;
using CoreCms.Net.WeChat.Service.Models;
using MediatR;
using Newtonsoft.Json;
using SKIT.FlurlHttpClient.Wechat.Api;
using SKIT.FlurlHttpClient.Wechat.Api.Events;
namespace CoreCms.Net.WeChat.Service.Mediator
{
/// <summary>
/// 表示 TEXT 事件的数据
/// </summary>
public class AftersaleUserCancelEventCommand : IRequest<WeChatApiCallBack>
{
public AftersaleUserCancelEvent EventObj { get; set; }
}
/// <summary>
/// 用户取消售后申请
/// </summary>
public class AftersaleUserCancelEventCommandHandler : IRequestHandler<AftersaleUserCancelEventCommand, WeChatApiCallBack>
{
private readonly ICoreCmsBillAftersalesServices _aftersalesServices;
public AftersaleUserCancelEventCommandHandler(ICoreCmsBillAftersalesServices aftersalesServices)
{
_aftersalesServices = aftersalesServices;
}
public async Task<WeChatApiCallBack> Handle(AftersaleUserCancelEventCommand request, CancellationToken cancellationToken)
{
var jm = new WeChatApiCallBack() { Status = true };
if (request.EventObj != null)
{
try
{
await _aftersalesServices.UpdateAsync(p => new CoreCmsBillAftersales()
{
status = (int)GlobalEnumVars.BillAftersalesStatus.Cancel
},
p => p.aftersalesId == request.EventObj.AftersaleOrder.OutAftersaleOrderId);
}
catch (Exception e)
{
NLogUtil.WriteFileLog(NLog.LogLevel.Info, LogType.WxPost, "接收服务器推送", "用户取消售后申请", e);
}
}
return await Task.FromResult(jm);
}
}
}