【新增】新增【微信发货信息管理】功能对接。实现微信小程序二次发货功能平移到后台业务,减少繁琐的二次发货操作。

This commit is contained in:
jianweie code
2023-10-08 02:08:22 +08:00
parent ac0cc6c148
commit 55e84b78af
35 changed files with 3329 additions and 33 deletions

View File

@@ -353,6 +353,10 @@ namespace CoreCms.Net.Configuration
/// </summary> /// </summary>
public const string WeChatPayNotice = "WeChatPayNoticeQueue"; public const string WeChatPayNotice = "WeChatPayNoticeQueue";
/// <summary> /// <summary>
/// 微信支付成功后推送到接口进行发货处理
/// </summary>
public const string WeChatPayShipping = "WeChatPayShippingQueue";
/// <summary>
/// 微信模板消息 /// 微信模板消息
/// </summary> /// </summary>
public const string SendWxTemplateMessage = "SendWxTemplateMessage"; public const string SendWxTemplateMessage = "SendWxTemplateMessage";

View File

@@ -1066,12 +1066,6 @@ namespace CoreCms.Net.Configuration
/// </summary> /// </summary>
[Description("接龙")] [Description("接龙")]
Solitaire = 8, Solitaire = 8,
/// <summary>
/// 微信交易组件
/// </summary>
[Description("微信交易组件")]
TransactionComponent = 10,
} }
/// <summary> /// <summary>
@@ -3260,5 +3254,91 @@ namespace CoreCms.Net.Configuration
#endregion #endregion
#region
/// <summary>
/// 微信发货信息管理订单状态
/// </summary>
public enum WeChatShippingOrderStatus
{
/// <summary>
/// 待发货
/// </summary>
[Description("<button type='button' class='layui-btn layui-bg-red layui-btn-xs'>待发货</button>")]
= 1,
/// <summary>
/// 已发货
/// </summary>
[Description("<button type='button' class='layui-btn layui-bg-orange layui-btn-xs'>已发货</button>")]
= 2,
/// <summary>
/// 确认收货
/// </summary>
[Description("<button type='button' class='layui-btn layui-bg-blue layui-btn-xs'>确认收货</button>")]
= 3,
/// <summary>
/// 交易完成
/// </summary>
[Description("<button type='button' class='layui-btn layui-btn-xs'>交易完成</button>")]
= 4,
/// <summary>
/// 已退款
/// </summary>
[Description("<button type='button' class='layui-btn layui-bg-purple layui-btn-xs'>已退款</button>")]
退 = 5
}
/// <summary>
/// 物流模式
/// </summary>
public enum WeChatShippingLogisticsType
{
/// <summary>
/// 物流配送
/// </summary>
[Description("<button type='button' class='layui-btn layui-bg-red layui-btn-xs'>物流配送</button>")]
= 1,
/// <summary>
/// 同城配送
/// </summary>
[Description("<button type='button' class='layui-btn layui-bg-orange layui-btn-xs'>同城配送</button>")]
= 2,
/// <summary>
/// 虚拟商品
/// </summary>
[Description("<button type='button' class='layui-btn layui-bg-blue layui-btn-xs'>虚拟商品</button>")]
= 3,
/// <summary>
/// 用户自提
/// </summary>
[Description("<button type='button' class='layui-btn layui-btn-xs'>用户自提</button>")]
= 4,
}
/// <summary>
/// 发货模式
/// </summary>
public enum WeChatShippingDeliveryMode
{
/// <summary>
/// 统一发货
/// </summary>
UNIFIED_DELIVERY = 1,
/// <summary>
/// 分拆发货
/// </summary>
SPLIT_DELIVERY = 2
}
#endregion
} }
} }

View File

@@ -29,6 +29,7 @@ namespace CoreCms.Net.Core.Config
//对应的订阅者类需要new一个实例对象当然你也可以传参比如日志对象 //对应的订阅者类需要new一个实例对象当然你也可以传参比如日志对象
m.ListSubscribe = new List<Type>() { m.ListSubscribe = new List<Type>() {
typeof(MessagePushSubscribe), typeof(MessagePushSubscribe),
typeof(WeChatPayShippingSubscribe),
typeof(RefundSubscribe), typeof(RefundSubscribe),
typeof(OrderAgentOrDistributionSubscribe), typeof(OrderAgentOrDistributionSubscribe),
typeof(OrderAutomaticDeliverySubscribe), typeof(OrderAutomaticDeliverySubscribe),

View File

@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreCms.Net.DTO.WeChatShipping
{
/// <summary>
/// 获取运力id列表get_delivery_list返回值处理
/// </summary>
public class GetDeliveryListResult
{
/// <summary>
/// 返回码
/// </summary>
public int errcode { get; set; }
/// <summary>
/// 运力公司个数
/// </summary>
public int count { get; set; }
/// <summary>
/// 运力公司列表
/// </summary>
public List<deliveryModel> delivery_list { get; set; }
}
/// <summary>
/// 快递公司实体
/// </summary>
public class deliveryModel
{
/// <summary>
/// 公司编码
/// </summary>
public string delivery_id { get; set; }
/// <summary>
/// 公司名称
/// </summary>
public string delivery_name { get; set; }
}
}

View File

@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CoreCms.Net.DTO.WeChatShipping
{
/// <summary>
/// 发货信息录入接口提交参数
/// </summary>
public class OrderShippingCreatePost
{
/// <summary>
/// 同城配送快递编码
/// </summary>
public string? cityDistributionName { get; set; }
/// <summary>
/// 同城配送快递单号
/// </summary>
public string? cityDistributionNumber { get; set; }
/// <summary>
/// 是否全部发货
/// </summary>
public bool is_all_delivered { get; set; } = false;
/// <summary>
/// 商品信息
/// </summary>
public string item_desc { get; set; }
/// <summary>
/// 发货类型
/// </summary>
public int logistics_type { get; set; }
/// <summary>
/// 交易单号
/// </summary>
public string transaction_id { get; set; }
/// <summary>
/// 物流信息
/// </summary>
public List<ShippingList>? shipping_list { get; set; }
/// <summary>
/// openid
/// </summary>
public string openid { get; set; }
/// <summary>
/// 商户号
/// </summary>
public string merchant_id { get; set; }
/// <summary>
/// 商家订单编号
/// </summary>
public string merchant_trade_no { get; set; }
}
public class ShippingList
{
/// <summary>
/// 快递公司名称
/// </summary>
public string express_company { get; set; }
/// <summary>
/// 快递单号
/// </summary>
public string tracking_no { get; set; }
}
}

View File

@@ -0,0 +1,98 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2023/9/15 23:09:53
* 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 IWeChatShippingDeliveryRepository : IBaseRepository<WeChatShippingDelivery>
{
#region ===========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<AdminUiCallBack> InsertAsync(WeChatShippingDelivery entity);
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<AdminUiCallBack> UpdateAsync(WeChatShippingDelivery entity);
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<AdminUiCallBack> UpdateAsync(List<WeChatShippingDelivery> entity);
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<AdminUiCallBack> DeleteByIdAsync(object id);
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
#endregion
#region ==========================================================
/// <summary>
/// 获取缓存的所有数据
/// </summary>
/// <returns></returns>
Task<List<WeChatShippingDelivery>> GetCaChe();
#endregion
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
Task<IPageList<WeChatShippingDelivery>> QueryPageAsync(
Expression<Func<WeChatShippingDelivery, bool>> predicate,
Expression<Func<WeChatShippingDelivery, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false);
}
}

View File

@@ -0,0 +1,100 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2023/9/15 23:09:53
* 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 IWeChatShippingDeliveryServices : IBaseServices<WeChatShippingDelivery>
{
#region ===========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<AdminUiCallBack> InsertAsync(WeChatShippingDelivery entity);
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<AdminUiCallBack> UpdateAsync(WeChatShippingDelivery entity);
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
Task<AdminUiCallBack> UpdateAsync(List<WeChatShippingDelivery> entity);
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<AdminUiCallBack> DeleteByIdAsync(object id);
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
#endregion
#region ==========================================================
/// <summary>
/// 获取缓存的所有数据
/// </summary>
/// <returns></returns>
Task<List<WeChatShippingDelivery>> GetCaChe();
#endregion
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
Task<IPageList<WeChatShippingDelivery>> QueryPageAsync(
Expression<Func<WeChatShippingDelivery, bool>> predicate,
Expression<Func<WeChatShippingDelivery, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false);
#endregion
/// <summary>
/// 通过接口更新所有快递公司信息
/// </summary>
Task<AdminUiCallBack> DoUpdateCompany();
}
}

View File

@@ -0,0 +1,68 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2023/9/15 23:09:53
* Description: 暂无
***********************************************************************/
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace CoreCms.Net.Model.Entities
{
/// <summary>
/// 微信发货快递公司信息
/// </summary>
public partial class WeChatShippingDelivery
{
/// <summary>
/// 构造函数
/// </summary>
public WeChatShippingDelivery()
{
}
/// <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 deliveryId { get; set; }
/// <summary>
/// 快递公司名称
/// </summary>
[Display(Name = "快递公司名称")]
[Required(ErrorMessage = "请输入{0}")]
[StringLength(maximumLength:50,ErrorMessage = "{0}不能超过{1}字")]
public System.String deliveryName { get; set; }
}
}

View File

