103 lines
2.7 KiB
C#
103 lines
2.7 KiB
C#
using MyCode.Project.Infrastructure.Constant;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace MyCode.Project.Domain.Businesses.WorkProcess
|
|
{
|
|
/// <summary>
|
|
/// 微信 - 消费成功通知
|
|
/// </summary>
|
|
public class ConsumptionSuccessNotificationTemplate : NotificationTemplateBase
|
|
{
|
|
/// <summary>
|
|
/// 消费时间
|
|
/// </summary>
|
|
public DateTime SpendingTime { get; set; }
|
|
|
|
/// <summary>
|
|
/// 店铺
|
|
/// </summary>
|
|
public string Shop { get; set; }
|
|
|
|
/// <summary>
|
|
/// 消费类型
|
|
/// </summary>
|
|
public string Type { get; set; }
|
|
|
|
/// <summary>
|
|
/// 消费金额
|
|
/// </summary>
|
|
public decimal Money { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 积分
|
|
/// </summary>
|
|
public int Integral { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 现金消费金额
|
|
/// </summary>
|
|
public decimal CashConsumption { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 余额消费金额
|
|
/// </summary>
|
|
public decimal BalanceConsumption { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 余额
|
|
/// </summary>
|
|
public decimal Balance { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 消费明细
|
|
/// </summary>
|
|
public List<GoodsItem> Items { get; set; } = new List<GoodsItem>();
|
|
|
|
/// <summary>
|
|
/// 商品/服务项明细
|
|
/// </summary>
|
|
public class GoodsItem
|
|
{
|
|
/// <summary>
|
|
/// 名称
|
|
/// </summary>
|
|
public string Name { get; set; }
|
|
|
|
/// <summary>
|
|
/// 数量
|
|
/// </summary>
|
|
public int Qty { get; set; } = 0;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 初始化参数值
|
|
/// </summary>
|
|
protected override void InitParamValue()
|
|
{
|
|
Add(LxmConst.WechatTemplate.CASH_USE_KEY, Money.ToString("F"));
|
|
Add(LxmConst.WechatTemplate.BALANCE_USE_KEY, BalanceConsumption.ToString("F"));
|
|
Add(LxmConst.WechatTemplate.BALANCE_KEY, Balance.ToString("F"));
|
|
Add(LxmConst.WechatTemplate.CONSUMPTION_ITEMS_KEY, GetItems());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取消费明细
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private string GetItems()
|
|
{
|
|
StringBuilder sb = new StringBuilder();
|
|
foreach (var item in Items)
|
|
{
|
|
sb.AppendFormat("{0}*{1}{2}", item.Name, item.Qty, LxmConst.WechatTemplate.LINE);
|
|
}
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|