diff --git a/B3WeChat/Rpcs/ApproveMessageRpc.cs b/B3WeChat/Rpcs/ApproveMessageRpc.cs index 57da8fe..8654ea8 100644 --- a/B3WeChat/Rpcs/ApproveMessageRpc.cs +++ b/B3WeChat/Rpcs/ApproveMessageRpc.cs @@ -2,6 +2,7 @@ using BWP.B3WeChat.BL; using BWP.B3WeChat.BO; using BWP.B3WeChat.BO.NamedValueTemplate; +using BWP.B3WeChat.Utils; using Forks.EnterpriseServices.BusinessInterfaces; using Forks.EnterpriseServices.DomainObjects2; using Forks.EnterpriseServices.DomainObjects2.DQuery; @@ -12,6 +13,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using System.Web; using TSingSoft.WebPluginFramework; namespace BWP.B3WeChat.Rpcs @@ -22,6 +24,8 @@ namespace BWP.B3WeChat.Rpcs static IApproveMessageBL bl = BIFactory.Create(); + const string authUrlTemplate = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={APPID}&redirect_uri={REDIRECT_URI}&response_type=code&scope=snsapi_base #wechat_redirect"; + [Rpc] public static void Insert(ApproveMessage message) { @@ -49,6 +53,11 @@ namespace BWP.B3WeChat.Rpcs var mainSystemConfig = new MainSystemConfig(); var internetAccessAddress = mainSystemConfig.InternetAccessAddress.Value; + var originUrl = internetAccessAddress + "app/index.html"; + + var authUrl = internetAccessAddress + "WeChatLogin.aspx?url=" + HttpUtility.UrlEncode(originUrl); + + SendMessageUtil.SendInformInfo(message.OpenID, message.Title, DateTime.Now.ToShortTimeString(), message.Content, message.Username, BLContext.ClientIP, DateTime.Now.ToShortTimeString(), "", authUrl); } diff --git a/B3WeChat/Utils/SendMessageUtil.cs b/B3WeChat/Utils/SendMessageUtil.cs index 9388661..bea9f18 100644 --- a/B3WeChat/Utils/SendMessageUtil.cs +++ b/B3WeChat/Utils/SendMessageUtil.cs @@ -38,7 +38,7 @@ namespace BWP.B3WeChat.Utils /// 操作时间 /// 备注 /// - public static SendTemplateMessageResult SendInformInfo(string openid, string title, string informtime, string informcontent, string who,string ip, string when, string remark) + public static SendTemplateMessageResult SendInformInfo(string openid, string title, string informtime, string informcontent, string who,string ip, string when, string remark,string url="") { Dictionary dic = new Dictionary(); dic.Add("first", new ValueColor() { value = title, color = "#173177" }); @@ -48,7 +48,7 @@ namespace BWP.B3WeChat.Utils 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" }); - return InOutMessageUtil.SendTemplateMessage(openid, "JEOjjJ-L-hflfWoHEf7dRMlhj7fCs9NoOYf1iTQ03D4", dic); + return InOutMessageUtil.SendTemplateMessage(openid, "JEOjjJ-L-hflfWoHEf7dRMlhj7fCs9NoOYf1iTQ03D4", dic,url); } } }