@@ -0,0 +1,278 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CoreCms.Net.Caching.AccressToken;
using CoreCms.Net.Configuration;
using CoreCms.Net.IServices;
using CoreCms.Net.Loging;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.WeChat.Service.HttpClients;
using InitQ.Abstractions;
using InitQ.Attributes;
using Newtonsoft.Json;
using SKIT.FlurlHttpClient.Wechat.Api;
using SKIT.FlurlHttpClient.Wechat.Api.Models;
namespace CoreCms.Net.RedisMQ
{
/// <summary>
/// 微信支付成功后推送到接口进行发货处理
/// </summary>
public class WeChatPayShippingSubscribe : IRedisSubscribe
{
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
private readonly ICoreCmsServicesServices _servicesServices;
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
private readonly ICoreCmsBillDeliveryServices _billDeliveryServices;
private readonly ICoreCmsOrderItemServices _orderItemServices;
private readonly ICoreCmsUserServices _userServices;
private readonly ICoreCmsUserWeChatInfoServices _weChatInfoServices;
private readonly ICoreCmsOrderServices _orderServices;
private readonly ICoreCmsSettingServices _settingServices;
public WeChatPayShippingSubscribe(ICoreCmsBillPaymentsServices billPaymentsServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsServicesServices servicesServices, ICoreCmsBillDeliveryServices billDeliveryServices, ICoreCmsOrderItemServices orderItemServices, ICoreCmsUserServices userServices, ICoreCmsUserWeChatInfoServices weChatInfoServices, ICoreCmsOrderServices orderServices, ICoreCmsSettingServices settingServices)
{
_billPaymentsServices = billPaymentsServices;
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
_servicesServices = servicesServices;
_billDeliveryServices = billDeliveryServices;
_orderItemServices = orderItemServices;
_userServices = userServices;
_weChatInfoServices = weChatInfoServices;
_orderServices = orderServices;
_settingServices = settingServices;
}
/// <summary>
/// 微信支付成功后推送到接口进行发货处理
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
[Subscribe(RedisMessageQueueKey.WeChatPayShipping)]
private async Task WeChatPayNotice(string msg)
{
try
{
var paymentOrder = await _billPaymentsServices.QueryByClauseAsync(p => p.paymentId == msg);
if (paymentOrder == null)
{
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":支付单不存在");
return;
}
else
{
if (paymentOrder.paymentCode != GlobalEnumVars.PaymentsTypes.wechatpay.ToString())
{
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":非微信支付方式不予处理");
return;
}
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var isTradeManagedRequest = new WxaSecOrderIsTradeManagedRequest()
{
AccessToken = accessToken
};
//商品名称
var orderTitle = string.Empty;
//检索是否开启了微信发货信息功能,才会进行后面的发货操作
var responseIsTradeManagedResponse = await client.ExecuteWxaSecOrderIsTradeManagedAsync(isTradeManagedRequest);
if (responseIsTradeManagedResponse.IsSuccessful() && responseIsTradeManagedResponse.IsTradeManaged)
{
//判断不同支付单类型下如何获取商品标题,目前只是简单标题,非商品订单如果需要详细到具体明细,建议扩展获取其他关联信息。
switch (paymentOrder.type)
{
case (int)GlobalEnumVars.BillPaymentsType.Recharge:
orderTitle = "用户充值" + paymentOrder.money + "元";
break;
case (int)GlobalEnumVars.BillPaymentsType.FormOrder:
orderTitle = "表单订单";
break;
case (int)GlobalEnumVars.BillPaymentsType.FormPay:
orderTitle = "表单付款码支付";
break;
case (int)GlobalEnumVars.BillPaymentsType.ServiceOrder:
{
var id = Convert.ToInt32(paymentOrder.sourceId);
var serviceModel = await _servicesServices.QueryByClauseAsync(p => p.id == id);
if (serviceModel == null)
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":服务项目获取失败");
return;
}
orderTitle = serviceModel.title;
break;
}
case (int)GlobalEnumVars.BillPaymentsType.Common:
case (int)GlobalEnumVars.BillPaymentsType.PinTuan:
case (int)GlobalEnumVars.BillPaymentsType.Group:
case (int)GlobalEnumVars.BillPaymentsType.Seckill:
case (int)GlobalEnumVars.BillPaymentsType.Solitaire:
{
var orderItems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
if (!orderItems.Any())
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":订单详情获取失败");
return;
}
if (orderItems.Count == 1)
{
orderTitle = orderItems.FirstOrDefault()?.name;
}
else
{
orderItems.ForEach(p => { orderTitle += p.name + ";"; });
}
break;
}
case (int)GlobalEnumVars.BillPaymentsType.Bargain:
orderTitle = "砍价活动";
break;
case (int)GlobalEnumVars.BillPaymentsType.Giveaway:
orderTitle = "购物赠品";
break;
default:
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":订单类型获取失败");
return;
}
//构建请求
var request = new WxaSecOrderUploadShippingInfoRequest
{
AccessToken = accessToken,
OrderKey = new WxaSecOrderUploadCombinedShippingInfoRequest.Types.OrderKey()
{
OrderNumberType = 2,
TransactionId = paymentOrder.tradeNo,
},
IsFinishAll = true
};
//组装参数
//获取openid
var user = await _userServices.QueryByClauseAsync(p => p.id == paymentOrder.userId);
if (user == null)
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":用户信息获取失败");
return;
}
var weChatUserInfo = await _weChatInfoServices.QueryByClauseAsync(p => p.userId == user.id);
if (weChatUserInfo == null)
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + "用户信息openId获取失败");
return;
}
request.Payer = new WxaSecOrderUploadCombinedShippingInfoRequest.Types.Payer() { OpenId = weChatUserInfo.openid };
//设置发货信息
//如果是商品模式是,则去走快递或者自提及同城配送。
//两种情况1支付单支付成功后自动调用此模式处理充值服务商品用户自提的订单2、如果是后台手动发货处理发货的订单业务。
var shippingList = new List<WxaSecOrderUploadShippingInfoRequest.Types.Shipping>();
if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Common
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.PinTuan
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Group
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Seckill
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire)
{
//获取订单
var order = await _orderServices.QueryByClauseAsync(p => p.orderId == paymentOrder.sourceId);
if (order == null)
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":订单获取失败");
return;
}
request.LogisticsType = order.receiptType switch
{
//设置物流的发货模式
(int)GlobalEnumVars.OrderReceiptType.SelfDelivery => (int)GlobalEnumVars.WeChatShippingLogisticsType.,
(int)GlobalEnumVars.OrderReceiptType.IntraCityService => (int)GlobalEnumVars.WeChatShippingLogisticsType.,
(int)GlobalEnumVars.OrderReceiptType.Logistics => (int)GlobalEnumVars.WeChatShippingLogisticsType.,
_ => request.LogisticsType
};
//判断订单是否发货
if (order.shipStatus is (int)GlobalEnumVars.OrderShipStatus.PartialYes or (int)GlobalEnumVars.OrderShipStatus.Yes)
{
//获取订单的发货信息
var orderBillDeliveries = await _billDeliveryServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
if (orderBillDeliveries == null || !orderBillDeliveries.Any())
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":未获取到发货信息,自动发货停止操作");
return;
}
shippingList.AddRange(orderBillDeliveries.Select(item => new WxaSecOrderUploadShippingInfoRequest.Types.Shipping { ItemDescription = orderTitle, ExpressCompany = item.thirdPartylogiCode, TrackingNumber = item.logiNo }));
request.DeliveryMode = orderBillDeliveries.Count > 1
? (int)GlobalEnumVars.WeChatShippingDeliveryMode.SPLIT_DELIVERY
: (int)GlobalEnumVars.WeChatShippingDeliveryMode.UNIFIED_DELIVERY;
}
else
{
//判断是否门店订单自动发货
var allConfigs = await _settingServices.GetConfigDictionaries();
var storeOrderAutomaticDelivery = CommonHelper.GetConfigDictionary(allConfigs, SystemSettingConstVars.StoreOrderAutomaticDelivery).ObjectToInt(1);
if (storeOrderAutomaticDelivery == 1 || order.receiptType == (int)GlobalEnumVars.OrderReceiptType.SelfDelivery)
{
shippingList.Add(new WxaSecOrderUploadShippingInfoRequest.Types.Shipping() { ItemDescription = orderTitle, ExpressCompany = "", TrackingNumber = "" });
}
else
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":未获取到发货信息,自动发货停止操作");
return;
}
}
}
else
{
//非商品模式,直接走虚拟发货。
request.LogisticsType = (int)GlobalEnumVars.WeChatShippingLogisticsType.;
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.UNIFIED_DELIVERY;
shippingList.Add(new WxaSecOrderUploadShippingInfoRequest.Types.Shipping() { ItemDescription = orderTitle, ExpressCompany = "", TrackingNumber = "" });
}
request.ShippingList = shippingList;
var response = await client.ExecuteWxaSecOrderUploadShippingInfoAsync(request);
if (response.IsSuccessful())
{
NLogUtil.WriteAll(NLog.LogLevel.Info, LogType.RedisMessageQueue, "微信发货信息处理", msg + ":发货提交成功");
}
else
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理-推送接口", JsonConvert.SerializeObject(response));
}
}
else
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理-获取是否需要推送", JsonConvert.SerializeObject(responseIsTradeManagedResponse));
}
}
}
catch (Exception ex)
{
NLogUtil.WriteAll(NLog.LogLevel.Error, LogType.RedisMessageQueue, "微信发货信息处理", msg, ex);
throw;
}
await Task.CompletedTask;
}
}
}

View File

