mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 18:13:26 +08:00
升级自定义交易组件常用商品接口,spu接口,品牌接口,订单接口,物流接口。
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
namespace CoreCms.Net.Configuration
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CoreCms.Net.Configuration
|
||||
{
|
||||
public class GlobalConstVars
|
||||
{
|
||||
@@ -434,20 +436,17 @@
|
||||
/// </summary>
|
||||
public static string OrderPath(string orderId)
|
||||
{
|
||||
return "/pages/member/order/orderdetail?orderId=" + orderId;
|
||||
return "/pages/member/order/detail/detail?orderId=" + orderId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单地址
|
||||
/// 商品地址
|
||||
/// </summary>
|
||||
public static string GoodDetail(string goodId)
|
||||
{
|
||||
return "/pages/goods/goodDetails/goodDetails?id=" + goodId;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2969,6 +2969,37 @@ namespace CoreCms.Net.Configuration
|
||||
否 = 2
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 下单前置检查-是否需要推单
|
||||
/// </summary>
|
||||
public enum RequireOrderType
|
||||
{
|
||||
需要 = 1,
|
||||
不需要 = 2
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下单前置检查-商户订单类型(原则上只能是1,应为官方文档说以后只有1,所以我们也只是用1)
|
||||
/// </summary>
|
||||
public enum RequiredFundType
|
||||
{
|
||||
非二级商户号订单 = 0,
|
||||
二级商户号订单 = 1,
|
||||
两种方式皆可 = 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下单前置检查-商户订单类型(原则上只能是1,应为官方文档说以后只有1,所以我们也只是用1)
|
||||
/// </summary>
|
||||
public enum PayMethodType
|
||||
{
|
||||
微信支付 = 0,
|
||||
货到付款 = 1,
|
||||
商家会员储蓄卡 = 2,
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 佣金相关
|
||||
|
||||
@@ -22,8 +22,12 @@ namespace CoreCms.Net.Core.Config
|
||||
|
||||
services.AddInitQ(m =>
|
||||
{
|
||||
//时间间隔
|
||||
//没消息时挂起时长(毫秒)
|
||||
m.SuspendTime = 1000;
|
||||
|
||||
//每次消费消息间隔时间(毫秒)
|
||||
m.IntervalTime = 1000;
|
||||
|
||||
//redis服务器地址
|
||||
m.ConnectionString = AppSettingsConstVars.RedisConfigConnectionString;
|
||||
//对应的订阅者类,需要new一个实例对象,当然你也可以传参,比如日志对象
|
||||
@@ -33,11 +37,10 @@ namespace CoreCms.Net.Core.Config
|
||||
typeof(OrderAutomaticDeliverySubscribe),
|
||||
typeof(OrderFinishCommandSubscribe),
|
||||
typeof(OrderPrintSubscribe),
|
||||
|
||||
typeof(TCOrderAfterSaleCreateSyncSubscribe),
|
||||
typeof(TCOrderDeliveryRecieveSyncSubscribe),
|
||||
typeof(TCOrderShipSyncSubscribe),
|
||||
typeof(TCPayOrderSyncSubscribe),
|
||||
//typeof(TCPayOrderSyncSubscribe),
|
||||
typeof(UserSubscribe),
|
||||
typeof(WeChatPayNoticeSubscribe),
|
||||
typeof(SendWxTemplateMessageSubscribe),
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2022/6/29 16:22:45
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
namespace CoreCms.Net.IRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信交易组件下单前置检查 工厂接口
|
||||
/// </summary>
|
||||
public interface ICoreCmsCheckBeforeAddOrderRepository : IBaseRepository<CoreCmsCheckBeforeAddOrder>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2022/6/29 16:22:45
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.IServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信交易组件下单前置检查 服务工厂接口
|
||||
/// </summary>
|
||||
public interface ICoreCmsCheckBeforeAddOrderServices : IBaseServices<CoreCmsCheckBeforeAddOrder>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -66,10 +66,13 @@ namespace CoreCms.Net.IServices
|
||||
/// <param name="taxCode">发票税务编码</param>
|
||||
/// <param name="objectId">关联非普通订单营销功能的序列</param>
|
||||
/// <param name="teamId">拼团订单分组序列</param>
|
||||
/// <param name="requireOrder">微信自定义组件(是否需要推单,1:需要,0:不需要)</param>
|
||||
/// <param name="requiredFundType">微信自定义组件(requireOrder = 1时生效,0,非二级商户号订单,1,二级商户号订单,2,两种方式皆可(后续只会存在1))</param>
|
||||
/// <param name="traceId">微信自定义组件(跟踪ID,有效期十分钟,会影响主播归因、分享员归因等,需创建订单前调用,调用生成订单 api 时需传入该参数)</param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> ToAdd(int userId, int orderType, string cartIds, int receiptType, int ushipId, int storeId,
|
||||
string ladingName, string ladingMobile, string memo, int point, string couponCode,
|
||||
int source, int scene, int taxType, string taxName, string taxCode, int objectId, int teamId);
|
||||
int source, int scene, int taxType, string taxName, string taxCode, int objectId, int teamId, int requireOrder, int requiredFundType, string traceId);
|
||||
|
||||
/// <summary>
|
||||
/// 获取订单信息
|
||||
@@ -230,8 +233,9 @@ namespace CoreCms.Net.IServices
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="score">有序队列积分</param>
|
||||
/// <param name="remark"></param>
|
||||
/// <param name="source">来源/system(系统)/wxpost(微信消息推送)</param>
|
||||
/// <returns></returns>
|
||||
Task<WebApiCallBack> CompleteOrder(string orderId, int score = 0, string remark = "后台订单完成操作");
|
||||
Task<WebApiCallBack> CompleteOrder(string orderId, int score = 0, string remark = "后台订单完成操作",string source="system");
|
||||
|
||||
/// <summary>
|
||||
/// 确认签收订单
|
||||
|
||||
104
CoreCms.Net.Model/Entities/Order/CoreCmsCheckBeforeAddOrder.cs
Normal file
104
CoreCms.Net.Model/Entities/Order/CoreCmsCheckBeforeAddOrder.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2022/6/29 16:22:45
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using SqlSugar;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CoreCms.Net.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信交易组件下单前置检查
|
||||
/// </summary>
|
||||
public partial class CoreCmsCheckBeforeAddOrder
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public CoreCmsCheckBeforeAddOrder()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 序列
|
||||
/// </summary>
|
||||
[Display(Name = "序列")]
|
||||
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 订单编号
|
||||
/// </summary>
|
||||
[Display(Name = "订单编号")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String orderId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否需要推单
|
||||
/// </summary>
|
||||
[Display(Name = "是否需要推单")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 requireOrder { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商户订单类型
|
||||
/// </summary>
|
||||
[Display(Name = "商户订单类型")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 requiredFundType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 跟踪ID
|
||||
/// </summary>
|
||||
[Display(Name = "跟踪ID")]
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String traceId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Display(Name = "创建时间")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.DateTime createTime { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -25,200 +25,157 @@ namespace CoreCms.Net.Model.Entities
|
||||
public WeChatTransactionComponentGood()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 序列
|
||||
/// </summary>
|
||||
[Display(Name = "序列")]
|
||||
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 id { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public System.Int32 id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 交易组件平台内部商品ID
|
||||
/// </summary>
|
||||
[Display(Name = "交易组件平台内部商品ID")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int64 productId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public System.Int64 productId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 交易组件创建时间
|
||||
/// </summary>
|
||||
[Display(Name = "交易组件创建时间")]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public System.DateTime? createTime { get; set; }
|
||||
|
||||
|
||||
public System.DateTime? createTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品序列
|
||||
/// </summary>
|
||||
[Display(Name = "商品序列")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String outProductId { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String outProductId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品标题
|
||||
/// </summary>
|
||||
[Display(Name = "商品标题")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
[StringLength(maximumLength:255,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String title { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String title { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 小程序路径
|
||||
/// </summary>
|
||||
[Display(Name = "小程序路径")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
[StringLength(maximumLength:255,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String path { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 255, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String path { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 主图列表
|
||||
/// </summary>
|
||||
[Display(Name = "主图列表")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
[StringLength(maximumLength:500,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String headImg { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 500, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String headImg { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品资质图片列表
|
||||
/// </summary>
|
||||
[Display(Name = "商品资质图片列表")]
|
||||
|
||||
|
||||
[StringLength(maximumLength:500,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String qualificationPics { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 500, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String qualificationPics { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品详情图文
|
||||
/// </summary>
|
||||
[Display(Name = "商品详情图文")]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public System.String descInfoDesc { get; set; }
|
||||
|
||||
|
||||
public System.String descInfoDesc { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 商品详情图片列表
|
||||
/// </summary>
|
||||
[Display(Name = "商品详情图片列表")]
|
||||
|
||||
|
||||
[StringLength(maximumLength:500,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String descInfoImgs { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 500, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String descInfoImgs { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 三级类目ID
|
||||
/// </summary>
|
||||
[Display(Name = "三级类目ID")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 thirdCatId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public System.Int32 thirdCatId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 三级类目名称
|
||||
/// </summary>
|
||||
[Display(Name = "三级类目名称")]
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String thirdCatName { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String thirdCatName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 品牌id
|
||||
/// </summary>
|
||||
[Display(Name = "品牌id")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 brandId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public System.Int32 brandId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 预留字段
|
||||
/// </summary>
|
||||
[Display(Name = "预留字段")]
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String infoVersion { get; set; }
|
||||
|
||||
|
||||
[StringLength(maximumLength: 50, ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String infoVersion { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 最后提交时间
|
||||
/// </summary>
|
||||
[Display(Name = "最后提交时间")]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public System.DateTime? lastPostTime { get; set; }
|
||||
|
||||
|
||||
public System.DateTime? lastPostTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 最后更新时间
|
||||
/// </summary>
|
||||
[Display(Name = "最后更新时间")]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public System.DateTime? updateTime { get; set; }
|
||||
|
||||
|
||||
public System.DateTime? updateTime { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/7/10 23:44:16
|
||||
* CreateTime: 2022/6/30 12:28:17
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
@@ -88,5 +88,17 @@ namespace CoreCms.Net.Model.Entities
|
||||
public System.DateTime createTime { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 支付单序列
|
||||
/// </summary>
|
||||
[Display(Name = "支付单序列")]
|
||||
|
||||
|
||||
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
|
||||
|
||||
|
||||
public System.String paymentId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,9 +134,26 @@ namespace CoreCms.Net.Model.ViewModels.DTO
|
||||
public int teamId { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 场景值
|
||||
/// 场景值(升级微信自定义交易组件后弃用)
|
||||
/// </summary>
|
||||
public int scene { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 是否需要推单,1:需要,0:不需要
|
||||
/// </summary>
|
||||
public int requireOrder { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// requireOrder = 1时生效,0,非二级商户号订单,1,二级商户号订单,2,两种方式皆可(后续只会存在1)
|
||||
/// </summary>
|
||||
public int requiredFundType { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 跟踪ID,有效期十分钟,会影响主播归因、分享员归因等,需创建订单前调用,调用生成订单 api 时需传入该参数
|
||||
/// </summary>
|
||||
public string traceId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -232,7 +249,6 @@ namespace CoreCms.Net.Model.ViewModels.DTO
|
||||
/// </summary>
|
||||
public int receiptType { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 门店序列
|
||||
/// </summary>
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace CoreCms.Net.RedisMQ.Subscribe
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自定义交易组件-同步订单状态
|
||||
/// 自定义交易组件-同步订单确认收货
|
||||
/// </summary>
|
||||
/// <param name="msg"></param>
|
||||
/// <returns></returns>
|
||||
@@ -95,7 +95,7 @@ namespace CoreCms.Net.RedisMQ.Subscribe
|
||||
request.OutOrderId = orderModel.orderId;
|
||||
var response = await client.ExecuteShopDeliveryReceiveAsync(request);
|
||||
NLogUtil.WriteAll(response.IsSuccessful() ? LogLevel.Info : LogLevel.Error,
|
||||
LogType.RedisMessageQueue, "自定义交易组件-同步订单确认收货", JsonConvert.SerializeObject(request));
|
||||
LogType.RedisMessageQueue, "自定义交易组件-同步订单确认收货", JsonConvert.SerializeObject(response));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -33,25 +33,23 @@ namespace CoreCms.Net.RedisMQ.Subscribe
|
||||
private readonly string _wxOpenAppId = AppSettingsConstVars.WxOpenAppId;
|
||||
private readonly string _wxOpenAppSecret = AppSettingsConstVars.WxOpenAppSecret;
|
||||
|
||||
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
|
||||
private readonly ICoreCmsBillDeliveryServices _billDeliveryServices;
|
||||
private readonly ICoreCmsBillDeliveryItemServices _billDeliveryItemServices;
|
||||
private readonly ICoreCmsOrderServices _orderServices;
|
||||
private readonly ICoreCmsOrderItemServices _orderItemServices;
|
||||
private readonly ICoreCmsUserWeChatInfoServices _weChatInfoServices;
|
||||
private readonly IWeChatTransactionComponentOrderServices _tcOrderServices;
|
||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
|
||||
|
||||
|
||||
public TCOrderShipSyncSubscribe(ICoreCmsUserWeChatInfoServices userWeChatInfoServices, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsOrderServices orderServices, ICoreCmsUserWeChatInfoServices weChatInfoServices, IWeChatTransactionComponentOrderServices tcOrderServices, ICoreCmsOrderItemServices orderItemServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory)
|
||||
public TCOrderShipSyncSubscribe(ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsOrderServices orderServices, IWeChatTransactionComponentOrderServices tcOrderServices, ICoreCmsOrderItemServices orderItemServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsBillDeliveryItemServices billDeliveryItemServices)
|
||||
{
|
||||
_userWeChatInfoServices = userWeChatInfoServices;
|
||||
_billDeliveryServices = billDeliveryServices;
|
||||
_orderServices = orderServices;
|
||||
_weChatInfoServices = weChatInfoServices;
|
||||
_tcOrderServices = tcOrderServices;
|
||||
_orderItemServices = orderItemServices;
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_billDeliveryItemServices = billDeliveryItemServices;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -88,6 +86,9 @@ namespace CoreCms.Net.RedisMQ.Subscribe
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var items = await _billDeliveryItemServices.QueryListByClauseAsync(p => p.deliveryId == billDelivery.deliveryId);
|
||||
|
||||
//判断是否发货发完
|
||||
var finishAllDelivery = false;
|
||||
|
||||
@@ -109,13 +110,30 @@ namespace CoreCms.Net.RedisMQ.Subscribe
|
||||
request.OutOrderId = orderInfo.orderId;
|
||||
request.OpenId = tcOrderModel.openid;
|
||||
request.IsFinishAll = finishAllDelivery;
|
||||
request.DeliveryList = new List<ShopDeliverySendRequest.Types.Delivery>
|
||||
|
||||
var delivery = new ShopDeliverySendRequest.Types.Delivery
|
||||
{
|
||||
new ShopDeliverySendRequest.Types.Delivery()
|
||||
{
|
||||
DeliveryId = billDelivery.thirdPartylogiCode, WaybillId = billDelivery.logiNo
|
||||
}
|
||||
DeliveryId = billDelivery.thirdPartylogiCode,
|
||||
WaybillId = billDelivery.logiNo,
|
||||
ProductList = new List<ShopDeliverySendRequest.Types.Delivery.Types.Product>()
|
||||
};
|
||||
|
||||
items.ForEach(p =>
|
||||
{
|
||||
delivery.ProductList.Add(new ShopDeliverySendRequest.Types.Delivery.Types.Product()
|
||||
{
|
||||
OutProductId = p.goodsId.ToString(),
|
||||
OutSKUId = p.productId.ToString(),
|
||||
Count = p.nums
|
||||
});
|
||||
});
|
||||
|
||||
request.DeliveryList = new List<ShopDeliverySendRequest.Types.Delivery>()
|
||||
{
|
||||
delivery
|
||||
};
|
||||
|
||||
request.ShipDoneTime = new DateTimeOffset(billDelivery.createTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/7/10 22:41:46
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2021/7/10 22:41:46
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
@@ -26,7 +26,7 @@ using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
namespace CoreCms.Net.RedisMQ.Subscribe
|
||||
{
|
||||
/// <summary>
|
||||
/// 自定义交易组件-同步订单状态
|
||||
/// 自定义交易组件-同步订单状态(弃用,新版已经取消了同步)
|
||||
/// </summary>
|
||||
public class TCPayOrderSyncSubscribe : IRedisSubscribe
|
||||
{
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2022/6/29 16:22:45
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Caching.Manual;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信交易组件下单前置检查 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsCheckBeforeAddOrderRepository : BaseRepository<CoreCmsCheckBeforeAddOrder>, ICoreCmsCheckBeforeAddOrderRepository
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
public CoreCmsCheckBeforeAddOrderRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2022/6/29 16:22:45
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
namespace CoreCms.Net.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信交易组件下单前置检查 接口实现
|
||||
/// </summary>
|
||||
public class CoreCmsCheckBeforeAddOrderServices : BaseServices<CoreCmsCheckBeforeAddOrder>, ICoreCmsCheckBeforeAddOrderServices
|
||||
{
|
||||
private readonly ICoreCmsCheckBeforeAddOrderRepository _dal;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public CoreCmsCheckBeforeAddOrderServices(IUnitOfWork unitOfWork, ICoreCmsCheckBeforeAddOrderRepository dal)
|
||||
{
|
||||
this._dal = dal;
|
||||
base.BaseDal = dal;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Caching.AccressToken;
|
||||
using CoreCms.Net.Caching.AutoMate.RedisCache;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
@@ -29,10 +30,15 @@ using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||
using CoreCms.Net.WeChat.Service.TransactionComponent.Enum;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||
using SqlSugar;
|
||||
using Yitter.IdGenerator;
|
||||
|
||||
|
||||
namespace CoreCms.Net.Services
|
||||
@@ -75,6 +81,9 @@ namespace CoreCms.Net.Services
|
||||
private readonly IRedisOperationRepository _redisOperationRepository;
|
||||
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
|
||||
private readonly IWeChatTransactionComponentOrderServices _tcOrderServices;
|
||||
private readonly ICoreCmsCheckBeforeAddOrderServices _checkBeforeAddOrderServices;
|
||||
private readonly IWeChatTransactionComponentOrderServices _chatTransactionComponentOrderServices;
|
||||
private readonly WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +112,7 @@ namespace CoreCms.Net.Services
|
||||
, ICoreCmsPaymentsServices paymentsServices
|
||||
, ICoreCmsBillRefundServices billRefundServices
|
||||
, ICoreCmsBillLadingServices billLadingServices
|
||||
, ICoreCmsBillReshipServices billReshipServices, ICoreCmsMessageCenterServices messageCenterServices, ICoreCmsGoodsCommentServices goodsCommentServices, ISysTaskLogServices taskLogServices, ICoreCmsPromotionRecordServices promotionRecordServices, IRedisOperationRepository redisOperationRepository, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IWeChatTransactionComponentOrderServices tcOrderServices)
|
||||
, ICoreCmsBillReshipServices billReshipServices, ICoreCmsMessageCenterServices messageCenterServices, ICoreCmsGoodsCommentServices goodsCommentServices, ISysTaskLogServices taskLogServices, ICoreCmsPromotionRecordServices promotionRecordServices, IRedisOperationRepository redisOperationRepository, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IWeChatTransactionComponentOrderServices tcOrderServices, ICoreCmsCheckBeforeAddOrderServices checkBeforeAddOrderServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, IWeChatTransactionComponentOrderServices chatTransactionComponentOrderServices)
|
||||
{
|
||||
this._dal = dal;
|
||||
base.BaseDal = dal;
|
||||
@@ -139,6 +148,9 @@ namespace CoreCms.Net.Services
|
||||
_redisOperationRepository = redisOperationRepository;
|
||||
_userWeChatInfoServices = userWeChatInfoServices;
|
||||
_tcOrderServices = tcOrderServices;
|
||||
_checkBeforeAddOrderServices = checkBeforeAddOrderServices;
|
||||
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
|
||||
_chatTransactionComponentOrderServices = chatTransactionComponentOrderServices;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,8 +212,11 @@ namespace CoreCms.Net.Services
|
||||
/// <param name="taxCode">发票税务编码</param>
|
||||
/// <param name="objectId">关联非普通订单营销功能的序列</param>
|
||||
/// <param name="teamId">拼团订单分组序列</param>
|
||||
/// <param name="requireOrder">微信自定义组件(是否需要推单,1:需要,0:不需要)</param>
|
||||
/// <param name="requiredFundType">微信自定义组件(requireOrder = 1时生效,0,非二级商户号订单,1,二级商户号订单,2,两种方式皆可(后续只会存在1))</param>
|
||||
/// <param name="traceId">微信自定义组件(跟踪ID,有效期十分钟,会影响主播归因、分享员归因等,需创建订单前调用,调用生成订单 api 时需传入该参数)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<WebApiCallBack> ToAdd(int userId, int orderType, string cartIds, int receiptType, int ushipId, int storeId, string ladingName, string ladingMobile, string memo, int point, string couponCode, int source, int scene, int taxType, string taxName, string taxCode, int objectId, int teamId)
|
||||
public async Task<WebApiCallBack> ToAdd(int userId, int orderType, string cartIds, int receiptType, int ushipId, int storeId, string ladingName, string ladingMobile, string memo, int point, string couponCode, int source, int scene, int taxType, string taxName, string taxCode, int objectId, int teamId, int requireOrder, int requiredFundType, string traceId)
|
||||
{
|
||||
var jm = new WebApiCallBack() { methodDescription = "创建订单" };
|
||||
|
||||
@@ -253,6 +268,7 @@ namespace CoreCms.Net.Services
|
||||
order.createTime = DateTime.Now;
|
||||
order.scene = scene;
|
||||
|
||||
|
||||
//不同的订单类型会有不同的操作
|
||||
switch (orderType)
|
||||
{
|
||||
@@ -285,18 +301,22 @@ namespace CoreCms.Net.Services
|
||||
//砍价模式
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
jm.status = false;
|
||||
jm.data = 10000;
|
||||
jm.msg = GlobalErrorCodeVars.Code10000;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
//开始事务处理
|
||||
await _dal.InsertAsync(order);
|
||||
|
||||
//插入获取的下单前的微信视频号直接数据
|
||||
var check = new CoreCmsCheckBeforeAddOrder();
|
||||
check.orderId = order.orderId;
|
||||
check.requireOrder = requireOrder;
|
||||
check.requiredFundType = requiredFundType;
|
||||
check.traceId = traceId;
|
||||
check.createTime = DateTime.Now;
|
||||
|
||||
await _checkBeforeAddOrderServices.InsertAsync(check);
|
||||
|
||||
//上面保存好订单表,下面保存订单的其他信息
|
||||
if (orderItems != null)
|
||||
{
|
||||
@@ -393,6 +413,102 @@ namespace CoreCms.Net.Services
|
||||
order.taxTitle = taxName;
|
||||
order.taxCode = taxCode;
|
||||
|
||||
|
||||
if (requireOrder == (int)GlobalEnumVars.RequireOrderType.需要)
|
||||
{
|
||||
|
||||
//获取小程序认证
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
var orderInfo = new ShopOrderAddRequest
|
||||
{
|
||||
AccessToken = accessToken,
|
||||
Scene = scene,
|
||||
//基础
|
||||
CreateTime = new DateTimeOffset(DateTime.Now),
|
||||
//FundType = (int)GlobalEnumVars.RequiredFundType.二级商户号订单,
|
||||
FundType = (int)GlobalEnumVars.RequiredFundType.二级商户号订单, //新版自定义交易组件,必须要走二级商户订单模式
|
||||
OutOrderId = order.orderId,
|
||||
PagePath = UniAppConst.OrderPath(order.orderId)
|
||||
};
|
||||
|
||||
var weChatUserInfo = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == order.userId, true);
|
||||
if (weChatUserInfo != null)
|
||||
{
|
||||
orderInfo.OpenId = weChatUserInfo.openid;
|
||||
}
|
||||
orderInfo.OutUserId = order.userId.ToString();
|
||||
|
||||
//收货人信息
|
||||
orderInfo.Address = new ShopOrderAddRequest.Types.Address()
|
||||
{
|
||||
ReceiverName = order.shipName,
|
||||
Detail = order.shipAddress,
|
||||
TeleNumber = order.shipMobile,
|
||||
};
|
||||
//发货方式
|
||||
orderInfo.Delivery = new ShopOrderAddRequest.Types.Delivery()
|
||||
{
|
||||
DeliveryType = (int)DeliveryTypeEnum.正常快递
|
||||
};
|
||||
|
||||
orderInfo.OrderDetail = new ShopOrderAddRequest.Types.OrderDetail();
|
||||
|
||||
//支付信息
|
||||
orderInfo.OrderDetail.Payment = new ShopOrderAddRequest.Types.OrderDetail.Types.Payment()
|
||||
{
|
||||
PayType = (int)GlobalEnumVars.PayMethodType.微信支付
|
||||
};
|
||||
//价格体系
|
||||
orderInfo.OrderDetail.Amount = new ShopOrderAddRequest.Types.OrderDetail.Types.Amount()
|
||||
{
|
||||
OrderFee = Convert.ToInt32(order.orderAmount * 100),
|
||||
FreightFee = Convert.ToInt32(order.costFreight * 100),
|
||||
DiscountedFee = Convert.ToInt32((order.pointMoney + order.orderDiscountAmount + order.goodsDiscountAmount + order.couponDiscountAmount) * 100),
|
||||
AdditionalPrice = 0,
|
||||
AdditionalRemark = "无",
|
||||
};
|
||||
|
||||
//商品信息
|
||||
orderInfo.OrderDetail.ProductList = new List<ShopOrderAddRequest.Types.OrderDetail.Types.Product>();
|
||||
|
||||
|
||||
foreach (var item in orderItems)
|
||||
{
|
||||
orderInfo.OrderDetail.ProductList.Add(new ShopOrderAddRequest.Types.OrderDetail.Types.Product()
|
||||
{
|
||||
OutProductId = item.goodsId.ToString(),
|
||||
OutSKUId = item.productId.ToString(),
|
||||
Count = item.nums,
|
||||
SalePrice = Convert.ToInt32(item.amount * 100),
|
||||
SKURealPrice = Convert.ToInt32(item.amount * 100),
|
||||
PagePath = UniAppConst.GoodDetail(item.goodsId.ToString()),
|
||||
Title = item.name,
|
||||
HeadImageUrl = item.imageUrl
|
||||
});
|
||||
}
|
||||
|
||||
var shopOrderAddResponse = await client.ExecuteShopOrderAddAsync(orderInfo);
|
||||
if (shopOrderAddResponse.IsSuccessful())
|
||||
{
|
||||
var tcOrder = new WeChatTransactionComponentOrder
|
||||
{
|
||||
orderId = shopOrderAddResponse.Data.OrderId,
|
||||
outOrderId = shopOrderAddResponse.Data.OutOrderId,
|
||||
createTime = DateTime.Now,
|
||||
openid = orderInfo.OpenId
|
||||
};
|
||||
await _chatTransactionComponentOrderServices.InsertAsync(tcOrder);
|
||||
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.Order, "自定义交易组件", "推送自定义交易组件创建订单成功");
|
||||
}
|
||||
else
|
||||
{
|
||||
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.Order, "自定义交易组件 ", "推送自定义交易组件创建订单失败");
|
||||
}
|
||||
jm.otherData = shopOrderAddResponse;
|
||||
}
|
||||
|
||||
//发送消息
|
||||
//推送消息
|
||||
await _messageCenterServices.SendMessage(order.userId, GlobalEnumVars.PlatformMessageTypes.CreateOrder.ToString(), JObject.FromObject(order));
|
||||
@@ -1394,12 +1510,13 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
}
|
||||
|
||||
if (order.orderType == (int)GlobalEnumVars.OrderType.Common && order.scene > 0)
|
||||
{
|
||||
order.paymentItem = new List<CoreCmsBillPayments> { billPaymentInfo };
|
||||
//自定义交易组件同步
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentPayOrderSync, JsonConvert.SerializeObject(order));
|
||||
}
|
||||
//新版自定义交易组件已经不需要同步订单支付状态。
|
||||
//if (order.orderType == (int)GlobalEnumVars.OrderType.Common && order.scene > 0)
|
||||
//{
|
||||
// order.paymentItem = new List<CoreCmsBillPayments> { billPaymentInfo };
|
||||
// //自定义交易组件同步
|
||||
// await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentPayOrderSync, JsonConvert.SerializeObject(order));
|
||||
//}
|
||||
|
||||
//结佣处理
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.OrderAgentOrDistribution, JsonConvert.SerializeObject(order));
|
||||
@@ -1495,6 +1612,10 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
_goodsServices.ChangeStock(item.productId, GlobalEnumVars.OrderChangeStockType.cancel.ToString(), item.nums);
|
||||
}
|
||||
|
||||
var orderInfoIds = orderInfo.Select(p => p.orderId).ToList();
|
||||
await CloseOrder(orderInfoIds);
|
||||
|
||||
jm.status = true;
|
||||
jm.msg = "订单取消成功";
|
||||
}
|
||||
@@ -1939,8 +2060,9 @@ namespace CoreCms.Net.Services
|
||||
/// <param name="orderId"></param>
|
||||
/// <param name="score">有序队列积分</param>
|
||||
/// <param name="remark"></param>
|
||||
/// <param name="source">来源/system(系统)/wxpost(微信消息推送)</param>
|
||||
/// <returns></returns>
|
||||
public async Task<WebApiCallBack> CompleteOrder(string orderId, int score = 0, string remark = "后台订单完成操作")
|
||||
public async Task<WebApiCallBack> CompleteOrder(string orderId, int score = 0, string remark = "后台订单完成操作", string source = "system")
|
||||
{
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
@@ -2003,9 +2125,11 @@ namespace CoreCms.Net.Services
|
||||
//订单完成结算订单
|
||||
await _redisOperationRepository.SortedSetAddAsync(RedisMessageQueueKey.OrderFinishCommand, orderInfo.orderId, score);
|
||||
|
||||
// 微信自定义交易组件-订单确认收货
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentOrderDeliveryRecieveSync, JsonConvert.SerializeObject(orderInfo));
|
||||
|
||||
if (source== "system")
|
||||
{
|
||||
// 微信自定义交易组件-订单确认收货
|
||||
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.TransactionComponentOrderDeliveryRecieveSync, JsonConvert.SerializeObject(orderInfo));
|
||||
}
|
||||
|
||||
jm.status = true;
|
||||
jm.msg = "订单完成";
|
||||
@@ -2126,6 +2250,9 @@ namespace CoreCms.Net.Services
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 重写根据条件列表数据
|
||||
/// <summary>
|
||||
/// 重写根据条件列表数据
|
||||
@@ -2191,6 +2318,8 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
var ids = orderInfos.Select(p => p.orderId).ToArray();
|
||||
jm = await CancelOrder(ids);
|
||||
|
||||
await CloseOrder(ids.ToList());
|
||||
}
|
||||
|
||||
|
||||
@@ -2441,5 +2570,45 @@ namespace CoreCms.Net.Services
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 自定义交易组件-关闭订单
|
||||
|
||||
private async Task CloseOrder(ICollection<string> ids)
|
||||
{
|
||||
|
||||
//判断是否是自定义交易订单
|
||||
var coreCmsCheckBeforeAddOrders = await _checkBeforeAddOrderServices.QueryListByClauseAsync(p => ids.Contains(p.orderId) && p.requireOrder == (int)GlobalEnumVars.RequireOrderType.需要);
|
||||
if (coreCmsCheckBeforeAddOrders.Any())
|
||||
{
|
||||
var dataIds = coreCmsCheckBeforeAddOrders.Select(p => p.orderId).ToList();
|
||||
var orderInfos = await _dal.QueryListByClauseAsync(p => dataIds.Contains(p.orderId), p => p.createTime, OrderByType.Asc, true);
|
||||
|
||||
//获取小程序认证
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
|
||||
foreach (var item in orderInfos)
|
||||
{
|
||||
var request = new ShopOrderCloseRequest();
|
||||
request.AccessToken = accessToken;
|
||||
request.OutOrderId = item.orderId;
|
||||
|
||||
var user = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == item.userId);
|
||||
if (user == null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
request.OutOrderId = item.orderId;
|
||||
request.OpenId = user.openid;
|
||||
|
||||
var response = await client.ExecuteShopOrderCloseAsync(request);
|
||||
NLogUtil.WriteAll(response.IsSuccessful() ? NLog.LogLevel.Info : NLog.LogLevel.Error,
|
||||
LogType.Web, "自定义交易组件-关闭订单", JsonConvert.SerializeObject(response));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.WeChat.Service.HttpClients;
|
||||
using CoreCms.Net.WeChat.Service.TransactionComponent.Enum;
|
||||
using CoreCms.Net.WeChat.Service.TransactionComponent.Models;
|
||||
using Essensoft.Paylink.WeChatPay;
|
||||
using Essensoft.Paylink.WeChatPay.V2;
|
||||
using Essensoft.Paylink.WeChatPay.V2.Request;
|
||||
@@ -75,255 +73,145 @@ namespace CoreCms.Net.Services
|
||||
{
|
||||
using var container = _serviceProvider.CreateScope();
|
||||
var orderServices = container.ServiceProvider.GetService<ICoreCmsOrderServices>();
|
||||
var orderItemServices = container.ServiceProvider.GetService<ICoreCmsOrderItemServices>();
|
||||
var billPaymentsServices = container.ServiceProvider.GetService<ICoreCmsBillPaymentsServices>();
|
||||
var weChatTransactionComponentOrderServices = container.ServiceProvider.GetService<IWeChatTransactionComponentOrderServices>();
|
||||
var checkBeforeAddOrderServices = container.ServiceProvider.GetService<ICoreCmsCheckBeforeAddOrderServices>();
|
||||
var transactionComponentOrderServices = container.ServiceProvider.GetService<IWeChatTransactionComponentOrderServices>();
|
||||
|
||||
var jm = new WebApiCallBack();
|
||||
|
||||
var weChatPayUrl = AppSettingsConstVars.PayCallBackWeChatPayUrl;
|
||||
if (string.IsNullOrEmpty(weChatPayUrl))
|
||||
var payment = await billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.paymentId);
|
||||
var checkBeforeAddOrder = await checkBeforeAddOrderServices.QueryByClauseAsync(p => p.orderId == payment.sourceId);
|
||||
if (checkBeforeAddOrder != null && checkBeforeAddOrder.requireOrder == (int)GlobalEnumVars.RequireOrderType.需要)
|
||||
{
|
||||
jm.msg = "未获取到配置的通知地址";
|
||||
return jm;
|
||||
}
|
||||
var order = await transactionComponentOrderServices.QueryByClauseAsync(p => p.outOrderId == payment.sourceId);
|
||||
|
||||
var tradeType = GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
if (!string.IsNullOrEmpty(entity.parameters))
|
||||
{
|
||||
var jobj = (JObject)JsonConvert.DeserializeObject(entity.parameters);
|
||||
if (jobj != null && jobj.ContainsKey("trade_type"))
|
||||
tradeType = GetTradeType(jobj["trade_type"].ObjectToString());
|
||||
}
|
||||
//获取小程序认证
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
var openId = string.Empty;
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString())
|
||||
{
|
||||
var userAccount = await _userServices.QueryByIdAsync(_user.ID);
|
||||
if (userAccount == null)
|
||||
var getPaymentParameters = new ShopOrderGetPaymentParametersRequest();
|
||||
|
||||
getPaymentParameters.AccessToken = accessToken;
|
||||
getPaymentParameters.OpenId = order.openid;
|
||||
getPaymentParameters.OrderId = order.orderId;
|
||||
getPaymentParameters.OutOrderId = order.outOrderId;
|
||||
|
||||
var shopOrderGetPayment = await client.ExecuteShopOrderGetPaymentParametersAsync(getPaymentParameters);
|
||||
if (shopOrderGetPayment.IsSuccessful())
|
||||
{
|
||||
jm.msg = "用户账户获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
if (userAccount.userWx <= 0)
|
||||
{
|
||||
jm.msg = "账户关联微信用户信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var user = await _userWeChatInfoServices.QueryByClauseAsync(p => p.id == userAccount.userWx);
|
||||
if (user == null)
|
||||
{
|
||||
jm.msg = "微信用户信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
openId = user.openid;
|
||||
}
|
||||
|
||||
var orderRequest = new WeChatPayUnifiedOrderRequest
|
||||
{
|
||||
Body = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle,
|
||||
OutTradeNo = entity.paymentId,
|
||||
TotalFee = Convert.ToInt32(entity.money * 100),
|
||||
SpBillCreateIp = entity.ip,
|
||||
NotifyUrl = weChatPayUrl,
|
||||
TradeType = tradeType,
|
||||
//OpenId = openId
|
||||
};
|
||||
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString())
|
||||
{
|
||||
orderRequest.OpenId = openId;
|
||||
}
|
||||
|
||||
var response = await _client.ExecuteAsync(orderRequest, _optionsAccessor.Value);
|
||||
if (response.ReturnCode == WeChatPayCode.Success && response.ResultCode == WeChatPayCode.Success)
|
||||
{
|
||||
var req = new WeChatPayJsApiSdkRequest
|
||||
{
|
||||
Package = "prepay_id=" + response.PrepayId
|
||||
};
|
||||
WeChatPayDictionary parameter;
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.APP.ToString())
|
||||
{
|
||||
var reqApp = new WeChatPayAppSdkRequest()
|
||||
jm.data = new
|
||||
{
|
||||
PrepayId = response.PrepayId
|
||||
shopOrderGetPayment.PaymentParameters,
|
||||
checkBeforeAddOrder,
|
||||
entity.paymentId
|
||||
};
|
||||
parameter = await _client.ExecuteAsync(reqApp, _optionsAccessor.Value);
|
||||
jm.status = true;
|
||||
await transactionComponentOrderServices.UpdateAsync(p => new WeChatTransactionComponentOrder() { paymentId = entity.paymentId },
|
||||
p => p.outOrderId == payment.sourceId);
|
||||
}
|
||||
else
|
||||
{
|
||||
parameter = await _client.ExecuteAsync(req, _optionsAccessor.Value);
|
||||
jm.status = false;
|
||||
jm.msg = shopOrderGetPayment.ErrorMessage;
|
||||
}
|
||||
// 将参数(parameter)给 公众号前端 让他在微信内H5调起支付(https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6)
|
||||
parameter.Add("paymentId", entity.paymentId);
|
||||
|
||||
if (entity.type == (int)GlobalEnumVars.BillPaymentsType.Common
|
||||
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.PinTuan
|
||||
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Group
|
||||
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Skill
|
||||
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Bargain
|
||||
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway
|
||||
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|
||||
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.TransactionComponent)
|
||||
{
|
||||
var payment = await billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.paymentId);
|
||||
if (payment != null)
|
||||
{
|
||||
var is_matched = 0;
|
||||
var sceneResponse = new ShopSceneCheckResponse();
|
||||
#region 校验是否微信自定义交易组件
|
||||
var orderModel = await orderServices.QueryByClauseAsync(p => p.orderId == payment.sourceId);
|
||||
var orderInfo = new OrderInfo();
|
||||
//检查支付是否需要校验
|
||||
if (orderModel.source == 3 && orderModel.scene > 0)
|
||||
{
|
||||
//获取小程序认证
|
||||
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
|
||||
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
|
||||
|
||||
var sceneRequest = new ShopSceneCheckRequest();
|
||||
sceneRequest.AccessToken = accessToken;
|
||||
sceneRequest.Scene = orderModel.scene;
|
||||
|
||||
sceneResponse = await client.ExecuteShopSceneCheckAsync(sceneRequest);
|
||||
is_matched = sceneResponse.IsMatched ? 1 : 0;
|
||||
//if (sceneResponse.IsSuccessful() && sceneResponse.IsMatched == true)
|
||||
if (sceneResponse.IsSuccessful())
|
||||
{
|
||||
//基础
|
||||
orderInfo.create_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
orderInfo.type = 0;
|
||||
orderInfo.out_order_id = orderModel.orderId;
|
||||
|
||||
var weChatUserInfo = await _userWeChatInfoServices.QueryByClauseAsync(p => p.userId == orderModel.userId, true);
|
||||
if (weChatUserInfo != null)
|
||||
{
|
||||
orderInfo.openid = weChatUserInfo.openid;
|
||||
}
|
||||
orderInfo.path = UniAppConst.OrderPath(orderModel.orderId);
|
||||
orderInfo.out_user_id = orderModel.userId.ToString();
|
||||
|
||||
//收货人信息
|
||||
orderInfo.address_info = new AddressInfo();
|
||||
orderInfo.address_info.receiver_name = orderModel.shipName;
|
||||
orderInfo.address_info.detailed_address = orderModel.shipAddress;
|
||||
orderInfo.address_info.tel_number = orderModel.shipMobile;
|
||||
|
||||
|
||||
//发货方式
|
||||
orderInfo.delivery_detail = new DeliveryDetail();
|
||||
|
||||
if (orderModel.receiptType == (int)GlobalEnumVars.OrderReceiptType.Logistics)
|
||||
{
|
||||
orderInfo.delivery_detail.delivery_type = (int)DeliveryTypeEnum.正常快递;
|
||||
}
|
||||
else if (orderModel.receiptType == (int)GlobalEnumVars.OrderReceiptType.IntraCityService)
|
||||
{
|
||||
orderInfo.delivery_detail.delivery_type = (int)DeliveryTypeEnum.线下配送;
|
||||
}
|
||||
else if (orderModel.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
|
||||
{
|
||||
orderInfo.delivery_detail.delivery_type = (int)DeliveryTypeEnum.用户自提;
|
||||
}
|
||||
|
||||
orderInfo.order_detail = new OrderDetail();
|
||||
//订单详情
|
||||
|
||||
//支付信息
|
||||
orderInfo.order_detail.pay_info = new PayInfo()
|
||||
{
|
||||
pay_method = "微信支付",
|
||||
prepay_id = entity.paymentId,
|
||||
prepay_time = entity.createTime.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
|
||||
};
|
||||
|
||||
//价格体系
|
||||
orderInfo.order_detail.price_info = new PriceInfo()
|
||||
{
|
||||
order_price = Convert.ToInt32(orderModel.orderAmount * 100),
|
||||
freight = Convert.ToInt32(orderModel.costFreight * 100),
|
||||
discounted_price = Convert.ToInt32((orderModel.pointMoney + orderModel.orderDiscountAmount + orderModel.goodsDiscountAmount + orderModel.couponDiscountAmount) * 100),
|
||||
additional_price = 0,
|
||||
additional_remarks = "无",
|
||||
};
|
||||
|
||||
//商品信息
|
||||
orderInfo.order_detail.product_infos = new List<ProductInfoItem>();
|
||||
|
||||
var orderItems = await orderItemServices.QueryListByClauseAsync(p => p.orderId == orderModel.orderId);
|
||||
|
||||
foreach (var item in orderItems)
|
||||
{
|
||||
orderInfo.order_detail.product_infos.Add(new ProductInfoItem()
|
||||
{
|
||||
out_product_id = item.goodsId.ToString(),
|
||||
out_sku_id = item.productId.ToString(),
|
||||
head_img = item.imageUrl,
|
||||
product_cnt = item.nums,
|
||||
sale_price = Convert.ToInt32(item.amount * 100),
|
||||
path = UniAppConst.GoodDetail(item.goodsId.ToString()),
|
||||
title = item.name
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
var tcOrder = await weChatTransactionComponentOrderServices.QueryByClauseAsync(p => p.outOrderId == orderModel.orderId);
|
||||
if (tcOrder == null)
|
||||
{
|
||||
tcOrder = new WeChatTransactionComponentOrder
|
||||
{
|
||||
outOrderId = orderModel.orderId,
|
||||
createTime = DateTime.Now,
|
||||
openid = openId
|
||||
};
|
||||
await weChatTransactionComponentOrderServices.InsertAsync(tcOrder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
jm.otherData = new
|
||||
{
|
||||
response,
|
||||
orderInfo,
|
||||
checkSceneResult = new
|
||||
{
|
||||
is_matched,
|
||||
sceneResponse
|
||||
}
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.otherData = response;
|
||||
}
|
||||
|
||||
jm.status = true;
|
||||
//jm.msg = "创建支付环境成功";
|
||||
jm.data = parameter;
|
||||
return jm;
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.status = false;
|
||||
jm.msg = "微信建立支付请求失败";
|
||||
jm.otherData = response;
|
||||
var weChatPayUrl = AppSettingsConstVars.PayCallBackWeChatPayUrl;
|
||||
if (string.IsNullOrEmpty(weChatPayUrl))
|
||||
{
|
||||
jm.msg = "未获取到配置的通知地址";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var tradeType = GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString();
|
||||
if (!string.IsNullOrEmpty(entity.parameters))
|
||||
{
|
||||
var jobj = (JObject)JsonConvert.DeserializeObject(entity.parameters);
|
||||
if (jobj != null && jobj.ContainsKey("trade_type"))
|
||||
tradeType = GetTradeType(jobj["trade_type"].ObjectToString());
|
||||
}
|
||||
|
||||
var openId = string.Empty;
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString())
|
||||
{
|
||||
var userAccount = await _userServices.QueryByIdAsync(_user.ID);
|
||||
if (userAccount == null)
|
||||
{
|
||||
jm.msg = "用户账户获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
if (userAccount.userWx <= 0)
|
||||
{
|
||||
jm.msg = "账户关联微信用户信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
var user = await _userWeChatInfoServices.QueryByClauseAsync(p => p.id == userAccount.userWx);
|
||||
if (user == null)
|
||||
{
|
||||
jm.msg = "微信用户信息获取失败";
|
||||
return jm;
|
||||
}
|
||||
|
||||
openId = user.openid;
|
||||
}
|
||||
|
||||
var orderRequest = new WeChatPayUnifiedOrderRequest
|
||||
{
|
||||
Body = entity.payTitle.Length > 40 ? entity.payTitle[..40] : entity.payTitle,
|
||||
OutTradeNo = entity.paymentId,
|
||||
TotalFee = Convert.ToInt32(entity.money * 100),
|
||||
SpBillCreateIp = entity.ip,
|
||||
NotifyUrl = weChatPayUrl,
|
||||
TradeType = tradeType,
|
||||
//OpenId = openId
|
||||
};
|
||||
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.JSAPI.ToString())
|
||||
{
|
||||
orderRequest.OpenId = openId;
|
||||
}
|
||||
|
||||
var response = await _client.ExecuteAsync(orderRequest, _optionsAccessor.Value);
|
||||
if (response.ReturnCode == WeChatPayCode.Success && response.ResultCode == WeChatPayCode.Success)
|
||||
{
|
||||
var req = new WeChatPayJsApiSdkRequest
|
||||
{
|
||||
Package = "prepay_id=" + response.PrepayId
|
||||
};
|
||||
WeChatPayDictionary parameter;
|
||||
if (tradeType == GlobalEnumVars.WeiChatPayTradeType.APP.ToString())
|
||||
{
|
||||
var reqApp = new WeChatPayAppSdkRequest()
|
||||
{
|
||||
PrepayId = response.PrepayId
|
||||
};
|
||||
parameter = await _client.ExecuteAsync(reqApp, _optionsAccessor.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
parameter = await _client.ExecuteAsync(req, _optionsAccessor.Value);
|
||||
}
|
||||
// 将参数(parameter)给 公众号前端 让他在微信内H5调起支付(https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=7_7&index=6)
|
||||
parameter.Add("paymentId", entity.paymentId);
|
||||
|
||||
jm.status = true;
|
||||
//jm.msg = "创建支付环境成功";
|
||||
jm.data = parameter;
|
||||
jm.otherData = response;
|
||||
}
|
||||
else
|
||||
{
|
||||
jm.status = false;
|
||||
jm.msg = "微信建立支付请求失败";
|
||||
jm.otherData = response;
|
||||
}
|
||||
return jm;
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -74,7 +74,9 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getPayments()
|
||||
this.getPayments();
|
||||
console.log('类型:' + this.type);
|
||||
console.log('订单号:' + this.orderId);
|
||||
},
|
||||
methods: {
|
||||
// 获取可用支付方式列表
|
||||
@@ -128,16 +130,16 @@
|
||||
switch (code) {
|
||||
case 'wechatpay':
|
||||
this.$u.api.pay(data).then(res => {
|
||||
console.log(res);
|
||||
if (res.status) {
|
||||
if (res.otherData.checkSceneResult) {
|
||||
if (res.data.checkBeforeAddOrder && res.data.checkBeforeAddOrder.requireOrder == 1) {
|
||||
console.log("自定义交易组件");
|
||||
wx.requestOrderPayment({
|
||||
timeStamp: res.data.timeStamp,
|
||||
nonceStr: res.data.nonceStr,
|
||||
package: res.data.package,
|
||||
signType: res.data.signType,
|
||||
paySign: res.data.paySign,
|
||||
orderInfo: res.otherData.orderInfo,
|
||||
timeStamp: res.data.paymentParameters.timeStamp + '',
|
||||
nonceStr: res.data.paymentParameters.nonceStr,
|
||||
package: res.data.paymentParameters.package,
|
||||
signType: res.data.paymentParameters.signType,
|
||||
paySign: res.data.paymentParameters.paySign,
|
||||
success: function (e) {
|
||||
console.log(e);
|
||||
if (e.errMsg === 'requestOrderPayment:ok') {
|
||||
@@ -153,6 +155,7 @@
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.log("普通订单");
|
||||
uni.requestPayment({
|
||||
provider: 'wxpay',
|
||||
timeStamp: res.data.timeStamp,
|
||||
|
||||
@@ -337,12 +337,38 @@
|
||||
isOpenMailing: true,
|
||||
isOpenSelfDelivery: true,
|
||||
OrderDistributionModels: [],
|
||||
OrderDistributionModelCurrent: ''
|
||||
OrderDistributionModelCurrent: '',
|
||||
requireOrder: 0,//自定义交易组件是否需要推单,1:需要,0:不需要
|
||||
requiredFundType: 0, //requireOrder = 1时生效,0,非二级商户号订单,1,二级商户号订单,2,两种方式皆可(后续只会存在1)
|
||||
traceId: '', //跟踪ID,有效期十分钟,会影响主播归因、分享员归因等,需创建订单前调用,调用生成订单 api 时需传入该参数
|
||||
}
|
||||
},
|
||||
components: {},
|
||||
onLoad(options) {
|
||||
console.log(options);
|
||||
var _this = this;
|
||||
//下单前置检查,自定义交易组件检测场景是否需要推送订单到微信服务。
|
||||
wx.checkBeforeAddOrder({
|
||||
success(res) {
|
||||
console.log('下单前置检查', res);
|
||||
if (res.errMsg == 'checkBeforeAddOrder:ok') {
|
||||
_this.requireOrder = res.data.requireOrder;
|
||||
_this.requiredFundType = res.data.requiredFundType;
|
||||
_this.traceId = res.data.traceId;
|
||||
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
_this.getOrderDistributionModel()
|
||||
|
||||
}
|
||||
},
|
||||
fail(res) {
|
||||
//微信说一般不会报错,所以我相信马化腾。
|
||||
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
_this.getOrderDistributionModel()
|
||||
}
|
||||
})
|
||||
|
||||
let cartIds = options.cartIds;
|
||||
if (options.orderType) {
|
||||
this.orderType = options.orderType;
|
||||
@@ -365,8 +391,7 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
this.getOrderDistributionModel()
|
||||
|
||||
// 获取用户的默认收货地址信息
|
||||
this.userDefaultShip()
|
||||
// 获取用户的可用优惠券信息
|
||||
@@ -441,36 +466,45 @@
|
||||
},
|
||||
// 获取不同类型营销下单支持的配送方式
|
||||
getOrderDistributionModel() {
|
||||
let data = {
|
||||
id: this.orderType
|
||||
};
|
||||
this.$u.api.getOrderDistributionModel(data).then(res => {
|
||||
if (res.status) {
|
||||
//物流快递
|
||||
this.isOpenMailing = res.data.isOpenMailing;
|
||||
//同城配送
|
||||
this.isOpenHomeDelivery = res.data.isOpenHomeDelivery;
|
||||
//上门自提
|
||||
this.isOpenSelfDelivery = res.data.isOpenSelfDelivery;
|
||||
if (this.requireOrder == 1) {
|
||||
let newTypeItems = [];
|
||||
newTypeItems.push('快递物流');
|
||||
this.OrderDistributionModels.push('isOpenMailing');
|
||||
this.typeItems = newTypeItems;
|
||||
this.OrderDistributionModelCurrent = this.OrderDistributionModels[0];
|
||||
} else {
|
||||
let data = {
|
||||
id: this.orderType
|
||||
};
|
||||
this.$u.api.getOrderDistributionModel(data).then(res => {
|
||||
if (res.status) {
|
||||
//物流快递
|
||||
this.isOpenMailing = res.data.isOpenMailing;
|
||||
//同城配送
|
||||
this.isOpenHomeDelivery = res.data.isOpenHomeDelivery;
|
||||
//上门自提
|
||||
this.isOpenSelfDelivery = res.data.isOpenSelfDelivery;
|
||||
|
||||
let newTypeItems = [];
|
||||
if (this.isOpenMailing) {
|
||||
newTypeItems.push('快递物流');
|
||||
this.OrderDistributionModels.push('isOpenMailing');
|
||||
if (this.requireOrder == 0) {
|
||||
let newTypeItems = [];
|
||||
if (this.isOpenMailing) {
|
||||
newTypeItems.push('快递物流');
|
||||
this.OrderDistributionModels.push('isOpenMailing');
|
||||
}
|
||||
if (this.isOpenHomeDelivery) {
|
||||
newTypeItems.push('同城配送');
|
||||
this.OrderDistributionModels.push('isOpenHomeDelivery');
|
||||
}
|
||||
if (this.isOpenSelfDelivery) {
|
||||
newTypeItems.push('门店自提');
|
||||
this.OrderDistributionModels.push('isOpenSelfDelivery');
|
||||
}
|
||||
this.typeItems = newTypeItems;
|
||||
}
|
||||
this.OrderDistributionModelCurrent = this.OrderDistributionModels[0];
|
||||
}
|
||||
if (this.isOpenHomeDelivery) {
|
||||
newTypeItems.push('同城配送');
|
||||
this.OrderDistributionModels.push('isOpenHomeDelivery');
|
||||
}
|
||||
if (this.isOpenSelfDelivery) {
|
||||
newTypeItems.push('门店自提');
|
||||
this.OrderDistributionModels.push('isOpenSelfDelivery');
|
||||
}
|
||||
this.typeItems = newTypeItems;
|
||||
this.OrderDistributionModelCurrent = this.OrderDistributionModels[0];
|
||||
}
|
||||
console.log(res);
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
// 获取用户的默认收货地址
|
||||
userDefaultShip() {
|
||||
@@ -680,7 +714,10 @@
|
||||
objectId: this.objectId,
|
||||
teamId: this.teamId,
|
||||
orderType: this.orderType, //订单类型
|
||||
scene: this.$store.state.scene //场景值(用于确定小程序是否来源直播和视频号)
|
||||
scene: this.$store.state.scene, //场景值(用于确定小程序是否来源直播和视频号)
|
||||
requireOrder: this.requireOrder,
|
||||
requiredFundType: this.requiredFundType,
|
||||
traceId: this.traceId,
|
||||
}
|
||||
|
||||
let delivery = {}
|
||||
|
||||
48
CoreCms.Net.Utility/Helper/TimeHelper.cs
Normal file
48
CoreCms.Net.Utility/Helper/TimeHelper.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CoreCms.Net.Utility.Helper
|
||||
{
|
||||
public class TimeHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 时间戳转本地时间-时间戳精确到秒
|
||||
/// </summary>
|
||||
public static DateTime ToLocalTimeDateBySeconds(long unix)
|
||||
{
|
||||
var dto = DateTimeOffset.FromUnixTimeSeconds(unix);
|
||||
return dto.ToLocalTime().DateTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间转时间戳Unix-时间戳精确到秒
|
||||
/// </summary>
|
||||
public static long ToUnixTimestampBySeconds(DateTime dt)
|
||||
{
|
||||
DateTimeOffset dto = new DateTimeOffset(dt);
|
||||
return dto.ToUnixTimeSeconds();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳转本地时间-时间戳精确到毫秒
|
||||
/// </summary>
|
||||
public static DateTime ToLocalTimeDateByMilliseconds(long unix)
|
||||
{
|
||||
var dto = DateTimeOffset.FromUnixTimeMilliseconds(unix);
|
||||
return dto.ToLocalTime().DateTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 时间转时间戳Unix-时间戳精确到毫秒
|
||||
/// </summary>
|
||||
public static long ToUnixTimestampByMilliseconds(DateTime dt)
|
||||
{
|
||||
DateTimeOffset dto = new DateTimeOffset(dt);
|
||||
return dto.ToUnixTimeMilliseconds();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,15 @@ namespace CoreCms.Net.WeChat.Service.Configuration
|
||||
/// 品牌审核结果
|
||||
/// </summary>
|
||||
public const string OpenProductBrandAudit = "open_product_brand_audit";
|
||||
/// <summary>
|
||||
/// 自定义交易组件支付回调
|
||||
/// </summary>
|
||||
public const string OpenProductOrderPay = "open_product_order_pay";
|
||||
/// <summary>
|
||||
/// 自定义交易组件用户确认收货
|
||||
/// </summary>
|
||||
public const string OpenProductOrderConfirm = "open_product_order_confirm";
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CoreCms.Net.IServices\CoreCms.Net.IServices.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.Loging\CoreCms.Net.Loging.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.Utility\CoreCms.Net.Utility.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/***********************************************************************
|
||||
* 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 OpenProductOrderConfirmEventCommand : IRequest<WeChatApiCallBack>
|
||||
{
|
||||
public OpenProductOrderConfirmEvent EventObj { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户确认收货事件回调。
|
||||
/// </summary>
|
||||
public class OpenProductOrderConfirmEventCommandHandler : IRequestHandler<OpenProductOrderConfirmEventCommand, WeChatApiCallBack>
|
||||
{
|
||||
private readonly ICoreCmsOrderServices _orderServices;
|
||||
|
||||
|
||||
|
||||
public OpenProductOrderConfirmEventCommandHandler(ICoreCmsOrderServices orderServices)
|
||||
{
|
||||
_orderServices = orderServices;
|
||||
}
|
||||
|
||||
public async Task<WeChatApiCallBack> Handle(OpenProductOrderConfirmEventCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var jm = new WeChatApiCallBack() { Status = true };
|
||||
if (request.EventObj != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
await _orderServices.CompleteOrder(request.EventObj.Order.OutOrderId, 0, "微信消息推送事件", "wxpost");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
NLogUtil.WriteFileLog(NLog.LogLevel.Info, LogType.WxPost, "接收服务器推送", "用户确认收货事件回调异常", e);
|
||||
|
||||
}
|
||||
}
|
||||
return await Task.FromResult(jm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
/***********************************************************************
|
||||
* 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 OpenProductOrderPayEventCommand : IRequest<WeChatApiCallBack>
|
||||
{
|
||||
public OpenProductOrderPayEvent EventObj { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 订单支付回调
|
||||
/// </summary>
|
||||
public class OpenProductOrderPayEventCommandHandler : IRequestHandler<OpenProductOrderPayEventCommand, WeChatApiCallBack>
|
||||
{
|
||||
private readonly ICoreCmsOrderServices _orderServices;
|
||||
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
|
||||
private readonly IWeChatTransactionComponentOrderServices _transactionComponentOrderServices;
|
||||
|
||||
|
||||
|
||||
public OpenProductOrderPayEventCommandHandler(ICoreCmsOrderServices orderServices, ICoreCmsBillPaymentsServices billPaymentsServices, IWeChatTransactionComponentOrderServices transactionComponentOrderServices)
|
||||
{
|
||||
_orderServices = orderServices;
|
||||
_billPaymentsServices = billPaymentsServices;
|
||||
_transactionComponentOrderServices = transactionComponentOrderServices;
|
||||
}
|
||||
|
||||
public async Task<WeChatApiCallBack> Handle(OpenProductOrderPayEventCommand request, CancellationToken cancellationToken)
|
||||
{
|
||||
var jm = new WeChatApiCallBack() { Status = true };
|
||||
if (request.EventObj != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
var tcOrder = await _transactionComponentOrderServices.QueryByClauseAsync(p => p.orderId == request.EventObj.Order.OrderId && p.outOrderId == request.EventObj.Order.OutOrderId);
|
||||
var order = await _orderServices.QueryByClauseAsync(p => p.orderId == tcOrder.outOrderId);
|
||||
|
||||
await _billPaymentsServices.ToUpdate(tcOrder.paymentId,
|
||||
(int)GlobalEnumVars.BillPaymentsStatus.Payed,
|
||||
GlobalEnumVars.PaymentsTypes.wechatpay.ToString(), order.orderAmount, JsonConvert.SerializeObject(request),
|
||||
request.EventObj.Order.TransactionId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
NLogUtil.WriteFileLog(NLog.LogLevel.Info, LogType.WxPost, "接收服务器推送", "订单支付回调异常", e);
|
||||
|
||||
}
|
||||
}
|
||||
return await Task.FromResult(jm);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
/***********************************************************************
|
||||
* 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; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -18,8 +18,8 @@ using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Model.ViewModels.DTO;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
@@ -48,6 +48,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
private readonly ICoreCmsStoreServices _storeServices;
|
||||
private readonly ICoreCmsOrderDistributionModelServices _orderDistributionModelServices;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
@@ -76,8 +78,19 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
|
||||
//公共接口====================================================================================================
|
||||
|
||||
|
||||
//验证接口====================================================================================================
|
||||
#region 发票模糊查询==================================================
|
||||
/// <summary>
|
||||
/// 发票模糊查询
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<WebApiCallBack> GetOrderTypeModel([FromBody] GetTaxCodePost entity)
|
||||
{
|
||||
var jm = await _orderServices.GetTaxCode(entity.name);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取不同类型营销下单支持的配送方式==================================================
|
||||
/// <summary>
|
||||
@@ -115,6 +128,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
//验证接口====================================================================================================
|
||||
|
||||
#region 发票模糊查询==================================================
|
||||
/// <summary>
|
||||
/// 发票模糊查询
|
||||
@@ -184,8 +199,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
jm = await _orderServices.ToAdd(_user.ID, entity.orderType, entity.cartIds, entity.receiptType,
|
||||
entity.ushipId, entity.storeId, entity.ladingName, entity.ladingMobile, entity.memo,
|
||||
entity.point, entity.couponCode, entity.source, entity.scene, entity.taxType, entity.taxName,
|
||||
entity.taxCode, entity.objectId, entity.teamId);
|
||||
jm.otherData = entity;
|
||||
entity.taxCode, entity.objectId, entity.teamId, entity.requireOrder, entity.requiredFundType, entity.traceId);
|
||||
//jm.otherData = entity;
|
||||
|
||||
return jm;
|
||||
}
|
||||
@@ -358,6 +373,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
}
|
||||
jm = await _aftersalesServices.ToAdd(_user.ID, entity.orderId, entity.type, entity.items, entity.images,
|
||||
entity.reason, entity.refund);
|
||||
jm.otherData = entity;
|
||||
return jm;
|
||||
|
||||
}
|
||||
@@ -381,7 +397,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers
|
||||
|
||||
var where = PredicateBuilder.True<CoreCmsBillAftersales>();
|
||||
where = where.And(p => p.userId == _user.ID);
|
||||
if (!string.IsNullOrEmpty(entity.order))
|
||||
if (!string.IsNullOrEmpty(entity.id))
|
||||
{
|
||||
where = where.And(p => p.orderId == entity.id);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers.WeChatOAuth
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 处理xml内容
|
||||
/// <summary>
|
||||
/// 对解密后的xml数据进行筛选并分发处理结果
|
||||
@@ -214,6 +213,17 @@ namespace CoreCms.Net.Web.WebApi.Controllers.WeChatOAuth
|
||||
var openProductBrandAuditEvent = client.DeserializeEventFromXml<SKIT.FlurlHttpClient.Wechat.Api.Events.OpenProductBrandAuditEvent>(msgXml);
|
||||
callBack = await _mediator.Send(new OpenProductBrandAuditEventCommand() { EventObj = openProductBrandAuditEvent });
|
||||
break;
|
||||
//自定义交易组件支付回调
|
||||
case EventType.OpenProductOrderPay:
|
||||
var openProductOrderPayEvent = client.DeserializeEventFromXml<SKIT.FlurlHttpClient.Wechat.Api.Events.OpenProductOrderPayEvent>(msgXml);
|
||||
callBack = await _mediator.Send(new OpenProductOrderPayEventCommand() { EventObj = openProductOrderPayEvent });
|
||||
break;
|
||||
//自定交易组件-用户确认收货
|
||||
case EventType.OpenProductOrderConfirm:
|
||||
var openProductOrderConfirmEvent = client.DeserializeEventFromXml<SKIT.FlurlHttpClient.Wechat.Api.Events.OpenProductOrderConfirmEvent>(msgXml);
|
||||
callBack = await _mediator.Send(new OpenProductOrderConfirmEventCommand() { EventObj = openProductOrderConfirmEvent });
|
||||
break;
|
||||
|
||||
default:
|
||||
NLogUtil.WriteFileLog(LogLevel.Info, LogType.WxPost, "接收服务器推送(处理xml内容/Event无匹配)", JsonConvert.SerializeObject(sourceXml));
|
||||
break;
|
||||
@@ -235,7 +245,6 @@ namespace CoreCms.Net.Web.WebApi.Controllers.WeChatOAuth
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 初始化获取xml文本数据
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user