diff --git a/B3WeChat.Web/B3WeChat.Web.csproj b/B3WeChat.Web/B3WeChat.Web.csproj
index f0adae1..5fa7b17 100644
--- a/B3WeChat.Web/B3WeChat.Web.csproj
+++ b/B3WeChat.Web/B3WeChat.Web.csproj
@@ -116,6 +116,7 @@
Misc_version.cs
+
ASPXCodeBehind
diff --git a/B3WeChat.Web/Pages/B3WeChat/B3Auth.cs b/B3WeChat.Web/Pages/B3WeChat/B3Auth.cs
new file mode 100644
index 0000000..4ffb093
--- /dev/null
+++ b/B3WeChat.Web/Pages/B3WeChat/B3Auth.cs
@@ -0,0 +1,47 @@
+using BWP.B3WeChat;
+using BWP.B3WeChat.BO;
+using Forks.EnterpriseServices.BusinessInterfaces;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web;
+
+namespace BWP.Web.Pages.B3WeChat
+{
+ class B3Auth:IHttpHandler
+ {
+ public bool IsReusable
+ {
+ get { return true; }
+ }
+
+ public void ProcessRequest(HttpContext context)
+ {
+ var request = context.Request;
+ var service = context.Request.QueryString["service"];
+ var customerCode = request.QueryString["customerCode"];
+ var userContext = WeChatUserContext.Current;
+ var customer = userContext.Customers.SingleOrDefault((item) => item.CustomerCode == customerCode);
+ if (customer == null)
+ {
+ throw new Exception("微信号没有关联B3系统中的用户");
+ }
+
+ var loginRequest = new ScanLoginRequest();
+ loginRequest.CustomerCode = customerCode;
+ loginRequest.Confirmed = true;
+ loginRequest.CustomerUsername = customer.CustomerUsername;
+
+ using (var tranContext = new TransactionContext())
+ {
+ tranContext.Session.Insert(loginRequest);
+ tranContext.Commit();
+ }
+
+ var result = service + "&code=" + loginRequest.ID.ToString();
+ context.Response.Redirect(result);
+
+ }
+ }
+}
diff --git a/B3WeChat.sln b/B3WeChat.sln
index 1d594b1..a82ef84 100644
--- a/B3WeChat.sln
+++ b/B3WeChat.sln
@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
+# Visual Studio 2012
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "B3WeChat", "B3WeChat\B3WeChat.csproj", "{9E680662-8323-494F-8140-237DB0A9F0D9}"
diff --git a/B3WeChat/Rpcs/ClientRpc.cs b/B3WeChat/Rpcs/ClientRpc.cs
index 83e0772..6d9e592 100644
--- a/B3WeChat/Rpcs/ClientRpc.cs
+++ b/B3WeChat/Rpcs/ClientRpc.cs
@@ -1,4 +1,5 @@
-using Bwp.MainSystem.BO;
+using Bwp.MainSystem;
+using Bwp.MainSystem.BO;
using BWP.B3WeChat.BO;
using BWP.B3WeChat.BO.NamedValueTemplate;
using BWP.B3WeChat.Utils;
@@ -13,6 +14,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
+using System.Web;
using TSingSoft.WebPluginFramework;
namespace BWP.B3WeChat.Rpcs
@@ -46,6 +48,21 @@ namespace BWP.B3WeChat.Rpcs
SendMessageUtil.SendSystemMessage(CustomerUserContext.Current.GetOpenID(username), username, content);
}
+ [Rpc]
+ public static void SendAuthLinkMessage(string username, string content, string serverUrl,string pathUrl)
+ {
+ var userContext = CustomerUserContext.Current;
+
+ var fullUrl = serverUrl + pathUrl;
+ var loginUrl = string.Format("{0}OuterLogin.aspx?source=BWPScanLogin&redirectUrl={1}", serverUrl, HttpUtility.UrlEncode(fullUrl));
+
+ var config = new MainSystemConfig();
+ var linkUrl = config.InternetAccessAddress.Value + "B3WeChat/B3Auth.aspx?service=" + HttpUtility.UrlEncode(loginUrl) + "&customerCode=" + HttpUtility.UrlEncode(userContext.CustomerCode);
+
+ SendMessageUtil.SendSystemMessage(CustomerUserContext.Current.GetOpenID(username), username, content, linkUrl);
+ }
+
+
[Rpc]
public static void SendFollowMessage(string username, string content, string businessNo)
{