@@ -46,7 +46,7 @@ namespace CoreCms.Net.Repository
{ {
var dt = DateTime.Now.AddDays(-8); var dt = DateTime.Now.AddDays(-8);
var types = new int[] { (int)GlobalEnumVars.BillPaymentsType.Common, (int)GlobalEnumVars.BillPaymentsType.PinTuan, (int)GlobalEnumVars.BillPaymentsType.Group, (int)GlobalEnumVars.BillPaymentsType.Seckill, (int)GlobalEnumVars.BillPaymentsType.Bargain, (int)GlobalEnumVars.BillPaymentsType.Giveaway, (int)GlobalEnumVars.BillPaymentsType.Solitaire, (int)GlobalEnumVars.BillPaymentsType.TransactionComponent }; var types = new int[] { (int)GlobalEnumVars.BillPaymentsType.Common, (int)GlobalEnumVars.BillPaymentsType.PinTuan, (int)GlobalEnumVars.BillPaymentsType.Group, (int)GlobalEnumVars.BillPaymentsType.Seckill, (int)GlobalEnumVars.BillPaymentsType.Bargain, (int)GlobalEnumVars.BillPaymentsType.Giveaway, (int)GlobalEnumVars.BillPaymentsType.Solitaire };
var list = await DbClient.Queryable<CoreCmsBillPayments>() var list = await DbClient.Queryable<CoreCmsBillPayments>()
.Where(p => p.createTime >= dt && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed && types.Contains(p.type)) .Where(p => p.createTime >= dt && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed && types.Contains(p.type))

View File

@@ -0,0 +1,196 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2023/9/15 23:09:53
* 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 WeChatShippingDeliveryRepository : BaseRepository<WeChatShippingDelivery>, IWeChatShippingDeliveryRepository
{
private readonly IUnitOfWork _unitOfWork;
public WeChatShippingDeliveryRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
{
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public async Task<AdminUiCallBack> InsertAsync(WeChatShippingDelivery entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(WeChatShippingDelivery entity)
{
var jm = new AdminUiCallBack();
var oldModel = await DbClient.Queryable<WeChatShippingDelivery>().In(entity.id).SingleAsync();
if (oldModel == null)
{
jm.msg = "不存在此信息";
return jm;
}
//事物处理过程开始
oldModel.id = entity.id;
oldModel.deliveryId = entity.deliveryId;
oldModel.deliveryName = entity.deliveryName;
//事物处理过程结束
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写异步更新方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(List<WeChatShippingDelivery> entity)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<WeChatShippingDelivery>(id).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
{
var jm = new AdminUiCallBack();
var bl = await DbClient.Deleteable<WeChatShippingDelivery>().In(ids).ExecuteCommandHasChangeAsync();
jm.code = bl ? 0 : 1;
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
return jm;
}
#endregion
#region ==========================================================
/// <summary>
/// 获取缓存的所有数据
/// </summary>
/// <returns></returns>
public async Task<List<WeChatShippingDelivery>> GetCaChe()
{
var list = await DbClient.Queryable<WeChatShippingDelivery>().With(SqlWith.NoLock).WithCache().ToListAsync();
return list;
}
#endregion
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
public async Task<IPageList<WeChatShippingDelivery>> QueryPageAsync(Expression<Func<WeChatShippingDelivery, bool>> predicate,
Expression<Func<WeChatShippingDelivery, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
RefAsync<int> totalCount = 0;
List<WeChatShippingDelivery> page;
if (blUseNoLock)
{
page = await DbClient.Queryable<WeChatShippingDelivery>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatShippingDelivery
{
id = p.id,
deliveryId = p.deliveryId,
deliveryName = p.deliveryName,
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
}
else
{
page = await DbClient.Queryable<WeChatShippingDelivery>()
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
.WhereIF(predicate != null, predicate).Select(p => new WeChatShippingDelivery
{
id = p.id,
deliveryId = p.deliveryId,
deliveryName = p.deliveryName,
}).ToPageListAsync(pageIndex, pageSize, totalCount);
}
var list = new PageList<WeChatShippingDelivery>(page, pageIndex, pageSize, totalCount);
return list;
}
#endregion
}
}

View File

@@ -13,6 +13,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using CoreCms.Net.Caching.AutoMate.RedisCache;
using CoreCms.Net.Configuration; using CoreCms.Net.Configuration;
using CoreCms.Net.IRepository; using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork; using CoreCms.Net.IRepository.UnitOfWork;
@@ -61,6 +62,7 @@ namespace CoreCms.Net.Services
private readonly ICoreCmsTopUpTypeServices _topUpTypeServices; private readonly ICoreCmsTopUpTypeServices _topUpTypeServices;
private readonly ICoreCmsUserPointLogServices _userPointLogServices; private readonly ICoreCmsUserPointLogServices _userPointLogServices;
private readonly WeChatOptions _weChatOptions; private readonly WeChatOptions _weChatOptions;
private readonly IRedisOperationRepository _redisOperationRepository;
@@ -77,7 +79,7 @@ namespace CoreCms.Net.Services
, IServiceProvider serviceProvider, ICoreCmsServicesServices servicesServices , IServiceProvider serviceProvider, ICoreCmsServicesServices servicesServices
, ICoreCmsUserServicesOrderServices userServicesOrderServices , ICoreCmsUserServicesOrderServices userServicesOrderServices
, ICoreCmsUserWeChatInfoServices userWeChatInfoServices , ICoreCmsUserWeChatInfoServices userWeChatInfoServices
, IOptions<WeChatOptions> weChatOptions, ICoreCmsTopUpTypeServices topUpTypeServices, ICoreCmsUserPointLogServices userPointLogServices) , IOptions<WeChatOptions> weChatOptions, ICoreCmsTopUpTypeServices topUpTypeServices, ICoreCmsUserPointLogServices userPointLogServices, IRedisOperationRepository redisOperationRepository)
{ {
this._dal = dal; this._dal = dal;
base.BaseDal = dal; base.BaseDal = dal;
@@ -97,6 +99,7 @@ namespace CoreCms.Net.Services
_userWeChatInfoServices = userWeChatInfoServices; _userWeChatInfoServices = userWeChatInfoServices;
_topUpTypeServices = topUpTypeServices; _topUpTypeServices = topUpTypeServices;
_userPointLogServices = userPointLogServices; _userPointLogServices = userPointLogServices;
_redisOperationRepository = redisOperationRepository;
_weChatOptions = weChatOptions.Value; _weChatOptions = weChatOptions.Value;
} }
@@ -126,7 +129,6 @@ namespace CoreCms.Net.Services
|| type == (int)GlobalEnumVars.BillPaymentsType.Bargain || type == (int)GlobalEnumVars.BillPaymentsType.Bargain
|| type == (int)GlobalEnumVars.BillPaymentsType.Giveaway || type == (int)GlobalEnumVars.BillPaymentsType.Giveaway
|| type == (int)GlobalEnumVars.BillPaymentsType.Solitaire || type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|| type == (int)GlobalEnumVars.BillPaymentsType.TransactionComponent
) )
{ {
//如果是订单生成支付单的话取第一条订单的店铺id后面的所有订单都要保证是此店铺的id //如果是订单生成支付单的话取第一条订单的店铺id后面的所有订单都要保证是此店铺的id
@@ -286,7 +288,6 @@ namespace CoreCms.Net.Services
|| type == (int)GlobalEnumVars.BillPaymentsType.Bargain || type == (int)GlobalEnumVars.BillPaymentsType.Bargain
|| type == (int)GlobalEnumVars.BillPaymentsType.Giveaway || type == (int)GlobalEnumVars.BillPaymentsType.Giveaway
|| type == (int)GlobalEnumVars.BillPaymentsType.Solitaire || type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|| type == (int)GlobalEnumVars.BillPaymentsType.TransactionComponent
) )
{ {
//如果是订单生成支付单的话取第一条订单的店铺id后面的所有订单都要保证是此店铺的id //如果是订单生成支付单的话取第一条订单的店铺id后面的所有订单都要保证是此店铺的id
@@ -694,7 +695,6 @@ namespace CoreCms.Net.Services
|| billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.Bargain || billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.Bargain
|| billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway || billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway
|| billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire || billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|| billPaymentInfo.type == (int)GlobalEnumVars.BillPaymentsType.TransactionComponent
) )
{ {
//如果是订单类型,做支付后处理 //如果是订单类型,做支付后处理
@@ -733,6 +733,10 @@ namespace CoreCms.Net.Services
{ {
//::todo 其他业务逻辑 //::todo 其他业务逻辑
} }
//微信发货信息管理API发货
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, billPaymentInfo.paymentId);
} }
jm.status = true; jm.status = true;
jm.data = paymentId; jm.data = paymentId;
@@ -792,7 +796,7 @@ namespace CoreCms.Net.Services
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Bargain || entity.type == (int)GlobalEnumVars.BillPaymentsType.Bargain
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway || entity.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire || entity.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|| entity.type == (int)GlobalEnumVars.BillPaymentsType.TransactionComponent) )
{ {
var orderItem = await _orderItemServices.QueryByClauseAsync(p => p.orderId == entity.sourceId); var orderItem = await _orderItemServices.QueryByClauseAsync(p => p.orderId == entity.sourceId);
if (orderItem != null) if (orderItem != null)
@@ -852,7 +856,6 @@ namespace CoreCms.Net.Services
|| type == (int)GlobalEnumVars.BillPaymentsType.Bargain || type == (int)GlobalEnumVars.BillPaymentsType.Bargain
|| type == (int)GlobalEnumVars.BillPaymentsType.Giveaway || type == (int)GlobalEnumVars.BillPaymentsType.Giveaway
|| type == (int)GlobalEnumVars.BillPaymentsType.Solitaire || type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
|| type == (int)GlobalEnumVars.BillPaymentsType.TransactionComponent
) )
{ {
var orderInfo = await orderServices.QueryByIdAsync(orderId); var orderInfo = await orderServices.QueryByIdAsync(orderId);

View File

@@ -0,0 +1,175 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2023/9/15 23:09:53
* Description: 暂无
***********************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Caching.AccressToken;
using CoreCms.Net.Configuration;
using CoreCms.Net.DTO.WeChatShipping;
using CoreCms.Net.IRepository;
using CoreCms.Net.IRepository.UnitOfWork;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.ViewModels.Api;
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.WeChat.Service.HttpClients;
using Flurl.Http;
using SKIT.FlurlHttpClient.Wechat.Api.Models;
using SqlSugar;
namespace CoreCms.Net.Services
{
/// <summary>
/// 微信发货快递公司信息 接口实现
/// </summary>
public class WeChatShippingDeliveryServices : BaseServices<WeChatShippingDelivery>, IWeChatShippingDeliveryServices
{
private readonly IWeChatShippingDeliveryRepository _dal;
private readonly IUnitOfWork _unitOfWork;
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
public WeChatShippingDeliveryServices(IUnitOfWork unitOfWork, IWeChatShippingDeliveryRepository dal, IWeChatApiHttpClientFactory weChatApiHttpClientFactory)
{
this._dal = dal;
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
base.BaseDal = dal;
_unitOfWork = unitOfWork;
}
#region ==========================================================
/// <summary>
/// 重写异步插入方法
/// </summary>
/// <param name="entity">实体数据</param>
/// <returns></returns>
public async Task<AdminUiCallBack> InsertAsync(WeChatShippingDelivery entity)
{
return await _dal.InsertAsync(entity);
}
/// <summary>
/// 重写异步更新方法方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(WeChatShippingDelivery entity)
{
return await _dal.UpdateAsync(entity);
}
/// <summary>
/// 重写异步更新方法方法
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> UpdateAsync(List<WeChatShippingDelivery> entity)
{
return await _dal.UpdateAsync(entity);
}
/// <summary>
/// 重写删除指定ID的数据
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdAsync(object id)
{
return await _dal.DeleteByIdAsync(id);
}
/// <summary>
/// 重写删除指定ID集合的数据(批量删除)
/// </summary>
/// <param name="ids"></param>
/// <returns></returns>
public async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
{
return await _dal.DeleteByIdsAsync(ids);
}
#endregion
#region ==========================================================
/// <summary>
/// 获取缓存的所有数据
/// </summary>
/// <returns></returns>
public async Task<List<WeChatShippingDelivery>> GetCaChe()
{
return await _dal.GetCaChe();
}
#endregion
#region
/// <summary>
/// 重写根据条件查询分页数据
/// </summary>
/// <param name="predicate">判断集合</param>
/// <param name="orderByType">排序方式</param>
/// <param name="pageIndex">当前页面索引</param>
/// <param name="pageSize">分布大小</param>
/// <param name="orderByExpression"></param>
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
/// <returns></returns>
public async Task<IPageList<WeChatShippingDelivery>> QueryPageAsync(Expression<Func<WeChatShippingDelivery, bool>> predicate,
Expression<Func<WeChatShippingDelivery, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
int pageSize = 20, bool blUseNoLock = false)
{
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
}
#endregion
/// <summary>
/// 通过接口更新所有快递公司信息
/// </summary>
public async Task<AdminUiCallBack> DoUpdateCompany()
{
var jm = new AdminUiCallBack();
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var url = $"https://api.weixin.qq.com/cgi-bin/express/delivery/open_msg/get_delivery_list?access_token={accessToken}";
var postData = new { accessToken };
var result = await url.PostJsonAsync(postData).ReceiveJson<GetDeliveryListResult>();
var bl = result != null;
if (result is { errcode: 0 })
{
//先清空历史表
await _dal.DeleteAsync(p => p.id > 0, true);
//组装插入数据
var insertData = result.delivery_list.Select(item => new WeChatShippingDelivery() { deliveryId = item.delivery_id, deliveryName = item.delivery_name }).ToList();
//更新数据库
bl = await _dal.InsertAsync(insertData, true) > 0;
}
jm.data = result;
jm.code = bl ? 0 : 1;
jm.msg = bl ? "数据刷新成功" : "数据刷新失败";
return jm;
}
}
}

View File

@@ -64,6 +64,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices; private readonly ICoreCmsUserWeChatInfoServices _userWeChatInfoServices;
private readonly IRedisOperationRepository _redisOperationRepository; private readonly IRedisOperationRepository _redisOperationRepository;
private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory; private readonly CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
private readonly IWeChatShippingDeliveryServices _weChatShippingDeliveryServices;
private readonly ICoreCmsOrderItemServices _orderItemServices; private readonly ICoreCmsOrderItemServices _orderItemServices;
@@ -82,7 +83,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
, ICoreCmsLogisticsServices logisticsServices , ICoreCmsLogisticsServices logisticsServices
, ICoreCmsBillPaymentsServices billPaymentsServices , ICoreCmsBillPaymentsServices billPaymentsServices
, ICoreCmsPaymentsServices paymentsServices , ICoreCmsPaymentsServices paymentsServices
, ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices) , ICoreCmsSettingServices settingServices, ICoreCmsUserWeChatInfoServices userWeChatInfoServices, IRedisOperationRepository redisOperationRepository, ICoreCmsBillDeliveryServices billDeliveryServices, IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsOrderItemServices orderItemServices, IWeChatShippingDeliveryServices weChatShippingDeliveryServices)
{ {
_webHostEnvironment = webHostEnvironment; _webHostEnvironment = webHostEnvironment;
_coreCmsOrderServices = coreCmsOrderServices; _coreCmsOrderServices = coreCmsOrderServices;
@@ -99,6 +100,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
_billDeliveryServices = billDeliveryServices; _billDeliveryServices = billDeliveryServices;
_weChatApiHttpClientFactory = weChatApiHttpClientFactory; _weChatApiHttpClientFactory = weChatApiHttpClientFactory;
_orderItemServices = orderItemServices; _orderItemServices = orderItemServices;
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
} }
#region ============================================================ #region ============================================================
@@ -493,7 +495,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
var storeList = await _storeServices.QueryAsync(); var storeList = await _storeServices.QueryAsync();
var logistics = await _logisticsServices.QueryListByClauseAsync(p => p.isDelete == false); var logistics = await _logisticsServices.QueryListByClauseAsync(p => p.isDelete == false);
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
var result = await _coreCmsOrderServices.GetOrderShipInfo(entity.id); var result = await _coreCmsOrderServices.GetOrderShipInfo(entity.id);
if (!result.status) if (!result.status)
{ {
@@ -517,6 +519,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
jm.data = new jm.data = new
{ {
orderModel = result.data, orderModel = result.data,
deliveryCompany,
storeList, storeList,
logistics, logistics,
}; };
@@ -543,10 +546,32 @@ namespace CoreCms.Net.Web.Admin.Controllers
{ {
var ids = entity.orderId.Split(","); var ids = entity.orderId.Split(",");
result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId); result = await _coreCmsOrderServices.BatchShip(ids, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
if (result.status)
{
var orderPaymentIds = await _billPaymentsServices.QueryListByClauseAsync(p => ids.Contains(p.sourceId) && p.paymentCode == GlobalEnumVars.PaymentsTypes.wechatpay.ToString() && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed);
if (orderPaymentIds.Any())
{
//依次推入队列.
foreach (var item in orderPaymentIds)
{
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, item.paymentId);
}
}
}
} }
else else
{ {
result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId); result = await _coreCmsOrderServices.Ship(entity.orderId, entity.logiCode, entity.logiNo, entity.items, entity.shipName, entity.shipMobile, entity.shipAddress, entity.memo, entity.storeId, entity.shipAreaId, entity.deliveryCompanyId);
//微信发货信息管理API发货
if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == entity.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo)
{
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
}
} }
jm.code = result.status ? 0 : 1; jm.code = result.status ? 0 : 1;
@@ -603,6 +628,12 @@ namespace CoreCms.Net.Web.Admin.Controllers
result = await _coreCmsOrderServices.Ship(order.orderId, "benditongcheng", "无", items, order.shipName, order.shipMobile, order.shipAddress, order.memo, order.storeId, order.shipAreaId, "OTHERS"); result = await _coreCmsOrderServices.Ship(order.orderId, "benditongcheng", "无", items, order.shipName, order.shipMobile, order.shipAddress, order.memo, order.storeId, order.shipAreaId, "OTHERS");
} }
//微信发货信息管理API发货
if (result.status && await _billPaymentsServices.QueryByClauseAsync(p => p.sourceId == order.orderId && p.status == (int)GlobalEnumVars.BillPaymentsStatus.Payed) is { } paymentInfo)
{
await _redisOperationRepository.ListLeftPushAsync(RedisMessageQueueKey.WeChatPayShipping, paymentInfo.paymentId);
}
jm.code = result.status ? 0 : 1; jm.code = result.status ? 0 : 1;
jm.msg = result.msg; jm.msg = result.msg;
jm.data = result.data; jm.data = result.data;
@@ -1716,7 +1747,7 @@ namespace CoreCms.Net.Web.Admin.Controllers
return jm; return jm;
} }
#endregion #endregion
#region ============================================================ #region ============================================================
// POST: Api/CoreCmsOrder/GetDetails/10 // POST: Api/CoreCmsOrder/GetDetails/10
/// <summary> /// <summary>

View File

