mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 21:03:26 +08:00
2022-01-11
## 1.2.9 开源社区版: 【修复】修复全局定义微信配置引用的配置文件命名错误问题。 【修复】修复自动生成sku模式价格出现货号重复情况,#I4Q4WU ## 0.0.6 会员先行版: 【新增】新增微信自定义交易组件,实现微信视频号直播带货功能。
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
/***********************************************************************
|
||||
* 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.Model.Entities;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||
using CoreCms.Net.WeChat.Service.Models;
|
||||
using MediatR;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Events;
|
||||
|
||||
namespace CoreCms.Net.WeChat.Service.Mediator
|
||||
{
|
||||
/// <summary>
|
||||
/// 表示 TEXT 事件的数据
|
||||
/// </summary>
|
||||
public class OpenProductCategoryAuditEventCommand : IRequest<WeChatApiCallBack>
|
||||
{
|
||||
public OpenProductCategoryAuditEvent EventObj { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品审核结果
|
||||
/// </summary>
|
||||
public class OpenProductCategoryAuditEventCommandHandler : IRequestHandler<OpenProductCategoryAuditEventCommand, WeChatApiCallBack>
|
||||
{
|
||||
private readonly IWeChatTransactionComponentAuditCategoryAuditLogServices _logServices;
|
||||
private readonly IWeChatTransactionComponentAuditCategoryServices _auditCategoryServices;
|
||||
private readonly ICoreCmsSettingServices _settingServices;
|
||||
private readonly ICoreCmsSmsServices _smsServices;
|
||||
|
||||
|
||||
public OpenProductCategoryAuditEventCommandHandler(IWeChatTransactionComponentAuditCategoryAuditLogServices logServices, ICoreCmsSettingServices settingServices, ICoreCmsSmsServices smsServices, IWeChatTransactionComponentAuditCategoryServices auditCategoryServices)
|
||||
{
|
||||
_logServices = logServices;
|
||||
_settingServices = settingServices;
|
||||
_smsServices = smsServices;
|
||||
_auditCategoryServices = auditCategoryServices;
|
||||
}
|
||||
|
||||
public async Task<WeChatApiCallBack> Handle(OpenProductCategoryAuditEventCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var jm = new WeChatApiCallBack() { Status = true };
|
||||
|
||||
if (request.EventObj != null)
|
||||
{
|
||||
var auditCategory =
|
||||
await _auditCategoryServices.QueryByClauseAsync(
|
||||
p => p.auditId == request.EventObj.EventData.AuditId);
|
||||
if (auditCategory != null)
|
||||
{
|
||||
await _auditCategoryServices.UpdateAsync(p => new WeChatTransactionComponentAuditCategory()
|
||||
{
|
||||
status = request.EventObj.EventData.Status,
|
||||
rejectReason = request.EventObj.EventData.RejectReason
|
||||
}, p => p.auditId == request.EventObj.EventData.AuditId);
|
||||
|
||||
var log = new WeChatTransactionComponentAuditCategoryAuditLog();
|
||||
log.auditId = request.EventObj.EventData.AuditId;
|
||||
log.status = request.EventObj.EventData.Status;
|
||||
log.auditType = request.EventObj.EventData.AuditType;
|
||||
log.rejectReason = request.EventObj.EventData.RejectReason;
|
||||
log.createTime = DateTime.Now;
|
||||
|
||||
var id = await _logServices.InsertAsync(log);
|
||||
if (id > 0)
|
||||
{
|
||||
var smsOptions = await _settingServices.GetSmsOptions();
|
||||
if (smsOptions.Enabled == true)
|
||||
{
|
||||
var smsBody = string.Empty;
|
||||
if (log.status == 1)
|
||||
{
|
||||
smsBody = "你提交的类目审核已经通过,请登录平台添加新商品。";
|
||||
}
|
||||
else if (log.status == 9)
|
||||
{
|
||||
smsBody = "你提交的类目审核已被拒绝,失败原因为:" + log.rejectReason + ",请修改资料后重新提交。";
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(smsBody))
|
||||
{
|
||||
var allConfigs = await _settingServices.GetConfigDictionaries();
|
||||
var shopMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopMobile); //退货联系方式
|
||||
|
||||
await _smsServices.SendSms(shopMobile, smsBody, smsOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return await Task.FromResult(jm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
/***********************************************************************
|
||||
* 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.Model.Entities;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||
using CoreCms.Net.WeChat.Service.Models;
|
||||
using MediatR;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Events;
|
||||
|
||||
namespace CoreCms.Net.WeChat.Service.Mediator
|
||||
{
|
||||
/// <summary>
|
||||
/// 表示 TEXT 事件的数据
|
||||
/// </summary>
|
||||
public class OpenProductSPUAuditEventCommand : IRequest<WeChatApiCallBack>
|
||||
{
|
||||
public OpenProductSPUAuditEvent EventObj { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 商品审核结果
|
||||
/// </summary>
|
||||
public class OpenProductSPUAuditEventCommandHandler : IRequestHandler<OpenProductSPUAuditEventCommand, WeChatApiCallBack>
|
||||
{
|
||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
private readonly IWeChatTransactionComponentGoodAuditLogServices _logServices;
|
||||
private readonly ICoreCmsGoodsServices _goodsServices;
|
||||
private readonly ICoreCmsSettingServices _settingServices;
|
||||
private readonly ICoreCmsSmsServices _smsServices;
|
||||
|
||||
|
||||
public OpenProductSPUAuditEventCommandHandler(IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IWeChatTransactionComponentGoodAuditLogServices logServices, ICoreCmsGoodsServices goodsServices, ICoreCmsSettingServices settingServices, ICoreCmsSmsServices smsServices)
|
||||
{
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_logServices = logServices;
|
||||
_goodsServices = goodsServices;
|
||||
_settingServices = settingServices;
|
||||
_smsServices = smsServices;
|
||||
}
|
||||
|
||||
public async Task<WeChatApiCallBack> Handle(OpenProductSPUAuditEventCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
|
||||
var jm = new WeChatApiCallBack() { Status = true };
|
||||
|
||||
if (request.EventObj != null)
|
||||
{
|
||||
var log = new WeChatTransactionComponentGoodAuditLog();
|
||||
log.outProductId = request.EventObj.EventData.OutProductId;
|
||||
log.productId = request.EventObj.EventData.ProductId;
|
||||
log.status = request.EventObj.EventData.Status;
|
||||
log.rejectReason = request.EventObj.EventData.RejectReason;
|
||||
log.createTime = DateTime.Now;
|
||||
|
||||
var id = await _logServices.InsertAsync(log);
|
||||
if (id > 0)
|
||||
{
|
||||
var smsOptions = await _settingServices.GetSmsOptions();
|
||||
if (smsOptions.Enabled == true)
|
||||
{
|
||||
var smsBody = string.Empty;
|
||||
if (log.status == 4)
|
||||
{
|
||||
smsBody = "你提交的商品审核已经通过,请登录平台上架商品。";
|
||||
}
|
||||
else if (log.status == 3)
|
||||
{
|
||||
smsBody = "你提交的商品审核已被拒绝,失败原因为:" + log.rejectReason + ",请修改资料后重新提交。";
|
||||
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(smsBody))
|
||||
{
|
||||
var allConfigs = await _settingServices.GetConfigDictionaries();
|
||||
var shopMobile = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.ShopMobile); //退货联系方式
|
||||
|
||||
await _smsServices.SendSms(shopMobile, smsBody, smsOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return await Task.FromResult(jm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user