private string client_OnUserFollow(object sender, EventArgs e) { NameValueCollection param = new NameValueCollection { HttpContext.Current.Request.Form, HttpContext.Current.Request.QueryString }; try { AlipayOHClient alipayOHClient = (AlipayOHClient)sender; SiteSettings masterSettings = SettingsManager.GetMasterSettings(); Articles articles = new Articles { Item = new Item { Description = masterSettings.AliOHFollowRelay, Title = (string.IsNullOrWhiteSpace(masterSettings.AliOHFollowRelayTitle) ? "欢迎您的关注!" : masterSettings.AliOHFollowRelayTitle) } }; IRequest request = new MessagePushRequest(alipayOHClient.request.AppId, alipayOHClient.request.FromUserId, articles, 1, null, "image-text"); AlipayOHClient alipayOHClient2 = new AlipayOHClient(masterSettings.AliOHServerUrl, alipayOHClient.request.AppId, this.alipayPubKeyFile, this.priKeyFile, this.pubKeyFile, "UTF-8"); MessagePushResponse messagePushResponse = alipayOHClient2.Execute <MessagePushResponse>(request); } catch (Exception ex) { Globals.WriteExceptionLog_Page(ex, param, "alipay.ashx"); } return(""); }
private string client_OnUserFollow(object sender, EventArgs e) { try { AlipayOHClient client = (AlipayOHClient)sender; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); Articles articles2 = new Articles(); Item item = new Item { Description = masterSettings.AliOHFollowRelay, Title = string.IsNullOrWhiteSpace(masterSettings.AliOHFollowRelayTitle) ? "欢迎您的关注!" : masterSettings.AliOHFollowRelayTitle }; articles2.Item = item; Articles articles = articles2; IRequest request = new MessagePushRequest(client.request.AppId, client.request.FromUserId, articles, 1, null, "image-text"); new AlipayOHClient(masterSettings.AliOHServerUrl, client.request.AppId, this.alipayPubKeyFile, this.priKeyFile, this.pubKeyFile, "UTF-8").Execute <MessagePushResponse>(request); } catch (Exception) { } return(""); }