@@ -0,0 +1,157 @@
/***********************************************************************
* Project: CoreCms
* ProjectName: 核心内容管理系统
* Web: https://www.corecms.net
* Author: 大灰灰
* Email: jianweie@163.com
* CreateTime: 2023/9/15 23:09:53
* Description: 暂无
***********************************************************************/
using System;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Configuration;
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.Filter;
using CoreCms.Net.Loging;
using CoreCms.Net.IServices;
using CoreCms.Net.Utility.Helper;
using CoreCms.Net.Utility.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using NPOI.HSSF.UserModel;
using SqlSugar;
using CoreCms.Net.Services;
namespace CoreCms.Net.Web.Admin.Controllers
{
/// <summary>
/// 微信发货快递公司信息
///</summary>
[Description("微信发货快递公司信息")]
[Route("api/[controller]/[action]")]
[ApiController]
[RequiredErrorForAdmin]
[Authorize(Permissions.Name)]
public class WeChatShippingDeliveryController : ControllerBase
{
private readonly IWebHostEnvironment _webHostEnvironment;
private readonly IWeChatShippingDeliveryServices _weChatShippingDeliveryServices;
/// <summary>
/// 构造函数
///</summary>
public WeChatShippingDeliveryController(IWebHostEnvironment webHostEnvironment
,IWeChatShippingDeliveryServices weChatShippingDeliveryServices
)
{
_webHostEnvironment = webHostEnvironment;
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
}
#region ============================================================
// POST: Api/WeChatShippingDelivery/GetPageList
/// <summary>
/// 获取列表
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("获取列表")]
public async Task<AdminUiCallBack> GetPageList()
{
var jm = new AdminUiCallBack();
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
var where = PredicateBuilder.True<WeChatShippingDelivery>();
//获取排序字段
var orderField = Request.Form["orderField"].FirstOrDefault();
Expression<Func<WeChatShippingDelivery, object>> orderEx = orderField switch
{
"id" => p => p.id,"deliveryId" => p => p.deliveryId,"deliveryName" => p => p.deliveryName,
_ => p => p.id
};
//设置排序方式
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
var orderBy = orderDirection switch
{
"asc" => OrderByType.Asc,
"desc" => OrderByType.Desc,
_ => OrderByType.Desc
};
//查询筛选
//序列 int
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
if (id > 0)
{
where = where.And(p => p.id == id);
}
//快递公司编码 nvarchar
var deliveryId = Request.Form["deliveryId"].FirstOrDefault();
if (!string.IsNullOrEmpty(deliveryId))
{
where = where.And(p => p.deliveryId.Contains(deliveryId));
}
//快递公司名称 nvarchar
var deliveryName = Request.Form["deliveryName"].FirstOrDefault();
if (!string.IsNullOrEmpty(deliveryName))
{
where = where.And(p => p.deliveryName.Contains(deliveryName));
}
//获取数据
var list = await _weChatShippingDeliveryServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
//返回数据
jm.data = list;
jm.code = 0;
jm.count = list.TotalCount;
jm.msg = "数据调用成功!";
return jm;
}
#endregion
#region ============================================================
// POST: Api/WeChatShippingDelivery/GetIndex
/// <summary>
/// 首页数据
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("首页数据")]
public AdminUiCallBack GetIndex()
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsLogistics/DoDelete/10
/// <summary>
/// 拉取数据更新
/// </summary>
[HttpPost]
[Description("单选删除")]
public async Task<AdminUiCallBack> DoUpdateCompany()
{
var jm = await _weChatShippingDeliveryServices.DoUpdateCompany();
return jm;
}
#endregion
}
}

View File

@@ -0,0 +1,661 @@
using System;
using System.Collections.Generic;
using CoreCms.Net.Configuration;
using CoreCms.Net.Filter;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.ComponentModel;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using CoreCms.Net.Model.Entities;
using CoreCms.Net.Model.Entities.Expression;
using CoreCms.Net.Model.ViewModels.UI;
using CoreCms.Net.Utility.Extensions;
using CoreCms.Net.Utility.Helper;
using SqlSugar;
using Azure.Core;
using CoreCms.Net.Caching.AccressToken;
using CoreCms.Net.DTO.WeChatShipping;
using CoreCms.Net.IServices;
using CoreCms.Net.Model.ViewModels.Api;
using Flurl.Http;
using CoreCms.Net.WeChat.Service.HttpClients;
using CoreCms.Net.WeChat.Service.Enums;
using SKIT.FlurlHttpClient.Wechat.Api.Models;
using SKIT.FlurlHttpClient.Wechat.Api;
using CoreCms.Net.Model.FromBody;
using CoreCms.Net.Services;
using static SKIT.FlurlHttpClient.Wechat.Api.Models.CgibinExpressBusinessDeliveryGetAllResponse.Types;
using CoreCms.Net.Loging;
namespace CoreCms.Net.Web.Admin.Controllers.WeChatShipping
{
/// <summary>
/// 微信发货信息订单管理
///</summary>
[Description("微信发货信息订单管理")]
[Route("api/[controller]/[action]")]
[ApiController]
[RequiredErrorForAdmin]
[Authorize(Permissions.Name)]
public class WeChatShippingOrderController : ControllerBase
{
private readonly IWeChatApiHttpClientFactory _weChatApiHttpClientFactory;
private readonly ICoreCmsBillPaymentsServices _billPaymentsServices;
private readonly ICoreCmsOrderServices _orderServices;
private readonly ICoreCmsOrderItemServices _orderItemServices;
private readonly ICoreCmsServicesServices _servicesServices;
private readonly IWeChatShippingDeliveryServices _weChatShippingDeliveryServices;
private readonly ICoreCmsBillDeliveryServices _billDeliveryServices;
/// <summary>
/// 构造函数
/// </summary>
public WeChatShippingOrderController(IWeChatApiHttpClientFactory weChatApiHttpClientFactory, ICoreCmsBillPaymentsServices billPaymentsServices, ICoreCmsOrderServices orderServices, ICoreCmsOrderItemServices orderItemServices, ICoreCmsServicesServices servicesServices, IWeChatShippingDeliveryServices weChatShippingDeliveryServices, ICoreCmsBillDeliveryServices billDeliveryServices)
{
_weChatApiHttpClientFactory = weChatApiHttpClientFactory;
_billPaymentsServices = billPaymentsServices;
_orderServices = orderServices;
_orderItemServices = orderItemServices;
_servicesServices = servicesServices;
_weChatShippingDeliveryServices = weChatShippingDeliveryServices;
_billDeliveryServices = billDeliveryServices;
}
#region ============================================================
// POST: Api/CoreCmsBillReship/GetPageList
/// <summary>
/// 获取列表
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("获取列表")]
public async Task<AdminUiCallBack> GetPageList()
{
var jm = new AdminUiCallBack();
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(20);
var last_index = Request.Form["last_index"].FirstOrDefault();
//获取排序字段
//设置排序方式
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
var orderBy = orderDirection switch
{
"asc" => OrderByType.Asc,
"desc" => OrderByType.Desc,
_ => OrderByType.Desc
};
//查询筛选
//构建请求
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var request = new WxaSecOrderGetOrderListRequest()
{
AccessToken = accessToken
};
//构建查询
var status = Request.Form["status"].FirstOrDefault().ObjectToInt(0);
if (status > 0)
{
request.OrderState = status;
}
if (pageCurrent > 1)
{
request.Limit = pageCurrent;
}
if (!string.IsNullOrEmpty(last_index))
{
request.Offset = last_index;
}
if (pageSize > 0)
{
request.Limit = pageSize;
}
var response = await client.ExecuteWxaSecOrderGetOrderListAsync(request, HttpContext.RequestAborted);
if (response.ErrorCode == (int)WeChatReturnCode.ReturnCode.)
{
//返回数据
jm.data = response.OrderList;
jm.otherData = response;
jm.code = 0;
jm.count = 10000;
jm.msg = "数据调用成功!";
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
//获取数据
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsBillReship/GetIndex
/// <summary>
/// 首页数据
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("首页数据")]
public AdminUiCallBack GetIndex()
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
jm.data = new
{
status,
logisticsType
};
return jm;
}
#endregion
#region ============================================================
/// <summary>
/// 创建发货单
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("创建数据")]
public async Task<AdminUiCallBack> GetCreate([FromBody] FMStringId entity)
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var paymentOrder = await _billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.id);
if (paymentOrder == null)
{
jm.msg = "支付单获取失败";
return jm;
}
var billDeliveryList = new List<CoreCmsBillDelivery>();
var orderTitle = string.Empty;
var logisticsTypeValue = 0;
if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
{
orderTitle = "用户充值" + paymentOrder.money + "元";
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.;
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormOrder)
{
orderTitle = "表单订单";
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.;
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormPay)
{
orderTitle = "表单付款码支付";
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.;
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.ServiceOrder)
{
var id = Convert.ToInt32(paymentOrder.sourceId);
var serviceModel = await _servicesServices.QueryByClauseAsync(p => p.id == id);
if (serviceModel == null)
{
jm.msg = "服务项目获取失败";
return jm;
}
orderTitle = serviceModel.title;
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.;
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Common
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.PinTuan
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Group
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Seckill
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
)
{
billDeliveryList = await _billDeliveryServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
//获取订单
var order = await _orderServices.QueryByClauseAsync(p => p.orderId == paymentOrder.sourceId);
if (order == null)
{
jm.msg = "关联订单获取失败";
return jm;
}
logisticsTypeValue = order.receiptType switch
{
//设置物流的发货模式
(int)GlobalEnumVars.OrderReceiptType.SelfDelivery => (int)GlobalEnumVars.WeChatShippingLogisticsType.,
(int)GlobalEnumVars.OrderReceiptType.IntraCityService => (int)GlobalEnumVars.WeChatShippingLogisticsType.,
(int)GlobalEnumVars.OrderReceiptType.Logistics => (int)GlobalEnumVars.WeChatShippingLogisticsType.,
_ => logisticsTypeValue
};
var orderItems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
if (!orderItems.Any())
{
jm.msg = "订单详情获取失败";
return jm;
}
else
{
if (orderItems.Count == 1)
{
orderTitle = orderItems.FirstOrDefault()?.name;
}
else
{
orderItems.ForEach(p => { orderTitle += p.name + ";"; });
}
}
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Bargain)
{
orderTitle = "砍价活动";
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.;
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway)
{
orderTitle = "购物赠品";
logisticsTypeValue = (int)GlobalEnumVars.WeChatShippingLogisticsType.;
}
else
{
jm.msg = "订单类型获取失败";
return jm;
}
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
//构建请求
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var request = new WxaSecOrderGetOrderRequest
{
AccessToken = accessToken,
TransactionId = entity.data.ToString(),
OutTradeNumber = entity.id
};
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
var response = await client.ExecuteWxaSecOrderGetOrderAsync(request, HttpContext.RequestAborted);
if (response.IsSuccessful())
{
jm.code = 0;
jm.data = new
{
response.Order,
status,
logisticsType,
orderTitle,
deliveryCompany,
billDeliveryList,
paymentOrder,
logisticsTypeValue
};
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsAgent/DoCreate
/// <summary>
/// 创建提交
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("创建提交")]
public async Task<AdminUiCallBack> DoCreate([FromBody] OrderShippingCreatePost entity)
{
var jm = new AdminUiCallBack();
var shippingList = new List<WxaSecOrderUploadShippingInfoRequest.Types.Shipping>();
if (entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType.)
{
if (entity.shipping_list == null || !entity.shipping_list.Any())
{
jm.msg = "物流配送请完善快递信息";
return jm;
}
foreach (var item in entity.shipping_list)
{
if (string.IsNullOrEmpty(item.express_company) && string.IsNullOrEmpty(item.tracking_no))
{
jm.msg = "请填写完整的快递信息";
return jm;
}
var shipping = new WxaSecOrderUploadShippingInfoRequest.Types.Shipping
{
ItemDescription = entity.item_desc,
ExpressCompany = item.express_company,
TrackingNumber = item.tracking_no
};
shippingList.Add(shipping);
}
}
else if (entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType.)
{
var shipping = new WxaSecOrderUploadShippingInfoRequest.Types.Shipping
{
ItemDescription = entity.item_desc,
ExpressCompany = entity.cityDistributionName,
TrackingNumber = entity.cityDistributionNumber
};
shippingList.Add(shipping);
}
else if (entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType. || entity.logistics_type == (int)GlobalEnumVars.WeChatShippingLogisticsType.)
{
var shipping = new WxaSecOrderUploadShippingInfoRequest.Types.Shipping
{
ItemDescription = entity.item_desc
};
shippingList.Add(shipping);
}
else
{
jm.msg = "请提交合理的物流模式";
return jm;
}
var request = new WxaSecOrderUploadShippingInfoRequest
{
OrderKey = new WxaSecOrderUploadCombinedShippingInfoRequest.Types.OrderKey()
{
OrderNumberType = 2,
TransactionId = entity.transaction_id,
MerchantId = entity.merchant_id,
OutTradeNumber = entity.merchant_trade_no
},
LogisticsType = entity.logistics_type,
IsFinishAll = entity.is_all_delivered,
ShippingList = shippingList,
Payer = new WxaSecOrderUploadCombinedShippingInfoRequest.Types.Payer() { OpenId = entity.openid }
};
if (request.LogisticsType == (int)GlobalEnumVars.WeChatShippingLogisticsType. && request.IsFinishAll == true)
{
if (shippingList.Count == 1)
{
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.UNIFIED_DELIVERY;
}
else
{
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.SPLIT_DELIVERY;
}
}
else if (request.LogisticsType == (int)GlobalEnumVars.WeChatShippingLogisticsType. && request.IsFinishAll == false)
{
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.SPLIT_DELIVERY;
}
else
{
request.DeliveryMode = (int)GlobalEnumVars.WeChatShippingDeliveryMode.UNIFIED_DELIVERY;
}
//构建请求
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
request.AccessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var response = await client.ExecuteWxaSecOrderUploadShippingInfoAsync(request, HttpContext.RequestAborted);
if (response.IsSuccessful())
{
jm.code = 0;
jm.data = new
{
response
};
jm.msg = "提交成功";
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
return jm;
}
#endregion
#region ============================================================
/// <summary>
/// 重新发货
/// </summary>
/// <returns></returns>
[HttpPost]
[Description("创建数据")]
public async Task<AdminUiCallBack> GetUpdate([FromBody] FMStringId entity)
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var paymentOrder = await _billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.id);
if (paymentOrder == null)
{
jm.msg = "支付单获取失败";
return jm;
}
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
//构建请求
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var request = new WxaSecOrderGetOrderRequest
{
AccessToken = accessToken,
TransactionId = entity.data.ToString(),
OutTradeNumber = entity.id
};
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
var response = await client.ExecuteWxaSecOrderGetOrderAsync(request, HttpContext.RequestAborted);
if (response.IsSuccessful())
{
jm.code = 0;
jm.data = new
{
response.Order,
status,
logisticsType,
deliveryCompany
};
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
return jm;
}
#endregion
#region ============================================================
/// <summary>
/// 重新发货提交
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("创建提交")]
public AdminUiCallBack DoUpdate([FromBody] Object entity)
{
var jm = new AdminUiCallBack();
return jm;
}
#endregion
#region ============================================================
// POST: Api/CoreCmsAgent/GetDetails/10
/// <summary>
/// 预览数据
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
[HttpPost]
[Description("预览数据")]
public async Task<AdminUiCallBack> GetDetails([FromBody] FMStringId entity)
{
//返回数据
var jm = new AdminUiCallBack { code = 0 };
var paymentOrder = await _billPaymentsServices.QueryByClauseAsync(p => p.paymentId == entity.id);
if (paymentOrder == null)
{
jm.msg = "支付单获取失败";
return jm;
}
var orderTitle = string.Empty;
if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Recharge)
{
orderTitle = "用户充值" + paymentOrder.money + "元";
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormOrder)
{
orderTitle = "表单订单";
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.FormPay)
{
orderTitle = "表单付款码支付";
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.ServiceOrder)
{
var id = Convert.ToInt32(paymentOrder.sourceId);
var serviceModel = await _servicesServices.QueryByClauseAsync(p => p.id == id);
if (serviceModel == null)
{
jm.msg = "服务项目获取失败";
return jm;
}
orderTitle = serviceModel.title;
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Common
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.PinTuan
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Group
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Seckill
|| paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Solitaire
)
{
var orderItems = await _orderItemServices.QueryListByClauseAsync(p => p.orderId == paymentOrder.sourceId);
if (!orderItems.Any())
{
jm.msg = "订单详情获取失败";
return jm;
}
else
{
if (orderItems.Count == 1)
{
orderTitle = orderItems.FirstOrDefault()?.name;
}
else
{
orderItems.ForEach(p => { orderTitle += p.name + ";"; });
}
}
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Bargain)
{
orderTitle = "砍价活动";
}
else if (paymentOrder.type == (int)GlobalEnumVars.BillPaymentsType.Giveaway)
{
orderTitle = "购物赠品";
}
else
{
jm.msg = "订单类型获取失败";
return jm;
}
var status = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingOrderStatus>();
var logisticsType = EnumHelper.EnumToList<GlobalEnumVars.WeChatShippingLogisticsType>();
//构建请求
var client = _weChatApiHttpClientFactory.CreateWxOpenClient();
var accessToken = WeChatCacheAccessTokenHelper.GetWxOpenAccessToken();
var request = new WxaSecOrderGetOrderRequest
{
AccessToken = accessToken,
TransactionId = entity.data.ToString(),
OutTradeNumber = entity.id
};
var deliveryCompany = await _weChatShippingDeliveryServices.GetCaChe();
var response = await client.ExecuteWxaSecOrderGetOrderAsync(request, HttpContext.RequestAborted);
if (response.IsSuccessful())
{
jm.code = 0;
jm.data = new
{
response.Order,
status,
logisticsType,
orderTitle,
deliveryCompany
};
}
else
{
jm.code = 1;
jm.msg = response.ErrorMessage;
}
return jm;
}
#endregion
}
}

