示例#1
0
        //序列化json
        private string DoJSONRequest(string path, Dictionary <string, object> data, string first, string method = "POST")
        {
            string strdata = JsonConvert.SerializeObject(data);

            if (!path.Contains("?"))
            {
                path += "?";
            }
            string url    = "https://api.weixin.qq.com/" + path;
            string result = NetHelper.HttpRequest(url, strdata, method, 60000, Encoding.UTF8, ContentTypes.JSON);

            try  //保存日志
            {
                WD_TemplateMessageLog log = new WD_TemplateMessageLog();
                log.CreateDate   = DateTime.Now;
                log.FromUserName = data["touser"].ToString();
                log.keyword      = strdata;
                log.Result       = result;
                log.url          = url;
                log.First        = first;
                mss.SaveTemplateMessagelog(log);
            }
            catch (Exception)
            {
            }
            return(result);
        }