/// <summary> /// 处理位置消息 /// </summary> /// <param name="msgStr"></param> /// <returns></returns> public string Handle(string msgStr) { var posMsg = Xml.Net.XmlConvert.DeserializeObject <Models.Messages.LocationMessage>(msgStr); // 构造客服回复消息 var reply = new Service.Models.TextMessage { touser = posMsg.FromUserName, text = new Service.Models.TextContent { content = "收到了你的位置消息: " + posMsg.Label, }, }; return(AppUtils.JsonUtil.ToJson(reply)); }
/// <summary> /// 处理图片消息 /// </summary> /// <param name="msgStr"></param> /// <returns></returns> public string Handle(string msgStr) { var imgMsg = Xml.Net.XmlConvert.DeserializeObject <Models.Messages.ImageMessage>(msgStr); // 构造客服回复消息 var reply = new Service.Models.TextMessage { touser = imgMsg.FromUserName, text = new Service.Models.TextContent { content = "收到了你的图片消息: " + imgMsg.PicUrl, }, }; return(AppUtils.JsonUtil.ToJson(reply)); }
/// <summary> /// 处理视频消息 /// </summary> /// <param name="msgStr"></param> /// <returns></returns> public string Handle(string msgStr) { var vMsg = Xml.Net.XmlConvert.DeserializeObject <Models.Messages.ShortVideoMessage>(msgStr); // 构造客服回复消息 var reply = new Service.Models.TextMessage { touser = vMsg.FromUserName, text = new Service.Models.TextContent { content = "收到了你的视频消息: " + vMsg.ThumbMediaId, }, }; return(AppUtils.JsonUtil.ToJson(reply)); }