private static TemplateMessage GenerateWeixinMessageWhenOrderSend(string templateId, SiteSettings settings, MemberInfo user, OrderInfo order) { if (string.IsNullOrWhiteSpace(user.OpenId)) { return null; } string weixinToken = settings.WeixinToken; TemplateMessage message2 = new TemplateMessage { Url = "", TemplateId = templateId, Touser = user.OpenId }; TemplateMessage.MessagePart[] partArray = new TemplateMessage.MessagePart[5]; TemplateMessage.MessagePart part = new TemplateMessage.MessagePart { Name = "first", Value = "您好,您的订单号已经发货" }; partArray[0] = part; TemplateMessage.MessagePart part2 = new TemplateMessage.MessagePart { Name = "keyword1", Value = order.OrderId }; partArray[1] = part2; TemplateMessage.MessagePart part3 = new TemplateMessage.MessagePart { Name = "keyword2", Value = order.ExpressCompanyName }; partArray[2] = part3; TemplateMessage.MessagePart part4 = new TemplateMessage.MessagePart { Name = "keyword3", Value = order.ShipOrderNumber }; partArray[3] = part4; TemplateMessage.MessagePart part5 = new TemplateMessage.MessagePart { Name = "remark", Value = "" }; partArray[4] = part5; message2.Data = partArray; return message2; }
private static TemplateMessage GenerateWeixinMessageWhenPasswordChange(string templateId, SiteSettings settings, MemberInfo user, string passowordType) { if (string.IsNullOrWhiteSpace(user.OpenId)) { return null; } string weixinToken = settings.WeixinToken; TemplateMessage message2 = new TemplateMessage { Url = "", TemplateId = templateId, Touser = user.OpenId }; TemplateMessage.MessagePart[] partArray = new TemplateMessage.MessagePart[4]; TemplateMessage.MessagePart part = new TemplateMessage.MessagePart { Name = "first", Value = "您好" }; partArray[0] = part; TemplateMessage.MessagePart part2 = new TemplateMessage.MessagePart { Name = "productName", Value = passowordType + "密码" }; partArray[1] = part2; TemplateMessage.MessagePart part3 = new TemplateMessage.MessagePart { Name = "time", Value = DateTime.Now.ToString("M月d日 HH:mm") }; partArray[2] = part3; TemplateMessage.MessagePart part4 = new TemplateMessage.MessagePart { Name = "remark", Value = "" }; partArray[3] = part4; message2.Data = partArray; return message2; }
private static TemplateMessage GenerateWeixinMessageWhenOrderRefund(string templateId, SiteSettings settings, MemberInfo user, string orderId, decimal amount) { if (string.IsNullOrWhiteSpace(user.OpenId)) { return null; } string weixinToken = settings.WeixinToken; TemplateMessage message2 = new TemplateMessage { Url = "", TemplateId = templateId, Touser = user.OpenId }; TemplateMessage.MessagePart[] partArray = new TemplateMessage.MessagePart[4]; TemplateMessage.MessagePart part = new TemplateMessage.MessagePart { Name = "first", Value = "您好,您的订单号为" + orderId + "的订单已经退款" }; partArray[0] = part; TemplateMessage.MessagePart part2 = new TemplateMessage.MessagePart { Name = "reason", Value = "-" }; partArray[1] = part2; TemplateMessage.MessagePart part3 = new TemplateMessage.MessagePart { Name = "refund", Color = "#ff3300", Value = "¥" + amount.ToString("F2") }; partArray[2] = part3; TemplateMessage.MessagePart part4 = new TemplateMessage.MessagePart { Name = "remark", Value = "" }; partArray[3] = part4; message2.Data = partArray; return message2; }
private static TemplateMessage GenerateWeixinMessageWhenOrderPay(string templateId, SiteSettings settings, MemberInfo user, string orderId, decimal fee) { if (string.IsNullOrWhiteSpace(user.OpenId)) { return null; } string weixinToken = settings.WeixinToken; TemplateMessage message2 = new TemplateMessage { Url = "", TemplateId = templateId, Touser = user.OpenId }; TemplateMessage.MessagePart[] partArray = new TemplateMessage.MessagePart[4]; TemplateMessage.MessagePart part = new TemplateMessage.MessagePart { Name = "first", Value = "您好,您的订单" + orderId + "支付成功" }; partArray[0] = part; TemplateMessage.MessagePart part2 = new TemplateMessage.MessagePart { Name = "orderMoneySum", Color = "#ff3300", Value = "¥" + fee.ToString("F2") }; partArray[1] = part2; TemplateMessage.MessagePart part3 = new TemplateMessage.MessagePart { Name = "orderProductName", Value = "" }; partArray[2] = part3; TemplateMessage.MessagePart part4 = new TemplateMessage.MessagePart { Name = "remark", Value = "" }; partArray[3] = part4; message2.Data = partArray; return message2; }
private static TemplateMessage GenerateWeixinMessageWhenOrderCreate(string templateId, SiteSettings settings, OrderInfo order, MemberInfo user) { TemplateMessage message = null; if (!string.IsNullOrWhiteSpace(user.OpenId)) { string weixinToken = settings.WeixinToken; TemplateMessage message2 = new TemplateMessage { Url = "", TemplateId = templateId, Touser = user.OpenId }; TemplateMessage.MessagePart[] partArray = new TemplateMessage.MessagePart[3]; TemplateMessage.MessagePart part = new TemplateMessage.MessagePart { Name = "first", Value = "您的订单已提交成功!" }; partArray[0] = part; TemplateMessage.MessagePart part2 = new TemplateMessage.MessagePart { Name = "orderID", Value = order.OrderId }; partArray[1] = part2; TemplateMessage.MessagePart part3 = new TemplateMessage.MessagePart { Name = "orderMoneySum", Color = "#ff3300", Value = "¥" + order.GetTotal().ToString("F2") }; partArray[2] = part3; message2.Data = partArray; message = message2; } return message; }
private static TemplateMessage GenerateWeixinMessageWhenOrderClose(string templateId, SiteSettings settings, MemberInfo user, OrderInfo order, string reason) { if (string.IsNullOrWhiteSpace(user.OpenId)) { return null; } string weixinToken = settings.WeixinToken; TemplateMessage message2 = new TemplateMessage { Url = "", TemplateId = templateId, Touser = user.OpenId }; TemplateMessage.MessagePart[] partArray = new TemplateMessage.MessagePart[5]; TemplateMessage.MessagePart part = new TemplateMessage.MessagePart { Name = "first", Value = "您好,您的订单已关闭,请核对" }; partArray[0] = part; TemplateMessage.MessagePart part2 = new TemplateMessage.MessagePart { Name = "transid", Value = order.OrderId }; partArray[1] = part2; TemplateMessage.MessagePart part3 = new TemplateMessage.MessagePart { Name = "fee", Color = "#ff3300", Value = "¥" + order.GetTotal().ToString("F2") }; partArray[2] = part3; TemplateMessage.MessagePart part4 = new TemplateMessage.MessagePart { Name = "pay_time", Value = (order.PayDate.ToString() != "") ? DateTime.Parse(order.PayDate.ToString()).ToString("M月d日 HH:mm:ss") : DateTime.Parse(order.OrderDate.ToString()).ToString("M月d日 HH:mm:ss") }; partArray[3] = part4; TemplateMessage.MessagePart part5 = new TemplateMessage.MessagePart { Name = "remark", Color = "#000000", Value = "关闭原因:" + reason }; partArray[4] = part5; message2.Data = partArray; return message2; }
private static TemplateMessage GenerateWeixinMessageWhenFindPassword(string templateId, SiteSettings settings, MemberInfo user, string password) { if (string.IsNullOrWhiteSpace(user.OpenId)) { return null; } string weixinToken = settings.WeixinToken; TemplateMessage message2 = new TemplateMessage { Url = "", TemplateId = templateId, Touser = user.OpenId }; TemplateMessage.MessagePart[] partArray = new TemplateMessage.MessagePart[4]; TemplateMessage.MessagePart part = new TemplateMessage.MessagePart { Name = "first", Value = "您好,您的账号信息如下" }; partArray[0] = part; TemplateMessage.MessagePart part2 = new TemplateMessage.MessagePart { Name = "keyword1", Value = user.UserName }; partArray[1] = part2; TemplateMessage.MessagePart part3 = new TemplateMessage.MessagePart { Name = "keyword2", Value = password }; partArray[2] = part3; TemplateMessage.MessagePart part4 = new TemplateMessage.MessagePart { Name = "remark", Value = "请妥善保管。" }; partArray[3] = part4; message2.Data = partArray; return message2; }