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.
 
 

85 lines
3.1 KiB

using BWP.B3WeChat.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BWP.B3WeChat.Utils
{
public static class SendMessageUtil
{
static string FormatTime(DateTime time)
{
return time.ToString("yyyy-MM-dd HH:mm:ss");
}
//编号: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);
}
//标题反馈处理通知
//行业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)
{
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);
}
}
}