/// <summary> /// 用openid换取用户信息 /// </summary> /// <param name="openid">微信标识id</param> /// <returns></returns> public Dictionary <string, object> GetUserList(string openid) { JavaScriptSerializer Jss = new JavaScriptSerializer(); string access_token = wxAccess_token.IsExistAccess_Token(); //获取access_token string url = string.Format("https://api.weixin.qq.com/cgi-bin/user/info?access_token={0}&openid={1}&lang=zh_CN", access_token, openid); string wxpost = WxRequest.GetPage(url, ""); Dictionary <string, object> respDic = (Dictionary <string, object>)Jss.DeserializeObject(wxpost); return(respDic); }
public JsonResult DeleteCustomMenu() { try { string access_token = wxAccess_token.IsExistAccess_Token(); //获取access_token string wxpost = WxRequest.GetPage("https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" + access_token, ""); var msg = new { state = true, msg = "删除菜单结果:" + wxpost }; return(Json(msg)); } catch (Exception ex) { var msg = new { state = false, msg = ex.Message }; return(Json(msg)); } }
public JsonResult getServerIP() { try { string access_token = wxAccess_token.IsExistAccess_Token(); //获取access_token string wxpost = WxRequest.GetPage("https://api.weixin.qq.com/cgi-bin/getcallbackip?access_token=" + access_token, ""); var msg = new { state = true, msg = wxpost }; return(Json(msg)); } catch (Exception ex) { var msg = new { state = false, msg = ex.Message }; return(Json(msg)); } }
public JsonResult get_current_autoreply() { try { string access_token = wxAccess_token.IsExistAccess_Token(); //获取access_token string wxpost = WxRequest.GetPage("https://api.weixin.qq.com/cgi-bin/get_current_autoreply_info?access_token=" + access_token, ""); var msg = new { state = true, msg = "自动回复规则结果:" + wxpost }; return(Json(msg)); } catch (Exception ex) { var msg = new { state = false, msg = ex.Message }; return(Json(msg)); } }
public JsonResult CreateCustomMenu() { try { //FileStream fs = new FileStream(Server.MapPath(".") + "\\Files\\WXFiles\\menu.txt", FileMode.Open); FileStream fs = new FileStream(Server.MapPath("\\Files\\WXFiles\\menu.txt"), FileMode.Open); StreamReader sr = new StreamReader(fs, Encoding.GetEncoding("GBK")); string menu = sr.ReadToEnd(); sr.Close(); fs.Close(); sr.Dispose(); fs.Dispose(); string access_token = wxAccess_token.IsExistAccess_Token(); //获取access_token string wxpost = WxRequest.GetPage("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + access_token, menu); var msg = new { state = true, msg = "创建菜单结果:" + wxpost }; return(Json(msg)); } catch (Exception ex) { var msg = new { state = false, msg = ex.Message }; return(Json(msg)); } }