示例#1
0
        /// <summary>
        /// 微信客服回复序列化
        /// </summary>
        /// <param name="wxRequest"></param>
        /// <returns></returns>
        public string GetWXResponseMsg(WXReqBaseMsg wxRequest)
        {
            WXRepBaseMsg wXRepTextReply = new WXRepBaseMsg();

            wXRepTextReply.CreateTime   = DateTime.Now.Ticks;
            wXRepTextReply.FromUserName = wxRequest.ToUserName;
            wXRepTextReply.ToUserName   = wxRequest.FromUserName;
            wXRepTextReply.MsgType      = "transfer_customer_service";

            return(XmlConvertHelper.SerializeObject <WXRepBaseMsg>(wXRepTextReply));
        }
示例#2
0
        /// <summary>
        /// 获取文本响应信息
        /// </summary>
        /// <param name="wxRequest"></param>
        /// <param name="account"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetWXResponseMsg(WXReqBaseMsg wxRequest, WeChatAccountTmp account, long id)
        {
            TextReply textReply = base.GetById(id);

            WXRepTextReply wXRepTextReply = new WXRepTextReply();

            wXRepTextReply.CreateTime   = DateTime.Now.Ticks;
            wXRepTextReply.FromUserName = wxRequest.ToUserName;
            wXRepTextReply.ToUserName   = wxRequest.FromUserName;
            wXRepTextReply.MsgType      = WXRepMsgType.text;

            //文本回复内容
            wXRepTextReply.Content = textReply.reply_contents;

            return(XmlConvertHelper.SerializeObject <WXRepTextReply>(wXRepTextReply));
        }
示例#3
0
        /// <summary>
        /// 获取文本响应信息
        /// </summary>
        /// <param name="wxRequest"></param>
        /// <param name="account"></param>
        /// <param name="content"></param>
        /// <param name="globalConfig"></param>
        /// <returns></returns>
        public string GetWXResponseMsg(WXReqBaseMsg wxRequest, string content)
        {
            if (!string.IsNullOrEmpty(content))
            {
                WXRepTextReply wXRepTextReply = new WXRepTextReply();

                wXRepTextReply.CreateTime   = DateTime.Now.Ticks;
                wXRepTextReply.FromUserName = wxRequest.ToUserName;
                wXRepTextReply.ToUserName   = wxRequest.FromUserName;
                wXRepTextReply.MsgType      = WXRepMsgType.text;

                //文本回复内容
                wXRepTextReply.Content = content;

                return(XmlConvertHelper.SerializeObject <WXRepTextReply>(wXRepTextReply));
            }
            return(string.Empty);
        }
        /// <summary>
        /// 微信多图文回复序列化
        /// </summary>
        /// <param name="request"></param>
        /// <param name="wXRepImgTextReply"></param>
        /// <returns></returns>
        public string GetWXResponseMsg(WXReqBaseMsg request, List <WXRepImgTextReply> wXRepImgTextReply)
        {
            //多图文信息
            if (wXRepImgTextReply != null && wXRepImgTextReply.Count > 0)
            {
                WXRepNews wXRepBaseMsg = new WXRepNews();
                //接收人
                wXRepBaseMsg.ToUserName = request.FromUserName;
                //发送人
                wXRepBaseMsg.FromUserName = request.ToUserName;
                //创建时间
                wXRepBaseMsg.CreateTime = DateTime.Now.Ticks;
                //消息类型
                wXRepBaseMsg.MsgType = WXRepMsgType.news;
                //多图文数量
                wXRepBaseMsg.imgTextReplys = wXRepImgTextReply;
                //多图文数量
                wXRepBaseMsg.ArticleCount = wXRepImgTextReply.Count;

                return(XmlConvertHelper.SerializeObject <WXRepNews>(wXRepBaseMsg));
            }
            return(string.Empty);
        }