Browse Source

修改微信发消息模板

master
yashen 9 years ago
parent
commit
a77c52fd46
4 changed files with 27 additions and 34 deletions
  1. +1
    -1
      B3WeChat/Entities/MeassageBody.cs
  2. +2
    -2
      B3WeChat/Rpcs/ApproveMessageRpc.cs
  3. +1
    -2
      B3WeChat/Rpcs/ClientRpc.cs
  4. +23
    -29
      B3WeChat/Utils/SendMessageUtil.cs

+ 1
- 1
B3WeChat/Entities/MeassageBody.cs View File

@ -34,7 +34,7 @@ namespace BWP.B3WeChat.Entities
}
public ValueColor(string value, string color = "#173177")
public ValueColor(string value, string color = null)
{
this.value = value;
this.color = color;


+ 2
- 2
B3WeChat/Rpcs/ApproveMessageRpc.cs View File

@ -91,14 +91,14 @@ namespace BWP.B3WeChat.Rpcs
public static void ExecuteSuccess(string messageID)
{
var message = bl.Load(messageID);
SendMessageUtil.SendFeedbackNotice(message.OpenID, "你好,你的审批结果ERP系统已收到并处理", "微信审批", message.ID, message.CreateTime, true);
SendMessageUtil.SendFeedbackNotice(message.OpenID, "你好,你的审批结果ERP系统已收到并处理", "微信审批接收", "消息号" + message.ID, message.CreateTime, true);
bl.Delete(messageID);
}
[Rpc]
public static void ExecuteFail(string messageID,string reason){
var message = bl.Load(messageID);
SendMessageUtil.SendFeedbackNotice(message.OpenID, "你好,你的审批结果ERP系统已收到并处理", "微信审批", message.ID, message.CreateTime, false, reason);
SendMessageUtil.SendFeedbackNotice(message.OpenID, "你好,你的审批结果ERP系统已收到并处理", "微信审批接收", "消息号" + message.ID, message.CreateTime, false, reason);
bl.Delete(messageID);
}
}


+ 1
- 2
B3WeChat/Rpcs/ClientRpc.cs View File

@ -37,8 +37,7 @@ namespace BWP.B3WeChat.Rpcs
[Rpc]
public static void Send(string username, string content)
{
string oppenid = GetOpenId(username);
SendMessageUtil.SendInformInfo(oppenid, "青花瓷软件温馨提醒", DateTime.Now.ToString("yyyy-MM-dd HH:mm"), content, string.Empty, string.Empty, string.Empty, string.Empty);
SendMessageUtil.SendSystemMessage(CustomerUserContext.Current.GetOpenID(username), username, content);
}
static string GetOpenId(string username)


+ 23
- 29
B3WeChat/Utils/SendMessageUtil.cs View File

@ -30,10 +30,10 @@ namespace BWP.B3WeChat.Utils
var remark = "你可以点击本消息进入处理界面";
Dictionary<string, ValueColor> dic = new Dictionary<string, ValueColor>();
dic.Add("first", new ValueColor() { value = first, color = "#173177" });
dic.Add("keyword1", new ValueColor() { value = keyword1, color = "#173177" });
dic.Add("keyword2", new ValueColor() { value = keyword2, color = "#173177" });
dic.Add("remark", new ValueColor() { value = remark, color = "#173177" });
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);
}
@ -47,7 +47,7 @@ namespace BWP.B3WeChat.Utils
//提交时间:{{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)
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));
@ -57,35 +57,29 @@ namespace BWP.B3WeChat.Utils
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"));
var keyword4 = success ? "成功" : "失败";
dic.Add("keyword4", new ValueColor(keyword4, success ? "green" : "red"));
dic.Add("remark", new ValueColor(remark));
InOutMessageUtil.SendTemplateMessage(openID, "wMmuu5928fuhDhXEBWSfVUj7up_F6xs2V9sBTvnVVcA", dic);
}
/// <summary>
/// 发送系统提醒
/// </summary>
/// <param name="openid"></param>
/// <param name="title">题目</param>
/// <param name="informtime">提醒时间</param>
/// <param name="informcontent">提醒内容</param>
/// <param name="who">操作人</param>
/// <param name="ip">IP地址</param>
/// <param name="when">操作时间</param>
/// <param name="remark">备注</param>
/// <returns></returns>
public static void SendInformInfo(string openid, string title, string informtime, string informcontent, string who, string ip, string when, string remark, string url = "")
//标题:系统运维通知
//行业:IT科技 - IT软件与服务
//详细内容
//{{first.DATA}}
//时间:{{keyword1.DATA}}
//描述:{{keyword2.DATA}}
//{{remark.DATA}}
public static void SendSystemMessage(string openID,string name,string content)
{
Dictionary<string, ValueColor> dic = new Dictionary<string, ValueColor>();
dic.Add("first", new ValueColor() { value = title, color = "#173177" });
dic.Add("keyword1", new ValueColor() { value = informtime, color = "#173177" });
dic.Add("keyword2", new ValueColor() { value = informcontent, color = "#173177" });
dic.Add("keyword3", new ValueColor() { value = who, color = "#173177" });
dic.Add("keyword4", new ValueColor() { value = ip, color = "#173177" });
dic.Add("keyword5", new ValueColor() { value = when, color = "#173177" });
dic.Add("remark", new ValueColor() { value = remark, color = "#173177" });
InOutMessageUtil.SendTemplateMessage(openid, "JEOjjJ-L-hflfWoHEf7dRMlhj7fCs9NoOYf1iTQ03D4", dic, 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);
}
}
}

Loading…
Cancel
Save