Example #1
0
        /// <summary>
        /// 获取响应类型实例,并初始化
        /// </summary>
        /// <param name="requestMessage">请求</param>
        /// <returns></returns>
        public static T CreateResponse <T>(this IWReqBase requestMessage) where T : WRespBase, new()
        {
            var response = new T
            {
                ToUserName   = requestMessage.FromUserName,
                FromUserName = requestMessage.ToUserName,
                CreateTime   = DateTime.Now
            };

            return(response);
        }
Example #2
0
        public static WRespImage CreateImageResponse(this IWReqBase requestMessage, string mediaId)
        {
            var response = new WRespImage
            {
                ToUserName   = requestMessage.FromUserName,
                FromUserName = requestMessage.ToUserName,
                CreateTime   = DateTime.Now,
                Image        = { MediaId = mediaId }
            };

            return(response);
        }
Example #3
0
        public static WRespText CreateTextResponse(this IWReqBase requestMessage, string content)
        {
            if (content == null)
            {
                content = string.Empty;
            }
            var response = new WRespText
            {
                ToUserName   = requestMessage.FromUserName,
                FromUserName = requestMessage.ToUserName,
                CreateTime   = DateTime.Now,
                Content      = content
            };

            return(response);
        }