private static string GetSign(string body) { IDictionary json = AopUtils.ParseJson(body); Console.WriteLine(json); return((string)json["sign"]); }
protected void Button_Click(object sender, EventArgs e) { string biz_content = Request.Form.Get("biz_content"); string response = ShortLinkBiz.process(biz_content); IDictionary response_dict = AopUtils.ParseJson(response); //输出返回的json Response.Output.WriteLine(response); Response.End(); }
protected void Button1_Click(object sender, EventArgs e) { string biz_content = Request.Form.Get("biz_content"); string response = null; //biz_content的json为示例数据,实际数据需要按照文档组装 //判断是否有toUserId,如果有,则单发,如果没有,则群发。 //群发会导致所有人都能收到,一周只能发送一次 if (biz_content.Contains("\"toUserId\":")) { response = MessageSendBiz.CustomSend(biz_content); } else { response = MessageSendBiz.TotalSend(biz_content); } IDictionary response_dict = AopUtils.ParseJson(response); //输出返回的json Response.Output.WriteLine(response); Response.End(); }
public T Parse(string body, string charset) { T rsp = null; IDictionary json = AopUtils.ParseJson(body); if (json != null) { IDictionary data = null; // 忽略根节点的名称 foreach (object key in json.Keys) { data = json[key] as IDictionary; if (data != null && data.Count > 0) { break; } } if (data != null) { IAopReader reader = new AopJsonReader(data); rsp = (T)AopJsonConvert(reader, typeof(T)); } } if (rsp == null) { rsp = Activator.CreateInstance <T>(); } if (rsp != null) { rsp.Body = body; } return(rsp); }