View File

@@ -0,0 +1,47 @@
<script type="text/html" template lay-done="layui.data.done(d);">
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatShippingDelivery-createForm" id="LAY-app-WeChatShippingDelivery-createForm">
<div class="layui-form-item">
<label for="deliveryId" class="layui-form-label layui-form-required">快递公司编码</label>
<div class="layui-input-block">
<input name="deliveryId" lay-verType="tips" lay-verify="required|verifydeliveryId" class="layui-input" lay-reqText="请输入快递公司编码" placeholder="请输入快递公司编码" />
</div>
</div>
<div class="layui-form-item">
<label for="deliveryName" class="layui-form-label layui-form-required">快递公司名称</label>
<div class="layui-input-block">
<input name="deliveryName" lay-verType="tips" lay-verify="required|verifydeliveryName" class="layui-input" lay-reqText="请输入快递公司名称" placeholder="请输入快递公司名称" />
</div>
</div>
<div class="layui-form-item text-right core-hidden">
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatShippingDelivery-createForm-submit" id="LAY-app-WeChatShippingDelivery-createForm-submit" value="确认添加">
</div>
</div>
</script>
<script>
var debug = layui.setter.debug;
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
function () {
var $ = layui.$
, form = layui.form
, admin = layui.admin
, laydate = layui.laydate
, upload = layui.upload
, cropperImg = layui.cropperImg
, coreHelper = layui.coreHelper;
form.verify({
verifydeliveryId: [/^.{0,50}$/, '快递公司编码最大只允许输入50位字符'],
verifydeliveryName: [/^.{0,50}$/, '快递公司名称最大只允许输入50位字符'],
});
//重载form
form.render(null, 'LAY-app-WeChatShippingDelivery-createForm');
})
};
</script>

View File

@@ -0,0 +1,54 @@
<script type="text/html" template lay-done="layui.data.done(d);">
<table class="layui-table layui-form" lay-filter="LAY-app-WeChatShippingDelivery-detailsForm" id="LAY-app-WeChatShippingDelivery-detailsForm">
<colgroup>
<col width="100">
<col>
</colgroup>
<tbody>
<tr>
<td>
<label for="id">序列</label>
</td>
<td>
{{ d.params.data.id || '' }}
</td>
</tr>
<tr>
<td>
<label for="deliveryId">快递公司编码</label>
</td>
<td>
{{ d.params.data.deliveryId || '' }}
</td>
</tr>
<tr>
<td>
<label for="deliveryName">快递公司名称</label>
</td>
<td>
{{ d.params.data.deliveryName || '' }}
</td>
</tr>
</tbody>
</table>
</script>
<script>
var debug= layui.setter.debug;
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
layui.use(['admin', 'form', 'coreHelper'], function () {
var $ = layui.$
, setter = layui.setter
, admin = layui.admin
, coreHelper = layui.coreHelper
, form = layui.form;
form.render(null, 'LAY-app-WeChatShippingDelivery-detailsForm');
});
};
</script>

View File

@@ -0,0 +1,48 @@
<script type="text/html" template lay-done="layui.data.sendParams(d);">
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatShippingDelivery-editForm" id="LAY-app-WeChatShippingDelivery-editForm">
<input type="hidden" name="id" value="{{d.params.data.id || '' }}" />
<div class="layui-form-item">
<label for="deliveryId" class="layui-form-label layui-form-required">快递公司编码</label>
<div class="layui-input-block">
<input name="deliveryId" lay-verType="tips" lay-verify="required|verifydeliveryId" class="layui-input" placeholder="请输入快递公司编码" lay-reqText="请输入快递公司编码" value="{{d.params.data.deliveryId || '' }}" />
</div>
</div>
<div class="layui-form-item">
<label for="deliveryName" class="layui-form-label layui-form-required">快递公司名称</label>
<div class="layui-input-block">
<input name="deliveryName" lay-verType="tips" lay-verify="required|verifydeliveryName" class="layui-input" placeholder="请输入快递公司名称" lay-reqText="请输入快递公司名称" value="{{d.params.data.deliveryName || '' }}" />
</div>
</div>
<div class="layui-form-item text-right core-hidden">
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatShippingDelivery-editForm-submit" id="LAY-app-WeChatShippingDelivery-editForm-submit" value="确认编辑">
</div>
</div>
</script>
<script>
var debug = layui.setter.debug;
layui.data.sendParams = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
function () {
var $ = layui.$
, form = layui.form
, admin = layui.admin
, laydate = layui.laydate
, upload = layui.upload
, cropperImg = layui.cropperImg
, coreHelper = layui.coreHelper;
form.verify({
verifydeliveryId: [/^.{0,50}$/, '快递公司编码最大只允许输入50位字符'],
verifydeliveryName: [/^.{0,50}$/, '快递公司名称最大只允许输入50位字符'],
});
//重载form
form.render(null, 'LAY-app-WeChatShippingDelivery-editForm');
})
};
</script>

View File

@@ -0,0 +1,148 @@
<title>微信发货快递公司信息</title>
<!--当前位置开始-->
<div class="layui-card layadmin-header">
<div class="layui-breadcrumb" lay-filter="breadcrumb">
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
</script>
</div>
</div>
<!--当前位置结束-->
<style>
/* 重写样式 */
</style>
<script type="text/html" template lay-type="Post" lay-url="Api/WeChatShippingDelivery/GetIndex" lay-done="layui.data.done(d);">
</script>
<div class="table-body">
<table id="LAY-app-WeChatShippingDelivery-tableBox" lay-filter="LAY-app-WeChatShippingDelivery-tableBox"></table>
</div>
<script type="text/html" id="LAY-app-WeChatShippingDelivery-toolbar">
<div class="layui-form coreshop-toolbar-search-form">
<div class="layui-form-item">
<div class="layui-inline">
<label class="layui-form-label" for="deliveryId">快递公司编码</label>
<div class="layui-input-inline">
<input type="text" name="deliveryId" placeholder="请输入快递公司编码" class="layui-input">
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" for="deliveryName">快递公司名称</label>
<div class="layui-input-inline">
<input type="text" name="deliveryName" placeholder="请输入快递公司名称" class="layui-input">
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-WeChatShippingDelivery-search"><i class="layui-icon layui-icon-search"></i></button>
</div>
</div>
</div>
</script>
<script type="text/html" id="LAY-app-WeChatShippingDelivery-pagebar">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="updateCompany"><i class="layui-icon layui-icon-refresh-1"></i></button>
</div>
</script>
<script>
var indexData;
var debug = layui.setter.debug;
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d); }
indexData = d.data;
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
function () {
var $ = layui.$
, admin = layui.admin
, table = layui.table
, form = layui.form
, laydate = layui.laydate
, setter = layui.setter
, coreHelper = layui.coreHelper
, util = layui.util
, view = layui.view;
var searchwhere;
//监听搜索
form.on('submit(LAY-app-WeChatShippingDelivery-search)',
function (data) {
var field = data.field;
searchwhere = field;
//执行重载
table.reloadData('LAY-app-WeChatShippingDelivery-tableBox', { where: field });
});
//数据绑定
table.render({
elem: '#LAY-app-WeChatShippingDelivery-tableBox',
url: layui.setter.apiUrl + 'Api/WeChatShippingDelivery/GetPageList',
method: 'POST',
toolbar: '#LAY-app-WeChatShippingDelivery-toolbar',
pagebar: '#LAY-app-WeChatShippingDelivery-pagebar',
className: 'pagebarbox',
defaultToolbar: ['filter', 'print', 'exports'],
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
page: true,
limit: 30,
limits: [10, 15, 20, 25, 30, 50, 100, 200],
text: { none: '暂无相关数据' },
cols: [
[
{ type: "checkbox", fixed: "left" },
{ field: 'id', title: '序列', width: 60, sort: false },
{ field: 'deliveryId', title: '快递公司编码', sort: false, width: 205 },
{ field: 'deliveryName', title: '快递公司名称', sort: false, width: 205 },
]
]
});
//监听排序事件
table.on('sort(LAY-app-WeChatShippingDelivery-tableBox)', function (obj) {
table.reloadData('LAY-app-WeChatShippingDelivery-tableBox', {
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
orderField: obj.field, //排序字段
orderDirection: obj.type //排序方式
}
});
});
//头工具栏事件
table.on('pagebar(LAY-app-WeChatShippingDelivery-tableBox)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
switch (obj.event) {
case 'updateCompany':
updateCompany();
break;
};
});
//监听工具条
table.on('tool(LAY-app-WeChatShippingDelivery-tableBox)',
function (obj) {
if (obj.event === 'detail') {
doDetails(obj);
} else if (obj.event === 'del') {
doDelete(obj);
} else if (obj.event === 'edit') {
doEdit(obj)
}
});
//刷新数据
function updateCompany(obj) {
layer.confirm('确定刷新吗?刷新后将删除老数据。', function (index) {
coreHelper.Post("Api/WeChatShippingDelivery/DoUpdateCompany", null, function (e) {
if (debug) { console.log(e); } //开启调试返回数据
table.reloadData('LAY-app-WeChatShippingDelivery-tableBox'); //重载表格
layer.msg(e.msg);
});
});
}
//重载form
form.render();
});
};
</script>

