From 14c621d421cd175f19b9bdfb5e7babc722d9b206 Mon Sep 17 00:00:00 2001 From: yashen Date: Fri, 14 Oct 2016 12:18:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E5=A4=84=E7=90=86=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E5=90=8E=E5=8F=8D=E9=A6=88=E7=BB=99=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContentTemplate_/ContentTemplateEdit.cs | 6 +- B3WeChat/Entities/MeassageBody.cs | 11 +++ B3WeChat/Rpcs/ApproveMessageRpc.cs | 14 ++++ B3WeChat/Rpcs/ClientRpc.cs | 7 +- B3WeChat/Utils/SendMessageUtil.cs | 70 ++++++++----------- 5 files changed, 59 insertions(+), 49 deletions(-) diff --git a/B3WeChat.Web/Pages/B3WeChat/ContentTemplate_/ContentTemplateEdit.cs b/B3WeChat.Web/Pages/B3WeChat/ContentTemplate_/ContentTemplateEdit.cs index 4c37f93..5aaae0a 100644 --- a/B3WeChat.Web/Pages/B3WeChat/ContentTemplate_/ContentTemplateEdit.cs +++ b/B3WeChat.Web/Pages/B3WeChat/ContentTemplate_/ContentTemplateEdit.cs @@ -34,11 +34,11 @@ setTimeout(changed,500); protected override void BuildBasePropertiesEditor(TitlePanel titlePanel, PageLayoutSection pageLayoutSection) { var layoutManager = new LayoutManager("", mDFInfo, mDFContainer); - layoutManager.Add("Text", InputCreator.CreateTextArea(480, 640)) + layoutManager.Add("Text", InputCreator.CreateTextArea(320, 240)) .Attributes["onchange"] = "changed();"; - layoutManager.Add("TestData", InputCreator.CreateTextArea(480, 640)) + layoutManager.Add("TestData", InputCreator.CreateTextArea(320, 240)) .Attributes["onchange"] = "changed();"; - layoutManager.Add("ShowResult", new SimpleLabel("显示"), new LiteralControl(@"")); + layoutManager.Add("ShowResult", new SimpleLabel("显示"), new LiteralControl(@"")); layoutManager["ShowResult"].NotAutoAddToContainer = true; var config = new AutoLayoutConfig(); diff --git a/B3WeChat/Entities/MeassageBody.cs b/B3WeChat/Entities/MeassageBody.cs index 8750112..b4da643 100644 --- a/B3WeChat/Entities/MeassageBody.cs +++ b/B3WeChat/Entities/MeassageBody.cs @@ -29,6 +29,17 @@ namespace BWP.B3WeChat.Entities } public class ValueColor { + public ValueColor() + { + + } + + public ValueColor(string value, string color = "#173177") + { + this.value = value; + this.color = color; + } + public string value { get; set; } public string color { get; set; } } diff --git a/B3WeChat/Rpcs/ApproveMessageRpc.cs b/B3WeChat/Rpcs/ApproveMessageRpc.cs index 96e9ce9..a75e3d3 100644 --- a/B3WeChat/Rpcs/ApproveMessageRpc.cs +++ b/B3WeChat/Rpcs/ApproveMessageRpc.cs @@ -87,5 +87,19 @@ namespace BWP.B3WeChat.Rpcs bl.Delete(messageID); } + [Rpc] + public static void ExecuteSuccess(string messageID) + { + var message = bl.Load(messageID); + 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); + bl.Delete(messageID); + } } } diff --git a/B3WeChat/Rpcs/ClientRpc.cs b/B3WeChat/Rpcs/ClientRpc.cs index a2c32ef..c393ad5 100644 --- a/B3WeChat/Rpcs/ClientRpc.cs +++ b/B3WeChat/Rpcs/ClientRpc.cs @@ -38,12 +38,7 @@ namespace BWP.B3WeChat.Rpcs public static void Send(string username, string content) { string oppenid = GetOpenId(username); - string[] param = content.Split('|'); - switch (param[0]) - { - case "SendAgentInfo": SendMessageUtil.SendAgentInfo(oppenid, param[1], param[2], param[3], param[4]); break; - default: SendMessageUtil.SendInformInfo(oppenid,"青花瓷软件温馨提醒",DateTime.Now.ToString("yyyy-MM-dd HH:mm"),content,string.Empty,string.Empty,string.Empty,string.Empty); break; - } + SendMessageUtil.SendInformInfo(oppenid, "青花瓷软件温馨提醒", DateTime.Now.ToString("yyyy-MM-dd HH:mm"), content, string.Empty, string.Empty, string.Empty, string.Empty); } static string GetOpenId(string username) diff --git a/B3WeChat/Utils/SendMessageUtil.cs b/B3WeChat/Utils/SendMessageUtil.cs index 6c02d4f..85cb170 100644 --- a/B3WeChat/Utils/SendMessageUtil.cs +++ b/B3WeChat/Utils/SendMessageUtil.cs @@ -6,19 +6,27 @@ 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) + 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 = time.ToString("yyy-MM-dd HH:mm:ss"); + var keyword2 = FormatTime(time); var remark = "你可以点击本消息进入处理界面"; Dictionary dic = new Dictionary(); @@ -30,49 +38,31 @@ namespace BWP.B3WeChat.Utils } - - - + //标题反馈处理通知 + //行业IT科技 - IT软件与服务 + //详细内容 //{{first.DATA}} - //审批类别:{{keyword1.DATA}} - //审批事项:{{keyword2.DATA}} - //审批意见:{{keyword3.DATA}} - //审批结果:{{keyword4.DATA}} + //反馈类型:{{keyword1.DATA}} + //反馈信息:{{keyword2.DATA}} + //提交时间:{{keyword3.DATA}} + //处理结果:{{keyword4.DATA}} //{{remark.DATA}} - public static void SendApprovetMessage(string openID, string messageid) + public static void SendFeedbackNotice(string openID,string first,string type,string info,DateTime submitTime,bool success,string remark=null) { - var keyword1 = "微信审批"; - var keyword2 = "同意"; - var keyword3 = ""; - var keyword4 = "执行成功"; - - } - - public static void SendRejectMessage() - { - + var dic = new Dictionary(); + 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); } - - - /// - /// 发送代办信息 - /// - /// - /// 题目 - /// 事项 - /// 未处理时间 - /// 备注 - /// - public static void SendAgentInfo(string openid, string title, string todeal, string delay, string remark) - { - Dictionary dic = new Dictionary(); - dic.Add("first", new ValueColor() { value = title, color = "#173177" }); - dic.Add("keyword1", new ValueColor() { value = todeal, color = "#173177" }); - dic.Add("keyword2", new ValueColor() { value = delay, color = "#173177" }); - dic.Add("remark", new ValueColor() { value = remark, color = "#173177" }); - InOutMessageUtil.SendTemplateMessage(openid, "uhy7GuF8zwBA6pjvjQWpn02fiKb0o9cq7dO5DWnUuMg", dic); - } /// /// 发送系统提醒 ///