You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

184 lines
7.4 KiB

using BWP.B3WeChat.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TSingSoft.WebPluginFramework;
namespace BWP.B3WeChat.Utils
{
public static class SendMessageUtil
{
static string FormatTime(DateTime time)
{
return time.ToString("yyyy-MM-dd HH:mm:ss");
}
//OPENTM202765054
//模板ID:QOQFm0G2CiCNF03xdwpDcArfZBsFVtwDWp-hrECqRLk
//开发者调用模板消息接口时需提供模板ID
//标题服务评价通知
//行业IT科技 - IT软件与服务
//详细内容
//{{first.DATA}}
//编号:{{keyword1.DATA}}
//时间:{{keyword2.DATA}}
//{{remark.DATA}}
public static void SendAppraiseLinkMessage(string openID, string first,string no,string remark,string url)
{
Dictionary<string, ValueColor> dic = new Dictionary<string, ValueColor>();
dic.Add("first", new ValueColor(first));
dic.Add("keyword1", new ValueColor(no));
dic.Add("keyword2", new ValueColor(FormatTime(DateTime.Now)));
dic.Add("remark", new ValueColor(remark));
InOutMessageUtil.SendTemplateMessage(openID, "QOQFm0G2CiCNF03xdwpDcArfZBsFVtwDWp-hrECqRLk", dic, url);
}
//编号:OPENTM406714250
//标题:流程待办提醒
//{{first.DATA}}
//流程名称:{{keyword1.DATA}}
//提交时间:{{keyword2.DATA}}
//{{remark.DATA}}
public static void SendTodoMessage(string openID, string source, string toUsername, string flowName, DateTime time, string url)
{
var first = string.Format("你接收到来自{0}发送给用户{1}的新的审批任务", source, toUsername);
var keyword1 = flowName;
var keyword2 = FormatTime(time);
var remark = "你可以点击本消息进入处理界面";
Dictionary<string, ValueColor> dic = new Dictionary<string, ValueColor>();
dic.Add("first", new ValueColor() { value = first });
dic.Add("keyword1", new ValueColor() { value = keyword1 });
dic.Add("keyword2", new ValueColor() { value = keyword2 });
dic.Add("remark", new ValueColor() { value = remark });
InOutMessageUtil.SendTemplateMessage(openID, "qsaZh8axp__2V8Ut8owpUGu-wFH39fHt_DeBqoHiWI4", dic, url);
}
//编号:OPENTM406714250
//标题:流程待办提醒
//{{first.DATA}}
//流程名称:{{keyword1.DATA}}
//提交时间:{{keyword2.DATA}}
//{{remark.DATA}}
public static void SendApprovedMessage(string openID, string source, string toUsername, string flowName, DateTime time, string url)
{
var first = string.Format("你接收到来自{0}发送给用户{1}的审批完毕信息", source, toUsername);
var keyword1 = flowName;
var keyword2 = FormatTime(time);
var remark = "你可以点击本消息进入查看界面";
Dictionary<string, ValueColor> dic = new Dictionary<string, ValueColor>();
dic.Add("first", new ValueColor() { value = first });
dic.Add("keyword1", new ValueColor() { value = keyword1 });
dic.Add("keyword2", new ValueColor() { value = keyword2 });
dic.Add("remark", new ValueColor() { value = remark });
InOutMessageUtil.SendTemplateMessage(openID, "qsaZh8axp__2V8Ut8owpUGu-wFH39fHt_DeBqoHiWI4", dic, url);
}
//标题反馈处理通知
//行业IT科技 - IT软件与服务
//详细内容
//{{first.DATA}}
//反馈类型:{{keyword1.DATA}}
//反馈信息:{{keyword2.DATA}}
//提交时间:{{keyword3.DATA}}
//处理结果:{{keyword4.DATA}}
//{{remark.DATA}}
public static void SendFeedbackNotice(string openID, string first, string type, string info, DateTime submitTime, bool success, string remark = null)
{
var dic = new Dictionary<string, ValueColor>();
dic.Add("first", new ValueColor(first));
var keyword1 = type;
dic.Add("keyword1", new ValueColor(keyword1));
var keyword2 = info;
dic.Add("keyword2", new ValueColor(keyword2));
var keyword3 = FormatTime(submitTime);
dic.Add("keyword3", new ValueColor(keyword3));
var keyword4 = success ? "成功" : "失败";
dic.Add("keyword4", new ValueColor(keyword4, success ? "green" : "red"));
dic.Add("remark", new ValueColor(remark));
InOutMessageUtil.SendTemplateMessage(openID, "wMmuu5928fuhDhXEBWSfVUj7up_F6xs2V9sBTvnVVcA", dic);
}
//标题:系统运维通知
//行业:IT科技 - IT软件与服务
//详细内容
//{{first.DATA}}
//时间:{{keyword1.DATA}}
//描述:{{keyword2.DATA}}
//{{remark.DATA}}
public static void SendSystemMessage(string openID,string name,string content,string url="")
{
var dict = new Dictionary<string, ValueColor>();
var first = string.Format("你好,ERP系统中的用户{0},系统发给你下面的消息", name);
dict.Add("first",new ValueColor(first));
dict.Add("keyword1", new ValueColor(FormatTime(DateTime.Now)));
dict.Add("keyword2", new ValueColor(content));
InOutMessageUtil.SendTemplateMessage(openID, "QEgY8xa4BuAAcyTex1qXuN9KeKM93O9XHCz2Ti-oCpc", dict, url);
}
public static void SendCloseMessage(string openID, string messageID,string description)
{
var dict = new Dictionary<string, ValueColor>();
var first = string.Format("你好,发给你的审批消息NO.{0}已关闭", messageID);
dict.Add("first", new ValueColor(first));
dict.Add("keyword1", new ValueColor(FormatTime(DateTime.Now)));
dict.Add("keyword2", new ValueColor(description));
InOutMessageUtil.SendTemplateMessage(openID, "QEgY8xa4BuAAcyTex1qXuN9KeKM93O9XHCz2Ti-oCpc", dict);
}
public static void SendQRCodeNotFoundMessage(string openID)
{
var dict = new Dictionary<string, ValueColor>();
var first = string.Format("你所访问的二维码已失效");
dict.Add("first", new ValueColor(first));
dict.Add("keyword1", new ValueColor(FormatTime(DateTime.Now)));
dict.Add("keyword2", new ValueColor("请重新登录系统并扫描二维码"));
InOutMessageUtil.SendTemplateMessage(openID, "QEgY8xa4BuAAcyTex1qXuN9KeKM93O9XHCz2Ti-oCpc", dict);
}
//模板ID:Qp53p4jHyk9vxXiLs0VRUN_5HHwmjeWPT-7XLwG2FkU
//标题:绑定通知
//详细内容
//{{first.DATA}}
//绑定账号:{{keyword1.DATA}}
//绑定时间:{{keyword2.DATA}}
//{{remark.DATA}}
public static void SendOverwriteNotice(string openID,string username)
{
var dict = new Dictionary<string, ValueColor>();
var first = String.Format("你好,ERP系统中有新的微信账号替换了你原来绑定的用户");
dict.Add("first", new ValueColor(first));
dict.Add("keyword1", new ValueColor(username));
dict.Add("keyword2", new ValueColor(FormatTime(BLContext.Now)));
dict.Add("remark", new ValueColor("若不是你本人操作,请与管理员联系"));
InOutMessageUtil.SendTemplateMessage(openID, "Qp53p4jHyk9vxXiLs0VRUN_5HHwmjeWPT-7XLwG2FkU", dict);
}
public static void SendBindMessage(string openID,string username){
var dict = new Dictionary<string, ValueColor>();
var first = String.Format("你好,你成功同ERP系统的用户绑定");
dict.Add("first", new ValueColor(first));
dict.Add("keyword1", new ValueColor(username));
dict.Add("keyword2", new ValueColor(FormatTime(BLContext.Now)));
dict.Add("remark", new ValueColor("若不是你本人操作,请与管理员联系"));
InOutMessageUtil.SendTemplateMessage(openID, "Qp53p4jHyk9vxXiLs0VRUN_5HHwmjeWPT-7XLwG2FkU", dict);
}
}
}