mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:23:26 +08:00
2022-01-11
## 1.2.9 开源社区版: 【修复】修复全局定义微信配置引用的配置文件命名错误问题。 【修复】修复自动生成sku模式价格出现货号重复情况,#I4Q4WU ## 0.0.6 会员先行版: 【新增】新增微信自定义交易组件,实现微信视频号直播带货功能。
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CoreCms.Net.IServices\CoreCms.Net.IServices.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.Utility\CoreCms.Net.Utility.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/7/15 0:45:18
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace CoreCms.Net.WeChat.Service.TransactionComponent.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 审核相关
|
||||
/// </summary>
|
||||
public class AuditEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询品牌和类目的审核结果状态
|
||||
/// </summary>
|
||||
public enum AuditCategoryStatus
|
||||
{
|
||||
[Description("<button type='button' class='layui-btn layui-btn-normal layui-btn-xs'>审核中</button>")]
|
||||
审核中 = 0,
|
||||
|
||||
[Description("<button type='button' class='layui-btn layui-btn-xs'>审核成功</button>")]
|
||||
审核成功 = 1,
|
||||
|
||||
[Description("<button type='button' class='layui-btn layui-btn-danger layui-btn-xs'>审核拒绝</button>")]
|
||||
审核拒绝 = 9
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/7/10 1:29:02
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace CoreCms.Net.WeChat.Service.TransactionComponent.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送方式
|
||||
/// </summary>
|
||||
public enum DeliveryTypeEnum
|
||||
{
|
||||
正常快递 = 1,
|
||||
无需快递 = 2,
|
||||
线下配送 = 3,
|
||||
用户自提 = 4,
|
||||
}
|
||||
|
||||
public enum OrderStatus
|
||||
{
|
||||
[Description("待付款")]
|
||||
待付款 = 10,
|
||||
|
||||
[Description("收银台支付完成")]
|
||||
收银台支付完成 = 11,
|
||||
|
||||
[Description("待发货")]
|
||||
待发货 = 20,
|
||||
|
||||
[Description("待收货")]
|
||||
待收货 = 30,
|
||||
|
||||
[Description("完成")]
|
||||
完成 = 100,
|
||||
|
||||
[Description("全部商品售后之后订单取消")]
|
||||
售后之后取消 = 200,
|
||||
|
||||
[Description("用户主动取消/待付款超时取消/商家取消")]
|
||||
正常取消 = 4,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/7/6 1:10:15
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace CoreCms.Net.WeChat.Service.TransactionComponent.Enum
|
||||
{
|
||||
/// <summary>
|
||||
/// SPU枚举
|
||||
/// </summary>
|
||||
public class SpuEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// SPU审核状态
|
||||
/// </summary>
|
||||
public enum EditStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 未审核
|
||||
/// </summary>
|
||||
[Description("未审核")]
|
||||
VerifyNo = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 审核中
|
||||
/// </summary>
|
||||
[Description("审核中")]
|
||||
Verifying = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 审核拒绝
|
||||
/// </summary>
|
||||
[Description("审核拒绝")]
|
||||
VerifyRefuse = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 审核通过
|
||||
/// </summary>
|
||||
[Description("审核通过")]
|
||||
VerifyYes = 4,
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SPU审状态
|
||||
/// </summary>
|
||||
public enum SPUStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 初始值
|
||||
/// </summary>
|
||||
[Description("初始值")]
|
||||
InitialValue = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 上架
|
||||
/// </summary>
|
||||
[Description("上架")]
|
||||
Added = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 自主下架
|
||||
/// </summary>
|
||||
[Description("自主下架")]
|
||||
SoldOut = 11,
|
||||
|
||||
/// <summary>
|
||||
/// 违规下架/风控系统下架
|
||||
/// </summary>
|
||||
[Description("违规下架/风控系统下架")]
|
||||
SytemSoldOut = 13,
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/7/9 1:59:13
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CoreCms.Net.WeChat.Service.TransactionComponent.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 订单详情
|
||||
/// </summary>
|
||||
public class OrderInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public string create_time { get; set; }
|
||||
/// <summary>
|
||||
/// 非必填,默认为0。0:普通场景, 1:合单支付
|
||||
/// </summary>
|
||||
public int type { get; set; }
|
||||
/// <summary>
|
||||
/// 商家自定义订单ID
|
||||
/// </summary>
|
||||
public string out_order_id { get; set; }
|
||||
/// <summary>
|
||||
/// 用户的openid
|
||||
/// </summary>
|
||||
public string openid { get; set; }
|
||||
/// <summary>
|
||||
/// 商家小程序该订单的页面path,用于微信侧订单中心跳转
|
||||
/// </summary>
|
||||
public string path { get; set; }
|
||||
/// <summary>
|
||||
/// 商家小程序该订单的用户id
|
||||
/// </summary>
|
||||
public string out_user_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单详情
|
||||
/// </summary>
|
||||
public OrderDetail order_detail { get; set; } = new OrderDetail();
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DeliveryDetail delivery_detail { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public AddressInfo address_info { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 货品明细
|
||||
/// </summary>
|
||||
public class ProductInfoItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 商家自定义商品ID
|
||||
/// </summary>
|
||||
public string out_product_id { get; set; }
|
||||
/// <summary>
|
||||
/// 商家自定义商品skuID,可填空字符串(如果这个product_id下没有sku)
|
||||
/// </summary>
|
||||
public string out_sku_id { get; set; }
|
||||
/// <summary>
|
||||
/// 购买的数量
|
||||
/// </summary>
|
||||
public int product_cnt { get; set; }
|
||||
/// <summary>
|
||||
/// 生成订单时商品的售卖价(单位:分),可以跟上传商品接口的价格不一致
|
||||
/// </summary>
|
||||
public int sale_price { get; set; }
|
||||
/// <summary>
|
||||
/// 绑定的小程序商品路径
|
||||
/// </summary>
|
||||
public string path { get; set; }
|
||||
/// <summary>
|
||||
/// 生成订单时商品的标题
|
||||
/// </summary>
|
||||
public string title { get; set; }
|
||||
/// <summary>
|
||||
/// 生成订单时商品的头图
|
||||
/// </summary>
|
||||
public string head_img { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 支付情况
|
||||
/// </summary>
|
||||
public class PayInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信支付
|
||||
/// </summary>
|
||||
public string pay_method { get; set; }
|
||||
/// <summary>
|
||||
/// 预支付ID
|
||||
/// </summary>
|
||||
public string prepay_id { get; set; }
|
||||
/// <summary>
|
||||
/// 预付款时间(拿到prepay_id的时间)
|
||||
/// </summary>
|
||||
public string prepay_time { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 价格体系
|
||||
/// </summary>
|
||||
public class PriceInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 该订单最终的金额(单位:分)
|
||||
/// </summary>
|
||||
public int order_price { get; set; }
|
||||
/// <summary>
|
||||
/// 运费(单位:分)
|
||||
/// </summary>
|
||||
public int freight { get; set; }
|
||||
/// <summary>
|
||||
/// 优惠金额(单位:分)
|
||||
/// </summary>
|
||||
public int discounted_price { get; set; }
|
||||
/// <summary>
|
||||
/// 附加金额(单位:分)
|
||||
/// </summary>
|
||||
public int additional_price { get; set; }
|
||||
/// <summary>
|
||||
/// 附加金额备注
|
||||
/// </summary>
|
||||
public string additional_remarks { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单详情
|
||||
/// </summary>
|
||||
public class OrderDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 商品列表
|
||||
/// </summary>
|
||||
public List<ProductInfoItem> product_infos { get; set; }
|
||||
/// <summary>
|
||||
/// 支付情况
|
||||
/// </summary>
|
||||
public PayInfo pay_info { get; set; }
|
||||
/// <summary>
|
||||
/// 价格体系
|
||||
/// </summary>
|
||||
public PriceInfo price_info { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发货情况
|
||||
/// </summary>
|
||||
public class DeliveryDetail
|
||||
{
|
||||
/// <summary>
|
||||
/// 1: 正常快递, 2: 无需快递, 3: 线下配送, 4: 用户自提
|
||||
/// </summary>
|
||||
public int delivery_type { get; set; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 地址情况
|
||||
/// </summary>
|
||||
public class AddressInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 收货人姓名
|
||||
/// </summary>
|
||||
public string receiver_name { get; set; }
|
||||
/// <summary>
|
||||
/// 详细收货地址信息
|
||||
/// </summary>
|
||||
public string detailed_address { get; set; }
|
||||
/// <summary>
|
||||
/// 收货人手机号码
|
||||
/// </summary>
|
||||
public string tel_number { get; set; }
|
||||
/// <summary>
|
||||
/// 国家,选填
|
||||
/// </summary>
|
||||
public string country { get; set; }
|
||||
/// <summary>
|
||||
/// 省份,选填
|
||||
/// </summary>
|
||||
public string province { get; set; }
|
||||
/// <summary>
|
||||
/// 城市,选填
|
||||
/// </summary>
|
||||
public string city { get; set; }
|
||||
/// <summary>
|
||||
/// 乡镇,选填
|
||||
/// </summary>
|
||||
public string town { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user