2025-03-28 09:49:56 +08:00

69 lines
2.8 KiB
C#

using SuperMap.RealEstate.WeiXinExtend;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
namespace WeiXin.WebSite
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
return;
WeiXinPlatform _WeiXinPlatform = new WeiXinPlatform("supermap_realestate");
switch (_WeiXinPlatform.MsgType)
{
case MessageType.Text:
//_WeiXinPlatform.ReplyText("文本消息:" + _WeiXinPlatform.ReceiveMessage.Content);
_WeiXinPlatform.ReplyNews("文本消息", _WeiXinPlatform.ReceiveMessage.Content,
_WeiXinPlatform.AbsolutePath("SuperMap_Title.png"),
_WeiXinPlatform.AbsolutePath("News.aspx?Guid=" + Guid.NewGuid().ToString()));
break;
case MessageType.Image:
//_WeiXinPlatform.ReplyText("图片消息:" + _WeiXinPlatform.ReceiveMessage.PicUrl);
_WeiXinPlatform.ReplyNews("图片消息", @" 感谢您发送来图片。
图片地址为:" + _WeiXinPlatform.ReceiveMessage.PicUrl + @"
", _WeiXinPlatform.ReceiveMessage.PicUrl, _WeiXinPlatform.AbsolutePath("News.aspx?ImageUrl=" + _WeiXinPlatform.ReceiveMessage.PicUrl));
break;
case MessageType.Location:
_WeiXinPlatform.ReplyText(string.Format(_ReplyText, "地理坐标消息",
_WeiXinPlatform.ReceiveMessage.Location_X,
_WeiXinPlatform.ReceiveMessage.Location_Y,
_WeiXinPlatform.ReceiveMessage.Scale,
_WeiXinPlatform.ReceiveMessage.Label));
break;
case MessageType.Event:
if (_WeiXinPlatform.ReceiveMessage.Event == "subscribe")
{
_WeiXinPlatform.ReplyNews("订阅消息","感谢您关注!",
_WeiXinPlatform.AbsolutePath("SuperMap_Title.png"),
_WeiXinPlatform.AbsolutePath("News.aspx?Guid=" + Guid.NewGuid().ToString()));
}
else
{
_WeiXinPlatform.ReplyText("事件推送。" + _WeiXinPlatform.ReceiveMessage.EventKey);
}
break;
default:
_WeiXinPlatform.ReplyText("暂时不支持“" + _WeiXinPlatform.MsgType.ToString() + "”");
break;
}
}
string _ReplyText = @"{0}
x:{1}
y{2}
scale:{3}
label:{4}";
}
}