/// <summary>
        /// 通过POST请求方式,传入一个表单(object类型),获取一个JSON对象,并将其反向序列化,最终得到一个简单数据实体
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <param name="objRequest"></param>
        /// <returns></returns>
        public static async Task <T> GetJson <T>(string url, object objRequest)
        {
            var jsonString = WeixinJsonHelper.Serialize(objRequest);

            using (MemoryStream ms = new MemoryStream())
            {
                var bytes = Encoding.UTF8.GetBytes(jsonString);
                ms.Write(bytes, 0, bytes.Length);
                ms.Seek(0, SeekOrigin.Begin);

                return(await HttpUtility.PostGetJson <T>(url, null, ms));
            }
        }
        public string ToJson(string jsapiTicket, string refererUrl)
        {
            var elements = new Dictionary <string, object>();

            elements.Add("jsapi_ticket", jsapiTicket);
            elements.Add("nonceStr", this.nonceStr);            //nonceStr
            elements.Add("timestamp", this.timestamp);
            elements.Add("url", refererUrl);

            signature = WeixinJssdkSignatureHelper.CalculateJsSignature(elements);

            return(WeixinJsonHelper.Serialize(this));
        }
        public static async Task <T> Send <T>(string url, object data, MessageSendType sendType = MessageSendType.GET)
        {
            switch (sendType)
            {
            case MessageSendType.GET:
                return(await HttpUtility.GetJson <T>(url));

            case MessageSendType.POST:
                var jsonString = WeixinJsonHelper.Serialize(data);
                using (MemoryStream ms = new MemoryStream())
                {
                    var bytes = Encoding.UTF8.GetBytes(jsonString);
                    ms.Write(bytes, 0, bytes.Length);
                    ms.Seek(0, SeekOrigin.Begin);

                    return(await HttpUtility.PostGetJson <T>(url, null, ms));
                }

            default:
                throw new ArgumentOutOfRangeException("sendType");
            }
        }