public void SendNews(string deviceId, string openId) { DataTable dt = QrChildManager.GetOpenId(deviceId); Device_user du = new Device_user(); Dictionary <string, List <Dictionary <string, string> > > dic2 = new Dictionary <string, List <Dictionary <string, string> > >(); List <Dictionary <string, string> > list2 = new List <Dictionary <string, string> >(); Dictionary <string, string> dic3 = new Dictionary <string, string>(); dic3.Add("openid", openId); dic3.Add("lang", "zh_CN"); list2.Add(dic3); dic2.Add("user_list", list2); string data2 = du.GetUserInformation(JsonConvert.SerializeObject(dic2)); Dictionary <string, List <Dictionary <string, object> > > list3 = JsonConvert.DeserializeObject <Dictionary <string, List <Dictionary <string, object> > > >(data2); string user = ""; foreach (var item in list3["user_info_list"]) { if (item["openid"].ToString() == openId) { user = item["nickname"].ToString(); } } foreach (DataRow row in dt.Rows) { string content = string.Format("欢迎成员{0}加入!", user); string data = "{\"touser\":\"" + row["OpenId"] + "\",\"msgtype\":\"text\",\"text\":{\"content\":\"" + content + "\"}}"; du.SendNews(data); } }
private string BindWeChat(string openId) { Device_user du = new Device_user(); string device = QrChildManager.GetChildDeviceId(openId); if (device == null && device == "") { return(""); } return("1"); }