View File

@@ -0,0 +1,236 @@
<script type="text/html" template lay-done="layui.data.done(d);">
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatShippingOrder-createForm" id="LAY-app-WeChatShippingOrder-createForm">
<input type="hidden" name="transaction_id" value="{{d.params.data.order.transaction_id }}" />
<input type="hidden" name="openid" value="{{d.params.data.order.openid }}" />
<input type="hidden" name="merchant_id" value="{{d.params.data.order.merchant_id }}" />
<input type="hidden" name="merchant_trade_no" value="{{d.params.data.order.merchant_trade_no }}" />
<blockquote class="layui-elem-quote">
商户单号{{d.params.data.order.merchant_trade_no }}<br />
交易单号{{d.params.data.order.transaction_id }}<br />
支付金额¥ {{d.params.data.order.paid_amount / 100 }} <br />
支付时间{{ layui.util.toDateString(d.params.data.order.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
</blockquote>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">商品信息</label>
<div class="layui-input-block">
<textarea name="item_desc" placeholder="商品信息会向用户展示,请保持和订单信息一致。输入多个商品时用“ ; ”隔开。" class="layui-textarea">{{d.params.data.orderTitle}}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发货方式</label>
<div class="layui-input-block">
{{# layui.each(d.params.data.logisticsType, function(index, item){ }}
<input type="radio" name="logistics_type" value="{{item.value}}" title="{{item.title}}" {{item.value==d.params.data.logisticsTypeValue ? 'checked':''}} lay-filter="logistics-type-filter">
{{# }); }}
</div>
</div>
<div id="logisticsBox">
<div class="layui-form-item">
<label for="matchKey" class="layui-form-label ">
快递信息
</label>
<div class="layui-input-block">
<table class="layui-table">
<thead>
<tr>
<th>物流公司</th>
<th style="width: 250px;">快递单号</th>
<th style="width: 82px;">操作</th>
</tr>
</thead>
<tbody id="logisticsView">
<tr data-id="0">
<td>
<select lay-search="" id="express_company" name="shipping_list.express_company[0]" class="layui-input">
<option value="">请选择可直接输入搜索</option>
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
{{# }); }}
</select>
</td>
<td class="field_value">
<input type="text" id="tracking_no" name="shipping_list.tracking_no[0]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
</td>
<td>
<a class="layui-btn layui-btn-xs addfield-class table-button">
添加
</a>
<!--<a class="layui-btn layui-btn-danger layui-btn-xs del-class table-button">
删除
</a>-->
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">全部发货</label>
<div class="layui-input-block">
<input type="checkbox" name="is_all_delivered" lay-skin="switch" lay-filter="switchTest" checked="checked" title="是|否">
</div>
</div>
{{# if(d.params.data.billDeliveryList){ }}
<div class="layui-bg-gray" style="padding: 16px;">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">订单发货信息</div>
<div class="layui-card-body">
{{# layui.each(d.params.data.billDeliveryList, function(index, item){ }}
发货快递{{item.logiCode}} 快递编号{{item.logiNo}}
{{# }); }}
</div>
</div>
</div>
</div>
</div>
{{# } }}
</div>
<div id="cityDistributionBox" style="display:none;">
<div class="layui-form-item">
<label for="matchKey" class="layui-form-label">
快递信息
</label>
<div class="layui-input-inline layui-inline-4">
<input name="cityDistributionName" class="layui-input" placeholder="填写同城配送公司名称" />
</div>
<div class="layui-input-inline layui-inline-4">
<input name="cityDistributionNumber" class="layui-input" placeholder="填写快递单号" />
</div>
<div class="layui-form-mid">
如商家自配则该项可选填
</div>
</div>
</div>
<div class="layui-form-item text-right core-hidden">
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatShippingOrder-createForm-submit" id="LAY-app-WeChatShippingOrder-createForm-submit" value="确认添加">
</div>
</div>
</script>
<script id="tr_tpl" type="text/html">
<tr data-id="{{ d.id }}">
<td>
<select lay-search="" id="express_company" name="shipping_list.express_company[{{ d.id }}]" class="layui-input">
<option value="">请选择可直接输入搜索</option>
{{# layui.each(d.deliveryCompany, function(index, item){ }}
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
{{# }); }}
</select>
</td>
<td class="field_value">
<input type="text" id="tracking_no" name="shipping_list.tracking_no[{{ d.id }}]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
</td>
<td>
<a class="layui-btn layui-btn-xs addfield-class table-button">
添加
</a>
<a class="layui-btn layui-btn-danger layui-btn-xs del-class table-button">
删除
</a>
</td>
</tr>
</script>
<script>
var data;
var debug = layui.setter.debug;
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
data = d.params.data;
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg', 'laytpl'],
function () {
var $ = layui.$
, form = layui.form
, admin = layui.admin
, laydate = layui.laydate
, upload = layui.upload
, cropperImg = layui.cropperImg
, laytpl = layui.laytpl
, coreHelper = layui.coreHelper;
hideBox(d.params.data.logisticsTypeValue);
$(".layui-table").on('click', '.addfield-class', function (e) {
var getTpl = tr_tpl.innerHTML;
var lastId = $(this).parent().parent().parent().find('tr').last().attr('data-id');
console.log(lastId);
var tmpData = {};
tmpData.id = parseInt(lastId) + 1;
tmpData.deliveryCompany = d.params.data.deliveryCompany;
laytpl(getTpl).render(tmpData, function (html) {
$("#logisticsView").append(html);
form.render();
});
});
$(".layui-table").on('click', '.del-class', function (e) {
if ($(".del-class").length > 0) {
$(this).parent().parent().remove();
resetInputNameID();
} else {
layer.msg("至少保留1个物流信息录入框");
}
})
//重置排序
function resetInputNameID() {
$.each($("#logisticsView tr"), function (i, tr) {
$(this).attr('data-id', i);
$(this).find("#express_company").attr("name", "shipping_list.express_company[" + i + "]");
$(this).find("#tracking_no").attr("name", "shipping_list.tracking_no[" + i + "]");
});
}
// radio 事件
form.on('radio(logistics-type-filter)', function (data) {
var elem = data.elem; // 获得 radio 原始 DOM 对象
var value = elem.value; // 获得 radio 值
hideBox(value);
});
function hideBox(value) {
if (value == 1) {
$('#logisticsBox').show();
$('#cityDistributionBox').hide();
} else if (value == 2) {
$('#logisticsBox').hide();
$('#cityDistributionBox').show();
} else {
$('#logisticsBox').hide();
$('#cityDistributionBox').hide();
}
}
form.verify({
verifymatchKey: [/^.{0,100}$/, '匹配字符最大只允许输入100位字符'],
verifyimgTextUrl: [/^.{0,1000}$/, '图片回复图片地址最大只允许输入1000位字符'],
verifyimgTextLink: [/^.{0,1000}$/, '图片回复超链接最大只允许输入1000位字符'],
verifymeidaUrl: [/^.{0,1000}$/, '语音回复地址最大只允许输入1000位字符'],
verifymeidaLink: [/^.{0,1000}$/, '语音回复超链接最大只允许输入1000位字符'],
verifyremark: [/^.{0,1000}$/, '备注最大只允许输入1000位字符'],
verifycreateBy: [/^.{0,100}$/, '创建来源最大只允许输入100位字符'],
verifymodifyBy: [/^.{0,100}$/, '修改来源最大只允许输入100位字符'],
});
//重载form
form.render(null, 'LAY-app-WeChatShippingOrder-createForm');
})
};
</script>

View File

@@ -0,0 +1,104 @@
<script type="text/html" template lay-done="layui.data.done(d);">
<div class="layui-table layui-form" lay-filter="LAY-app-WeChatMessageResponse-detailsForm" id="LAY-app-WeChatMessageResponse-detailsForm">
{{ d.params.data.id || '' }}
<div class="layui-bg-gray" style="padding: 5px;">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">发货状态</div>
<div class="layui-card-body">
{{# layui.each(d.params.data.status, function(index, item){ }}
{{# if(d.params.data.order.order_state==item.value) { }}
{{- item.description }}
{{# } }}
{{# }); }}
</div>
</div>
</div>
</div>
</div>
<div class="layui-bg-gray" style="padding: 5px;">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">发货状态</div>
<div class="layui-card-body">
商户号{{d.params.data.order.merchant_id }}<br />
商户单号{{d.params.data.order.merchant_trade_no }}<br />
交易单号{{d.params.data.order.transaction_id }}<br />
支付金额¥ {{d.params.data.order.paid_amount / 100 }} <br />
支付时间{{ layui.util.toDateString(d.params.data.order.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
</div>
</div>
</div>
</div>
</div>
<div class="layui-bg-gray" style="padding: 5px;">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-header">
发货信息
</div>
<div class="layui-card-body">
商品信息{{d.params.data.order.description }}<br />
发货方式
{{# layui.each(d.params.data.logisticsType, function(index, item){ }}
{{d.params.data.order.shipping.logistics_type==item.value ? item.title:''}}
{{# }); }}
<br />
{{# if(d.params.data.order.shipping.logistics_type==1) { }}
{{# layui.each(d.params.data.order.shipping.shipping_list, function(index, itemP){ }}
发货时间{{ layui.util.toDateString(itemP.upload_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
包裹{{index+1}}
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
{{itemP.express_company==item.deliveryId ? item.deliveryName:''}}
{{# }); }}
{{itemP.tracking_no}}
<br />
{{# }); }}
{{# }; }}
</div>
</div>
</div>
</div>
</div>
</div>
</script>
<script>
var debug = layui.setter.debug;
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
layui.use(['admin', 'form', 'coreHelper'], function () {
var $ = layui.$
, setter = layui.setter
, admin = layui.admin
, coreHelper = layui.coreHelper
, form = layui.form;
form.render(null, 'LAY-app-WeChatMessageResponse-detailsForm');
});
};
</script>

View File

@@ -0,0 +1,387 @@
<title>微信自动回复消息表</title>
<!--当前位置开始-->
<div class="layui-card layadmin-header">
<div class="layui-breadcrumb" lay-filter="breadcrumb">
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
</script>
</div>
</div>
<!--当前位置结束-->
<style>
/* 重写样式 */
</style>
<script type="text/html" template lay-type="Post" lay-url="Api/WeChatShippingOrder/GetIndex" lay-done="layui.data.done(d);">
</script>
<div class="table-body">
<table id="LAY-app-WeChatShippingOrder-tableBox" lay-filter="LAY-app-WeChatShippingOrder-tableBox"></table>
<div id="demo-laypage-pn-show"></div>
</div>
<script type="text/html" id="LAY-app-WeChatShippingOrder-toolbar">
<div class="layui-form coreshop-toolbar-search-form">
<div class="layui-form-item">
<div class="layui-inline">
<div class="layui-input-inline">
<select name="status">
<option value="">请选择订单状态</option>
{{# layui.each(indexData.status, function(index, item){ }}
<option value="{{item.value}}">{{- item.description}}</option>
{{# }); }}
</select>
</div>
</div>
<div class="layui-inline">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-WeChatShippingOrder-search"><i class="layui-icon layui-icon-search"></i></button>
</div>
</div>
</div>
</script>
<script type="text/html" id="LAY-app-WeChatShippingOrder-tableBox-bar">
<!--<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">关联订单</a>-->
{{# if(d.order_state>1){ }}
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">发货详情</a>
{{# } }}
{{# if(d.order_state==1){ }}
<a class="layui-btn layui-btn-xs" lay-event="addData">立即发货</a>
{{# } else if(d.order_state==2){ }}
<a class="layui-btn layui-bg-blue layui-btn-xs" lay-event="updateData">重新发货</a>
{{# } }}
</script>
<script>
var _this = this;
var indexData;
var debug = layui.setter.debug;
var has_more = false;
var last_index = "";
layui.data.done = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d); }
indexData = d.data;
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper', 'laypage'],
function () {
var $ = layui.$
, admin = layui.admin
, table = layui.table
, form = layui.form
, laydate = layui.laydate
, setter = layui.setter
, coreHelper = layui.coreHelper
, util = layui.util
, laypage = layui.laypage
, view = layui.view;
var searchwhere;
//监听搜索
form.on('submit(LAY-app-WeChatShippingOrder-search)',
function (data) {
var field = data.field;
searchwhere = field;
//执行重载
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', { where: field });
});
//数据绑定
table.render({
elem: '#LAY-app-WeChatShippingOrder-tableBox',
url: layui.setter.apiUrl + 'Api/WeChatShippingOrder/GetPageList',
method: 'POST',
where: { last_index: last_index, has_more: has_more },
toolbar: '#LAY-app-WeChatShippingOrder-toolbar',
//pagebar: '#LAY-app-WeChatShippingOrder-pagebar',
className: 'pagebarbox',
defaultToolbar: ['filter', 'print', 'exports'],
//height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
page: false,
limit: 10,
limits: [10, 15, 20, 25, 30, 50, 100, 200],
text: { none: '暂无相关数据' },
cols: [
[
{ type: "checkbox", fixed: "left" },
//{ field: 'merchant_id', title: '商户号', align: 'center', width: 100, sort: false },
//{ field: 'sub_merchant_id', title: '二级商户号', width: 80, sort: false },
{ field: 'transaction_id', title: '微信订单号', sort: false, width: 205 },
{ field: 'merchant_trade_no', title: '支付单号', sort: false, width: 125 },
{
field: 'order_state', title: '发货单状态', sort: false, align: 'center', width: 80, templet: function (data) {
for (var i = 0; i < d.data.status.length; i++) {
if (d.data.status[i].value == data.order_state) {
return d.data.status[i].description;
}
}
return "";
}
},
{
field: 'logistics_type', title: '发货模式', sort: false, align: 'center', width: 80, templet: function (data) {
for (var i = 0; i < d.data.logisticsType.length; i++) {
if (d.data.logisticsType[i].value == data.shipping.logistics_type) {
return d.data.logisticsType[i].description;
}
}
return "";
}
},
{ field: 'description', title: '发货商品描述', sort: false },
{
field: 'paid_amount', title: '实际支付', sort: false, align: 'center', width: 80, templet: function (data) {
return '<div>' + (data.paid_amount / 100) + '元' + '</div>';
}
},
{ field: 'openid', title: 'openid', sort: false, width: 220 },
{
field: 'trade_create_time', title: '交易创建时间', sort: false, width: 130, templet: function (data) {
return util.toDateString(data.trade_create_time * 1000, 'yyyy-MM-dd HH:mm:ss');;
}
},
{
field: 'pay_time', title: '支付时间', sort: false, width: 130, templet: function (data) {
return util.toDateString(data.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss');
}
},
{ field: 'in_complaint', title: '交易纠纷中', width: 85, templet: '#switch_in_complaint', align: 'center', sort: false, unresize: true },
{ width: 220, align: 'center', title: '操作', fixed: 'right', toolbar: '#LAY-app-WeChatShippingOrder-tableBox-bar' }
]
],
done: function (res, curr, count, origin) {
console.log(res); // 得到当前渲染的数据
console.log(curr); // 得到当前页码
console.log(count); // 得到数据总量
console.log(res.otherData.has_more);
if (res.code == 0) {
has_more = res.otherData.has_more;
if (res.otherData.has_more) {
last_index = res.otherData.last_index;
} else {
last_index = "";
}
}
},
});
//监听排序事件
table.on('sort(LAY-app-WeChatShippingOrder-tableBox)', function (obj) {
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', {
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
orderField: obj.field, //排序字段
orderDirection: obj.type //排序方式
}
});
});
//监听工具条
table.on('tool(LAY-app-WeChatShippingOrder-tableBox)',
function (obj) {
if (obj.event === 'detail') {
doDetails(obj);
} else if (obj.event === 'updateData') {
doUpdate(obj)
} else if (obj.event === 'addData') {
doCreate(obj)
}
});
//执行创建操作
function doCreate(obj) {
coreHelper.Post("Api/WeChatShippingOrder/GetCreate", { data: obj.data.transaction_id, id: obj.data.merchant_trade_no }, function (e) {
if (e.code === 0) {
admin.popup({
shadeClose: false,
title: '创建数据',
area: ['800px', '90%'],
id: 'LAY-popup-WeChatShippingOrder-create',
success: function (layero, index) {
view(this.id).render('wechatshipping/order/create', { data: e.data }).done(function () {
//监听提交
form.on('submit(LAY-app-WeChatShippingOrder-createForm-submit)',
function (data) {
var field = data.field; //获取提交的字段
field.is_all_delivered = field.is_all_delivered == 'on';
var keys = Object.keys(field);
var keysCount = 0;
for (var i = 0; i < keys.length; i++) {
if (keys[i].indexOf('shipping_list.express_company') != -1) {
keysCount++;
}
}
var items = [];
if (keysCount > 0) {
for (var i = 0; i < keysCount; i++) {
var item = {};
item.express_company = field['shipping_list.express_company[' + i + ']'];
item.tracking_no = field['shipping_list.tracking_no[' + i + ']'];
items.push(item);
}
}
field.shipping_list = items;
if (debug) { console.log(field); } //开启调试返回数据
//提交 Ajax 成功后,关闭当前弹层并重载表格
coreHelper.Post("Api/WeChatShippingOrder/DoCreate", field, function (e) {
console.log(e)
if (e.code === 0) {
layui.table.reloadData('LAY-app-WeChatShippingOrder-tableBox'); //重载表格
layer.close(index); //再执行关闭
layer.msg(e.msg);
} else {
layer.msg(e.msg);
}
});
});
});
// 禁止弹窗出现滚动条
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
}
, btn: ['确定', '取消']
, yes: function (index, layero) {
layero.contents().find("#LAY-app-WeChatShippingOrder-createForm-submit").click();
}
});
} else {
layer.msg(e.msg);
}
});
}
//执行编辑操作
function doUpdate(obj) {
coreHelper.Post("Api/WeChatShippingOrder/GetUpdate", { data: obj.data.transaction_id, id: obj.data.merchant_trade_no }, function (e) {
if (e.code === 0) {
admin.popup({
shadeClose: false,
title: '编辑数据',
area: ['800px', '90%'],
id: 'LAY-popup-WeChatShippingOrder-update',
success: function (layero, index) {
view(this.id).render('wechatshipping/order/update', { data: e.data }).done(function () {
//监听提交
form.on('submit(LAY-app-WeChatMessageResponse-updateForm-submit)',
function (data) {
var field = data.field; //获取提交的字段
field.is_all_delivered = field.is_all_delivered == 'on';
var keys = Object.keys(field);
var keysCount = 0;
for (var i = 0; i < keys.length; i++) {
if (keys[i].indexOf('shipping_list.express_company') != -1) {
keysCount++;
}
}
var items = [];
if (keysCount > 0) {
for (var i = 0; i < keysCount; i++) {
var item = {};
item.express_company = field['shipping_list.express_company[' + i + ']'];
item.tracking_no = field['shipping_list.tracking_no[' + i + ']'];
items.push(item);
}
}
field.shipping_list = items;
if (debug) { console.log(field); } //开启调试返回数据
//提交 Ajax 成功后,关闭当前弹层并重载表格
coreHelper.Post("Api/WeChatShippingOrder/DoCreate", field, function (e) {
console.log(e)
if (e.code === 0) {
layui.table.reloadData('LAY-app-WeChatShippingOrder-tableBox'); //重载表格
layer.close(index); //再执行关闭
layer.msg(e.msg);
} else {
layer.msg(e.msg);
}
});
});
})
// 禁止弹窗出现滚动条
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
}
, btn: ['确定', '取消']
, yes: function (index, layero) {
layero.contents().find("#LAY-app-WeChatMessageResponse-updateForm-submit").click();
}
});
} else {
layer.msg(e.msg);
}
});
}
//执行预览操作
function doDetails(obj) {
coreHelper.Post("Api/WeChatShippingOrder/GetDetails", { data: obj.data.transaction_id, id: obj.data.merchant_trade_no }, function (e) {
if (e.code === 0) {
admin.popup({
shadeClose: false,
title: '查看详情',
area: ['800px', '600px'],
id: 'LAY-popup-WeChatShippingOrder-details',
success: function (layero, index) {
view(this.id).render('wechatshipping/order/details', { data: e.data }).done(function () {
form.render();
});
// 禁止弹窗出现滚动条
//$(layero).children('.layui-layer-content').css('overflow', 'visible');
}
});
} else {
layer.msg(e.msg);
}
});
}
// 只显示上一页、下一页、当前页
laypage.render({
elem: 'demo-laypage-pn-show',
count: 99999,
groups: 1,
first: '首页',
last: false,
layout: ['first', 'page', 'next'],
jump: function (obj, first) {
// 首次不执行
if (!first) {
layer.msg('第 ' + obj.curr + ' 页');
if (has_more) {
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', {
where: { last_index: last_index },
scrollPos: true,
});
} else {
layer.msg('没有更多内容了');
}
if (obj.curr == 1) {
last_index = '';
table.reloadData('LAY-app-WeChatShippingOrder-tableBox', {
where: { last_index: '' },
scrollPos: true,
});
}
}
}
});
//重载form
form.render();
});
};
</script>
<!--设置是否启用-->
<script type="text/html" id="switch_in_complaint">
<input type="checkbox" name="switch_in_complaint" value="{{d.in_complaint}}" lay-skin="switch" lay-text="是|否" disabled="disabled">
</script>

View File

@@ -0,0 +1,241 @@
<script type="text/html" template lay-done="layui.data.sendParams(d);">
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-WeChatMessageResponse-updateForm" id="LAY-app-WeChatMessageResponse-updateForm">
<input type="hidden" name="transaction_id" value="{{d.params.data.order.transaction_id }}" />
<input type="hidden" name="openid" value="{{d.params.data.order.openid }}" />
<input type="hidden" name="merchant_id" value="{{d.params.data.order.merchant_id }}" />
<input type="hidden" name="merchant_trade_no" value="{{d.params.data.order.merchant_trade_no }}" />
<blockquote class="layui-elem-quote">
商户单号{{d.params.data.order.merchant_trade_no }}<br />
交易单号{{d.params.data.order.transaction_id }}<br />
支付金额¥ {{d.params.data.order.paid_amount / 100 }} <br />
支付时间{{ layui.util.toDateString(d.params.data.order.pay_time * 1000, 'yyyy-MM-dd HH:mm:ss')}}<br />
</blockquote>
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">商品信息</label>
<div class="layui-input-block">
<textarea name="item_desc" placeholder="商品信息会向用户展示,请保持和订单信息一致。输入多个商品时用“ ; ”隔开。" class="layui-textarea">{{d.params.data.order.description}}</textarea>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">发货方式</label>
<div class="layui-input-block">
{{# layui.each(d.params.data.logisticsType, function(index, item){ }}
<input type="radio" name="logistics_type" value="{{item.value}}" title="{{item.title}}" {{d.params.data.order.shipping.logistics_type==item.value ? 'checked':''}} lay-filter="logistics-type-filter">
{{# }); }}
</div>
</div>
<div id="logisticsBox">
<div class="layui-form-item">
<label for="matchKey" class="layui-form-label ">
快递信息
</label>
<div class="layui-input-block">
<table class="layui-table">
<thead>
<tr>
<th>物流公司</th>
<th style="width: 250px;">快递单号</th>
<th style="width: 82px;">操作</th>
</tr>
</thead>
<tbody id="logisticsView">
{{# if(d.params.data.order.shipping.logistics_type==1) { }}
{{# layui.each(d.params.data.order.shipping.shipping_list, function(index, itemP){ }}
<tr data-id="{{index}}">
<td>
<select lay-search="" id="express_company" name="shipping_list.express_company[0]" class="layui-input">
<option value="">请选择可直接输入搜索</option>
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
<option value="{{item.deliveryId}}" {{itemP.express_company==item.deliveryId ? 'selected="selected"':''}}>{{item.deliveryName}}</option>
{{# }); }}
</select>
</td>
<td class="field_value">
<input type="text" id="tracking_no" name="shipping_list.tracking_no[0]" required value="{{itemP.tracking_no}}" placeholder="填写快递单号" autocomplete="off" class="layui-input">
</td>
<td>
<a class="layui-btn layui-btn-xs addfield-class table-button">
添加
</a>
</td>
</tr>
{{# }); }}
{{# } else { }}
<tr data-id="0">
<td>
<select lay-search="" id="express_company" name="shipping_list.express_company[0]" class="layui-input">
<option value="">请选择可直接输入搜索</option>
{{# layui.each(d.params.data.deliveryCompany, function(index, item){ }}
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
{{# }); }}
</select>
</td>
<td class="field_value">
<input type="text" id="tracking_no" name="shipping_list.tracking_no[0]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
</td>
<td>
<a class="layui-btn layui-btn-xs addfield-class table-button">
添加
</a>
</td>
</tr>
{{# }; }}
</tbody>
</table>
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">全部发货</label>
<div class="layui-input-block">
<input type="checkbox" name="is_all_delivered" lay-skin="switch" lay-filter="switchTest" checked="checked" title="是|否">
</div>
</div>
</div>
<div id="cityDistributionBox" style="display:none;">
<div class="layui-form-item">
<label for="matchKey" class="layui-form-label">
快递信息
</label>
<div class="layui-input-inline layui-inline-4">
<input name="cityDistributionName" class="layui-input" placeholder="填写同城配送公司名称" value="{{d.params.data.order.shipping.logistics_type==2 ? d.params.data.order.shipping.shipping_list[0].express_company : ''}}" />
</div>
<div class="layui-input-inline layui-inline-4">
<input name="cityDistributionNumber" class="layui-input" placeholder="填写快递单号" value="{{d.params.data.order.shipping.logistics_type==2 ? d.params.data.order.shipping.shipping_list[0].tracking_no : ''}}" />
</div>
<div class="layui-form-mid">
如商家自配则该项可选填
</div>
</div>
</div>
<div class="layui-form-item text-right core-hidden">
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-WeChatMessageResponse-updateForm-submit" id="LAY-app-WeChatMessageResponse-updateForm-submit" value="确认编辑">
</div>
</div>
</script>
<script id="tr_tpl" type="text/html">
<tr data-id="{{ d.id }}">
<td>
<select lay-search="" id="express_company" name="shipping_list.express_company[{{ d.id }}]" class="layui-input">
<option value="">请选择可直接输入搜索</option>
{{# layui.each(d.deliveryCompany, function(index, item){ }}
<option value="{{item.deliveryId}}">{{item.deliveryName}}</option>
{{# }); }}
</select>
</td>
<td class="field_value">
<input type="text" id="tracking_no" name="shipping_list.tracking_no[{{ d.id }}]" required value="" placeholder="填写快递单号" autocomplete="off" class="layui-input">
</td>
<td>
<a class="layui-btn layui-btn-xs addfield-class table-button">
添加
</a>
<a class="layui-btn layui-btn-danger layui-btn-xs del-class table-button">
删除
</a>
</td>
</tr>
</script>
<script>
var debug = layui.setter.debug;
layui.data.sendParams = function (d) {
//开启调试情况下获取接口赋值数据
if (debug) { console.log(d.params.data); }
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg', 'laytpl'],
function () {
var $ = layui.$
, form = layui.form
, admin = layui.admin
, laydate = layui.laydate
, upload = layui.upload
, cropperImg = layui.cropperImg
, laytpl = layui.laytpl
, coreHelper = layui.coreHelper;
hideBox(d.params.data.order.shipping.logistics_type);
$(".layui-table").on('click', '.addfield-class', function (e) {
var getTpl = tr_tpl.innerHTML;
var lastId = $(this).parent().parent().parent().find('tr').last().attr('data-id');
console.log(lastId);
var tmpData = {};
tmpData.id = parseInt(lastId) + 1;
tmpData.deliveryCompany = d.params.data.deliveryCompany;
laytpl(getTpl).render(tmpData, function (html) {
$("#logisticsView").append(html);
form.render();
});
});
$(".layui-table").on('click', '.del-class', function (e) {
if ($(".del-class").length > 0) {
$(this).parent().parent().remove();
resetInputNameID();
} else {
layer.msg("至少保留1个物流信息录入框");
}
})
//重置排序
function resetInputNameID() {
$.each($("#logisticsView tr"), function (i, tr) {
$(this).attr('data-id', i);
$(this).find("#express_company").attr("name", "shipping_list.express_company[" + i + "]");
$(this).find("#tracking_no").attr("name", "shipping_list.tracking_no[" + i + "]");
});
}
// radio 事件
form.on('radio(logistics-type-filter)', function (data) {
var elem = data.elem; // 获得 radio 原始 DOM 对象
var value = elem.value; // 获得 radio 值
hideBox(value);
});
function hideBox(value) {
if (value == 1) {
$('#logisticsBox').show();
$('#cityDistributionBox').hide();
} else if (value == 2) {
$('#logisticsBox').hide();
$('#cityDistributionBox').show();
} else {
$('#logisticsBox').hide();
$('#cityDistributionBox').hide();
}
}
form.verify({
verifymatchKey: [/^.{0,100}$/, '匹配字符最大只允许输入100位字符'],
verifyimgTextUrl: [/^.{0,1000}$/, '图片回复图片地址最大只允许输入1000位字符'],
verifyimgTextLink: [/^.{0,1000}$/, '图片回复超链接最大只允许输入1000位字符'],
verifymeidaUrl: [/^.{0,1000}$/, '语音回复地址最大只允许输入1000位字符'],
verifymeidaLink: [/^.{0,1000}$/, '语音回复超链接最大只允许输入1000位字符'],
verifyremark: [/^.{0,1000}$/, '备注最大只允许输入1000位字符'],
verifycreateBy: [/^.{0,100}$/, '创建来源最大只允许输入100位字符'],
verifymodifyBy: [/^.{0,100}$/, '修改来源最大只允许输入100位字符'],
});
//重载form
form.render(null, 'LAY-app-WeChatMessageResponse-updateForm');
})
};
</script>

View File

@@ -1527,23 +1527,6 @@
<param name="model"></param> <param name="model"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:CoreCms.Net.Web.WebApi.Controllers.WeChatTransactionComponentController">
<summary>
微信小程序自定义交易组件
</summary>
</member>
<member name="M:CoreCms.Net.Web.WebApi.Controllers.WeChatTransactionComponentController.#ctor(CoreCms.Net.WeChat.Service.HttpClients.IWeChatApiHttpClientFactory)">
<summary>
</summary>
<param name="weChatApiHttpClientFactory"></param>
</member>
<member name="M:CoreCms.Net.Web.WebApi.Controllers.WeChatTransactionComponentController.CheckScene(CoreCms.Net.Model.FromBody.FMIntId)">
<summary>
获取用户是否订阅
</summary>
<returns></returns>
</member>
<member name="T:CoreCms.Net.Web.Controllers.WeChat.WeChatOffiaccountNotifyController"> <member name="T:CoreCms.Net.Web.Controllers.WeChat.WeChatOffiaccountNotifyController">
<summary> <summary>
微信公众号消息推送对接 微信公众号消息推送对接

View File

@@ -0,0 +1,20 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for WeChatShippingDelivery
-- ----------------------------
DROP TABLE IF EXISTS `WeChatShippingDelivery`;
CREATE TABLE `WeChatShippingDelivery` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '序列',
`deliveryId` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '快递公司编码',
`deliveryName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '快递公司名称',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信发货快递公司信息' ROW_FORMAT = DYNAMIC;
-- ----------------------------
-- Records of WeChatShippingDelivery
-- ----------------------------
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,13 @@
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2638, 0, 'wechatshipping', '微信发货信息', 'layui-icon layui-icon-ok-circle', '', '', 0, 90, '', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2639, 2638, 'delivery', '快递公司管理', '', 'wechatshipping/delivery/index', '', 0, 1, '', NULL, NULL, 0, 0,'2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2641, 2639, 'GetPageList', '获取列表', NULL, NULL, '/Api/WeChatShippingDelivery/GetPageList', 1, 0, 'WeChatShippingDelivery:GetPageList', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2642, 2639, 'GetIndex', '首页数据', NULL, NULL, '/Api/WeChatShippingDelivery/GetIndex', 1, 1, 'WeChatShippingDelivery:GetIndex', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2643, 2639, 'DoUpdateCompany', '单选删除', NULL, NULL, '/Api/WeChatShippingDelivery/DoUpdateCompany', 1, 2, 'WeChatShippingDelivery:DoUpdateCompany', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2644, 2638, 'order', '发货信息列表', '', 'wechatshipping/order/index', '', 0, 10, '', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2653, 2644, 'GetPageList', '获取列表', NULL, NULL, '/Api/WeChatShippingOrder/GetPageList', 1, 0, 'WeChatShippingOrder:GetPageList', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2654, 2644, 'GetIndex', '首页数据', NULL, NULL, '/Api/WeChatShippingOrder/GetIndex', 1, 1, 'WeChatShippingOrder:GetIndex', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2655, 2644, 'GetCreate', '创建数据', NULL, NULL, '/Api/WeChatShippingOrder/GetCreate', 1, 2, 'WeChatShippingOrder:GetCreate', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2656, 2644, 'DoCreate', '创建提交', NULL, NULL, '/Api/WeChatShippingOrder/DoCreate', 1, 3, 'WeChatShippingOrder:DoCreate', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2657, 2644, 'GetUpdate', '创建数据', NULL, NULL, '/Api/WeChatShippingOrder/GetUpdate', 1, 4, 'WeChatShippingOrder:GetUpdate', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2658, 2644, 'DoUpdate', '创建提交', NULL, NULL, '/Api/WeChatShippingOrder/DoUpdate', 1, 5, 'WeChatShippingOrder:DoUpdate', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);
INSERT INTO SysMenu (id, parentId, identificationCode, menuName, menuIcon, path, component, menuType, sortNumber, authority, target, iconColor, hide, deleted, createTime, updateTime) VALUES (2659, 2644, 'GetDetails', '预览数据', NULL, NULL, '/Api/WeChatShippingOrder/GetDetails', 1, 6, 'WeChatShippingOrder:GetDetails', NULL, NULL, 0, 0, '2023-09-15 23:14:27', null);

View File

@@ -0,0 +1 @@
记得给角色权限

View File

@@ -1,3 +1,6 @@
20231008
【新增】表【WeChatShippingDelivery】微信发货快递公司信息表
2023-09-02 2023-09-02
【移除】移除旧版自定义组件相关的业务表。 【移除】移除旧版自定义组件相关的业务表。
【移除】WeChatTransactionComponentAuditCategory; 【移除】WeChatTransactionComponentAuditCategory;

View File

@@ -0,0 +1,25 @@
CREATE TABLE [dbo].[WeChatShippingDelivery](
[id] [int] IDENTITY(1,1) NOT NULL,
[deliveryId] [nvarchar](50) NOT NULL,
[deliveryName] [nvarchar](50) NOT NULL,
CONSTRAINT [PK_WeChatShippingDelivery] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WeChatShippingDelivery', @level2type=N'COLUMN',@level2name=N'id'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WeChatShippingDelivery', @level2type=N'COLUMN',@level2name=N'deliveryId'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'<EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD>˾<EFBFBD><EFBFBD><EFBFBD><EFBFBD>' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WeChatShippingDelivery', @level2type=N'COLUMN',@level2name=N'deliveryName'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'΢<EFBFBD>ŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݹ<EFBFBD>˾<EFBFBD><EFBFBD>Ϣ' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'WeChatShippingDelivery'
GO

View File

@@ -1,3 +1,6 @@
20231008
【新增】表【WeChatShippingDelivery】微信发货快递公司信息表
2023-09-02 2023-09-02
【移除】移除旧版自定义组件相关的业务表。 【移除】移除旧版自定义组件相关的业务表。
【移除】WeChatTransactionComponentAuditCategory; 【移除】WeChatTransactionComponentAuditCategory;